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 culture.
///
///
/// When is null, sets the invariant
/// culture name, which sets the property.
/// When is not null, throws if the content
/// type does not vary by culture.
///
void SetCultureName(string value, string culture);
///
/// Gets the name of the content item for a specified language.
///
///
/// When is null, gets the invariant
/// culture name, which is the value of the property.
/// When is not null, and the content type
/// does not vary by culture, returns null.
///
string GetCultureName(string culture);
///
/// Gets the names of the content item.
///
///
/// Because a dictionary key cannot be null this cannot contain the invariant
/// culture name, which must be get or set via the property.
///
IReadOnlyDictionary CultureNames { get; }
///
/// Gets the available cultures.
///
///
/// Cannot contain the invariant culture, which is always available.
///
IEnumerable AvailableCultures { 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.
/// Returns false for the invariant culture, in order to be consistent
/// with , even though the invariant culture is
/// always available.
///
bool IsCultureAvailable(string culture);
///
/// Gets the date a culture was created.
///
///
/// When is null, returns null.
/// If the specified culture is not available, returns null.
///
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
///
/// Values 'null' and 'empty' are equivalent for culture and segment.
object GetValue(string propertyTypeAlias, string culture = null, string segment = null, bool published = false);
///
/// Gets the typed value of a Property
///
/// Values 'null' and 'empty' are equivalent for culture and segment.
TValue GetValue(string propertyTypeAlias, string culture = null, string segment = null, bool published = false);
///
/// Sets the (edited) value of a Property
///
/// Values 'null' and 'empty' are equivalent for culture and segment.
void SetValue(string propertyTypeAlias, object value, string culture = null, string segment = null);
///
/// Copies values from another document.
///
void CopyFrom(IContent other, string culture = "*");
// fixme validate published cultures?
///
/// Validates the content item's properties.
///
/// If the content type is variant, then culture can be either '*' or an actual culture, but neither 'null' nor
/// 'empty'. If the content type is invariant, then culture can be either '*' or null or empty.
Property[] ValidateProperties(string culture = "*");
}
}