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 value, string culture); /// /// 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 CultureNames { 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); /// /// Checks if the content and property values are valid in order to be persisted. /// /// /// /// bool IsValid(string culture = null, string segment = null); /// /// Gets a value indicating if all properties values are valid. /// //fixme - needs API review as this is not used apart from in tests //Property[] ValidateAllProperties(); /// /// Validates the content item's properties for the provided culture/segment /// /// /// /// /// /// This will not perform validation for properties that do not match the required ContentVariation based on the culture/segment values provided /// Property[] ValidateProperties(string culture = null, string segment = null); /// /// Gets a value indicating if the culture properties values are valid. /// //fixme - needs API review as this is not used apart from in tests //Property[] ValidatePropertiesForCulture(string culture = null); } }