using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; using Umbraco.Cms.Core.Models.Validation; namespace Umbraco.Cms.Core.Models.ContentEditing; [DataContract(Name = "contentVariant", Namespace = "")] public class ContentVariantSave : IContentProperties { public ContentVariantSave() => Properties = new List(); [DataMember(Name = "name", IsRequired = true)] [RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")] [MaxLength(255, ErrorMessage = "Name must be less than 255 characters")] public string? Name { get; set; } /// /// The culture of this variant, if this is invariant than this is null or empty /// [DataMember(Name = "culture")] public string? Culture { get; set; } /// /// The segment of this variant, if this is invariant than this is null or empty /// [DataMember(Name = "segment")] public string? Segment { get; set; } /// /// Indicates if the variant should be updated /// /// /// If this is false, this variant data will not be updated at all /// [DataMember(Name = "save")] public bool Save { get; set; } /// /// Indicates if the variant should be published /// /// /// This option will have no affect if is false. /// This is not used to unpublish. /// [DataMember(Name = "publish")] public bool Publish { get; set; } [DataMember(Name = "expireDate")] public DateTime? ExpireDate { get; set; } [DataMember(Name = "releaseDate")] public DateTime? ReleaseDate { get; set; } /// /// The property DTO object is used to gather all required property data including data type information etc... for use /// with validation - used during inbound model binding /// /// /// We basically use this object to hydrate all required data from the database into one object so we can validate /// everything we need /// instead of having to look up all the data individually. /// This is not used for outgoing model information. /// [IgnoreDataMember] public ContentPropertyCollectionDto? PropertyCollectionDto { get; set; } [DataMember(Name = "properties")] public IEnumerable Properties { get; set; } }