using System;
using System.Collections.Generic;
namespace Umbraco.Cms.Core.Models.PublishedContent
{
///
///
/// Represents a published content item.
///
///
/// Can be a published document, media or member.
///
public interface IPublishedContent : IPublishedElement
{
#region Content
// TODO: IPublishedContent properties colliding with models
// we need to find a way to remove as much clutter as possible from IPublishedContent,
// since this is preventing someone from creating a property named 'Path' and have it
// in a model, for instance. we could move them all under one unique property eg
// Infos, so we would do .Infos.SortOrder - just an idea - not going to do it in v8
///
/// Gets the unique identifier of the content item.
///
int Id { get; }
///
/// Gets the name of the content item for the current culture.
///
string Name { get; }
///
/// Gets the URL segment of the content item for the current culture.
///
string UrlSegment { get; }
///
/// Gets the sort order of the content item.
///
int SortOrder { get; }
///
/// Gets the tree level of the content item.
///
int Level { get; }
///
/// Gets the tree path of the content item.
///
string Path { get; }
///
/// Gets the identifier of the template to use to render the content item.
///
int? TemplateId { get; }
///
/// Gets the identifier of the user who created the content item.
///
int CreatorId { get; }
///
/// Gets the date the content item was created.
///
DateTime CreateDate { get; }
///
/// Gets the identifier of the user who last updated the content item.
///
int WriterId { get; }
///
/// Gets the date the content item was last updated.
///
///
/// For published content items, this is also the date the item was published.
/// This date is always global to the content item, see CultureDate() for the
/// date each culture was published.
///
DateTime UpdateDate { get; }
///
/// Gets available culture infos.
///
///
/// Contains only those culture that are available. For a published content, these are
/// the cultures that are published. For a draft content, those that are 'available' ie
/// have a non-empty content name.
/// Does not contain the invariant culture. // fixme?
///
IReadOnlyDictionary Cultures { get; }
///
/// Gets the type of the content item (document, media...).
///
PublishedItemType ItemType { get; }
///
/// Gets a value indicating whether the content is draft.
///
///
/// A content is draft when it is the unpublished version of a content, which may
/// have a published version, or not.
/// When retrieving documents from cache in non-preview mode, IsDraft is always false,
/// as only published documents are returned. When retrieving in preview mode, IsDraft can
/// either be true (document is not published, or has been edited, and what is returned
/// is the edited version) or false (document is published, and has not been edited, and
/// what is returned is the published version).
///
bool IsDraft(string culture = null);
///
/// Gets a value indicating whether the content is published.
///
///
/// A content is published when it has a published version.
/// When retrieving documents from cache in non-preview mode, IsPublished is always
/// true, as only published documents are returned. When retrieving in draft mode, IsPublished
/// can either be true (document has a published version) or false (document has no
/// published version).
/// It is therefore possible for both IsDraft and IsPublished to be true at the same
/// time, meaning that the content is the draft version, and a published version exists.
///
bool IsPublished(string culture = null);
#endregion
#region Tree
///
/// Gets the parent of the content item.
///
/// The parent of root content is null.
IPublishedContent Parent { get; }
///
/// Gets the children of the content item that are available for the current culture.
///
IEnumerable Children { get; }
///
/// Gets all the children of the content item, regardless of whether they are available for the current culture.
///
IEnumerable ChildrenForAllCultures { get; }
#endregion
}
}