using System;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Configuration
{
    /// 
    /// Serves as a common base class for the Server and UI application Configurations
    /// ProtoInclude tells Protobuf about subclasses,
    /// The number 50 can be any number, so long as it doesn't clash with any of the ProtoMember numbers either here or in subclasses.
    /// 
    public class BaseApplicationConfiguration
    {
        /// 
        /// The number of days we should retain log files
        /// 
        /// The log file retention days.
        public int LogFileRetentionDays { get; set; }
        /// 
        /// Gets or sets a value indicating whether this instance is first run.
        /// 
        /// true if this instance is first run; otherwise, false.
        public bool IsStartupWizardCompleted { get; set; }
        /// 
        /// Gets or sets the cache path.
        /// 
        /// The cache path.
        public string CachePath { get; set; }
        /// 
        /// Last known version that was ran using the configuration.
        /// 
        /// The version from previous run.
        [XmlIgnore]
        public Version PreviousVersion { get; set; }
        /// 
        /// Stringified PreviousVersion to be stored/loaded,
        /// because System.Version itself isn't xml-serializable
        /// 
        /// String value of PreviousVersion
        public string PreviousVersionStr
        {
            get => PreviousVersion?.ToString();
            set => PreviousVersion = Version.Parse(value);
        }
        /// 
        /// Initializes a new instance of the  class.
        /// 
        public BaseApplicationConfiguration()
        {
            LogFileRetentionDays = 3;
        }
    }
}