using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Runtime.Serialization; using Newtonsoft.Json.Converters; namespace Umbraco.Web.Models.ContentEditing { /// /// Represents the variant info for a content item /// [DataContract(Name = "contentVariant", Namespace = "")] public class ContentVariantDisplay : ITabbedContent, IContentProperties, INotificationModel { public ContentVariantDisplay() { Tabs = new List>(); Notifications = new List(); } [DataMember(Name = "name", IsRequired = true)] public string Name { get; set; } /// /// Defines the tabs containing display properties /// [DataMember(Name = "tabs")] public IEnumerable> Tabs { get; set; } /// /// Internal property used for tests to get all properties from all tabs /// [IgnoreDataMember] [JsonIgnore] IEnumerable IContentProperties.Properties => Tabs.SelectMany(x => x.Properties); /// /// The language/culture assigned to this content variation /// /// /// If this is null it means this content variant is an invariant culture /// [DataMember(Name = "language")] public Language Language { get; set; } [DataMember(Name = "segment")] public string Segment { get; set; } [DataMember(Name = "state")] [JsonConverter(typeof(StringEnumConverter))] public ContentSavedState State { get; set; } [DataMember(Name = "updateDate")] public DateTime UpdateDate { get; set; } [DataMember(Name = "createDate")] public DateTime CreateDate { get; set; } [DataMember(Name = "publishDate")] public DateTime? PublishDate { get; set; } [DataMember(Name = "releaseDate")] public DateTime? ReleaseDate { get; set; } [DataMember(Name = "expireDate")] public DateTime? ExpireDate { get; set; } /// /// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes. /// /// /// The notifications assigned to a variant are currently only used to show custom messages in the save/publish dialogs. /// [DataMember(Name = "notifications")] [ReadOnly(true)] public List Notifications { get; private set; } } }