using System;
using System.Runtime.Serialization;
namespace MediaBrowser.Model.Updates
{
    /// 
    /// Class PackageVersionInfo
    /// 
    public class PackageVersionInfo
    {
        /// 
        /// Gets or sets the name.
        /// 
        /// The name.
        public string name { get; set; }
        /// 
        /// Gets or sets the guid.
        /// 
        /// The guid.
        public string guid { get; set; }
        /// 
        /// Gets or sets the version STR.
        /// 
        /// The version STR.
        public string versionStr { get; set; }
        /// 
        /// The _version
        /// 
        private Version _version;
        /// 
        /// Gets or sets the version.
        /// Had to make this an interpreted property since Protobuf can't handle Version
        /// 
        /// The version.
        [IgnoreDataMember]
        public Version version
        {
            get { return _version ?? (_version = new Version(ValueOrDefault(versionStr, "0.0.0.1"))); }
        }
        /// 
        /// Values the or default.
        /// 
        /// The STR.
        /// The def.
        /// System.String.
        private static string ValueOrDefault(string str, string def)
        {
            return string.IsNullOrEmpty(str) ? def : str;
        }
        /// 
        /// Gets or sets the classification.
        /// 
        /// The classification.
        public PackageVersionClass classification { get; set; }
        /// 
        /// Gets or sets the description.
        /// 
        /// The description.
        public string description { get; set; }
        /// 
        /// Gets or sets the required version STR.
        /// 
        /// The required version STR.
        public string requiredVersionStr { get; set; }
        /// 
        /// Gets or sets the source URL.
        /// 
        /// The source URL.
        public string sourceUrl { get; set; }
        /// 
        /// Gets or sets the source URL.
        /// 
        /// The source URL.
        public string checksum { get; set; }
        /// 
        /// Gets or sets the target filename.
        /// 
        /// The target filename.
        public string targetFilename { get; set; }
        public string infoUrl { get; set; }
    }
}