using System;
using System.Collections.Generic;
namespace Umbraco.Core.Models
{
///
/// Represents a document.
///
///
/// A document can be published, rendered by a template.
///
public interface IContent : IContentBase
{
///
/// Gets or sets the template used to render the content.
///
ITemplate Template { get; set; }
///
/// Gets a value indicating whether the content is published.
///
bool Published { get; }
PublishedState PublishedState { get; }
///
/// Gets a value indicating whether the content has been edited.
///
bool Edited { get; }
///
/// Gets the published version identifier.
///
int PublishedVersionId { get; }
///
/// Gets a value indicating whether the content item is a blueprint.
///
bool Blueprint { get; }
///
/// Gets the template used to render the published version of the content.
///
/// When editing the content, the template can change, but this will not until the content is published.
ITemplate PublishTemplate { get; }
///
/// Gets the name of the published version of the content.
///
/// When editing the content, the name can change, but this will not until the content is published.
string PublishName { get; }
///
/// Gets the identifier of the user who published the content.
///
int? PublisherId { get; }
///
/// Gets the date and time the content was published.
///
DateTime? PublishDate { get; }
///
/// Gets or sets the date and time the content item should be published.
///
DateTime? ReleaseDate { get; set; }
///
/// Gets or sets the date and time the content should be unpublished.
///
DateTime? ExpireDate { get; set; }
///
/// Gets the content type of this content.
///
IContentType ContentType { get; }
///
/// Gets the current status of the content.
///
ContentStatus Status { get; }
///
/// Gets a value indicating whether a given culture is published.
///
///
/// A culture becomes published whenever values for this culture are published,
/// and the content published name for this culture is non-null. It becomes non-published
/// whenever values for this culture are unpublished.
///
bool IsCulturePublished(string culture);
///
/// Gets the date a culture was published.
///
DateTime GetCulturePublishDate(string culture);
///
/// Gets a value indicated whether a given culture is edited.
///
///
/// A culture is edited when it is not published, or when it is published but
/// it has changes.
///
bool IsCultureEdited(string culture);
///
/// Gets the name of the published version of the content for a given culture.
///
///
/// When editing the content, the name can change, but this will not until the content is published.
/// When is null, gets the invariant
/// language, which is the value of the property.
///
string GetPublishName(string culture);
///
/// Gets the published names of the content.
///
///
/// Because a dictionary key cannot be null this cannot get the invariant
/// name, which must be get via the property.
///
IReadOnlyDictionary PublishNames { get; }
///
/// Gets the available cultures.
///
IEnumerable AvailableCultures { get; }
///
/// Gets the published cultures.
///
IEnumerable PublishedCultures { get; }
///
/// Gets the edited cultures.
///
IEnumerable EditedCultures { get; }
// fixme - these two should move to some kind of service
///
/// Changes the for the current content object
///
/// New ContentType for this content
/// Leaves PropertyTypes intact after change
void ChangeContentType(IContentType contentType);
///
/// Changes the for the current content object and removes PropertyTypes,
/// which are not part of the new ContentType.
///
/// New ContentType for this content
/// Boolean indicating whether to clear PropertyTypes upon change
void ChangeContentType(IContentType contentType, bool clearProperties);
///
/// Creates a deep clone of the current entity with its identity/alias and it's property identities reset
///
///
IContent DeepCloneWithResetIdentities();
///
/// Publishes all values.
///
/// A value indicating whether the values could be published.
///
/// The document must then be published via the content service.
/// Values are not published if they are not valie.
///
//fixme return an Attempt with some error results if it doesn't work
bool TryPublishAllValues();
///
/// Publishes values.
///
/// A value indicating whether the values could be published.
///
/// The document must then be published via the content service.
/// Values are not published if they are not valid.
///
//fixme return an Attempt with some error results if it doesn't work
bool TryPublishValues(string culture = null, string segment = null);
///
/// Publishes the culture/any values.
///
/// A value indicating whether the values could be published.
///
/// The document must then be published via the content service.
/// Values are not published if they are not valie.
///
bool PublishCultureValues(string culture = null);
///
/// Clears all published values.
///
void ClearAllPublishedValues();
///
/// Clears published values.
///
void ClearPublishedValues(string culture = null, string segment = null);
///
/// Clears the culture/any published values.
///
void ClearCulturePublishedValues(string culture = null);
///
/// Copies values from another document.
///
void CopyAllValues(IContent other);
///
/// Copies values from another document.
///
void CopyValues(IContent other, string culture = null, string segment = null);
///
/// Copies culture/any values from another document.
///
void CopyCultureValues(IContent other, string culture = null);
}
}