using System.ComponentModel; using System.Runtime.Serialization; namespace Umbraco.Cms.Core.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(); AllowedActions = Enumerable.Empty(); } [DataMember(Name = "allowedActions", IsRequired = true)] public IEnumerable AllowedActions { get; set; } [DataMember(Name = "name", IsRequired = true)] public string? Name { get; set; } [DataMember(Name = "displayName")] public string? DisplayName { get; set; } /// /// 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")] 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; } /// /// Internal property used for tests to get all properties from all tabs /// [IgnoreDataMember] IEnumerable IContentProperties.Properties => Tabs.Where(x => x.Properties is not null).SelectMany(x => x.Properties!); /// /// 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; } /// /// Defines the tabs containing display properties /// [DataMember(Name = "tabs")] public IEnumerable> Tabs { get; set; } } public class ContentVariantScheduleDisplay : ContentVariantDisplay { [DataMember(Name = "releaseDate")] public DateTime? ReleaseDate { get; set; } [DataMember(Name = "expireDate")] public DateTime? ExpireDate { get; set; } }