using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; namespace Umbraco.Cms.Core.Models.ContentEditing { [DataContract(Name = "propertyGroup", Namespace = "")] public abstract class PropertyGroupBasic { /// /// Gets the special generic properties tab identifier. /// public const int GenericPropertiesGroupId = -666; /// /// Gets a value indicating whether this tab is the generic properties tab. /// [IgnoreDataMember] public bool IsGenericProperties => Id == GenericPropertiesGroupId; /// /// Gets a value indicating whether the property group is inherited through /// content types composition. /// /// A property group can be inherited and defined on the content type /// currently being edited, at the same time. Inherited is true when there exists at least /// one property group higher in the composition, with the same alias. [DataMember(Name = "inherited")] public bool Inherited { get; set; } // needed - so we can handle alias renames [DataMember(Name = "id")] public int Id { get; set; } [DataMember(Name = "key")] public Guid Key { get; set; } [DataMember(Name = "type")] public PropertyGroupType Type { get; set; } [Required] [DataMember(Name = "name")] public string Name { get; set; } [Required] [DataMember(Name = "alias")] public string Alias { get; set; } [DataMember(Name = "sortOrder")] public int SortOrder { get; set; } } [DataContract(Name = "propertyGroup", Namespace = "")] public class PropertyGroupBasic : PropertyGroupBasic where TPropertyType: PropertyTypeBasic { public PropertyGroupBasic() { Properties = new List(); } [DataMember(Name = "properties")] public IEnumerable Properties { get; set; } } }