using System; using System.Collections.Generic; using Umbraco.Core.Models.Entities; namespace Umbraco.Core.Models { /// /// Provides a base class for content items. /// /// /// Content items are documents, medias and members. /// Content items have a content type, and properties. /// public interface IContentBase : IUmbracoEntity { /// /// Integer Id of the default ContentType /// int ContentTypeId { get; } /// /// Gets the identifier of the writer. /// int WriterId { get; set; } /// /// Gets the version identifier. /// int VersionId { get; } /// /// Sets the name of the content item for a specified language. /// /// /// When is null, sets the invariant /// language, which sets the property. /// void SetName(string culture, string value); /// /// Gets the name of the content item for a specified language. /// /// /// When is null, gets the invariant /// language, which is the value of the property. /// string GetName(string culture); /// /// Gets the names of the content item. /// /// /// Because a dictionary key cannot be null this cannot get the invariant /// name, which must be get or set via the property. /// IReadOnlyDictionary Names { get; } /// /// Gets a value indicating whether a given culture is available. /// /// /// A culture becomes available whenever the content name for this culture is /// non-null, and it becomes unavailable whenever the content name is null. /// bool IsCultureAvailable(string culture); /// /// Gets the date a culture was created. /// DateTime GetCultureDate(string culture); /// /// List of properties, which make up all the data available for this Content object /// /// Properties are loaded as part of the Content object graph PropertyCollection Properties { get; set; } /// /// List of PropertyGroups available on this Content object /// /// PropertyGroups are kind of lazy loaded as part of the object graph IEnumerable PropertyGroups { get; } /// /// List of PropertyTypes available on this Content object /// /// PropertyTypes are kind of lazy loaded as part of the object graph IEnumerable PropertyTypes { get; } /// /// Gets a value indicating whether the content entity has a property with the supplied alias. /// /// Indicates that the content entity has a property with the supplied alias, but /// not necessarily that the content has a value for that property. Could be missing. bool HasProperty(string propertyTypeAlias); /// /// Gets the value of a Property /// object GetValue(string propertyTypeAlias, string culture = null, string segment = null, bool published = false); /// /// Gets the typed value of a Property /// TValue GetValue(string propertyTypeAlias, string culture = null, string segment = null, bool published = false); /// /// Sets the (edited) value of a Property /// void SetValue(string propertyTypeAlias, object value, string culture = null, string segment = null); /// /// Gets a value indicating whether the content and all its properties values are valid. /// Property[] ValidateAll(); /// /// Gets a value indicating whether the content and its properties values are valid. /// Property[] Validate(string culture = null, string segment = null); /// /// Gets a value indicating whether the content and its culture/any properties values are valid. /// Property[] ValidateCulture(string culture = null); } }