using System;
using System.Collections.Generic;
using System.Xml.XPath;
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Xml;
namespace Umbraco.Web.PublishedCache
{
///
/// Provides access to cached contents.
///
public interface IPublishedCache : IXPathNavigable
{
///
/// Gets a content identified by its unique identifier.
///
/// A value indicating whether to consider unpublished content.
/// The content unique identifier.
/// The content, or null.
/// The value of overrides defaults.
IPublishedContent GetById(bool preview, int contentId);
///
/// Gets a content identified by its unique identifier.
///
/// A value indicating whether to consider unpublished content.
/// The content unique identifier.
/// The content, or null.
/// The value of overrides defaults.
IPublishedContent GetById(bool preview, Guid contentId);
///
/// Gets a content identified by its Udi identifier.
///
/// A value indicating whether to consider unpublished content.
/// The content Udi identifier.
/// The content, or null.
/// The value of overrides defaults.
IPublishedContent GetById(bool preview, Udi contentId);
///
/// Gets a content identified by its unique identifier.
///
/// The content unique identifier.
/// The content, or null.
/// Considers published or unpublished content depending on defaults.
IPublishedContent GetById(int contentId);
///
/// Gets a content identified by its unique identifier.
///
/// The content unique identifier.
/// The content, or null.
/// Considers published or unpublished content depending on defaults.
IPublishedContent GetById(Guid contentId);
///
/// Gets a content identified by its unique identifier.
///
/// The content unique identifier.
/// The content, or null.
/// Considers published or unpublished content depending on defaults.
IPublishedContent GetById(Udi contentId);
///
/// Gets a value indicating whether the cache contains a specified content.
///
/// A value indicating whether to consider unpublished content.
/// The content unique identifier.
/// A value indicating whether to the cache contains the specified content.
/// The value of overrides defaults.
bool HasById(bool preview, int contentId);
///
/// Gets a value indicating whether the cache contains a specified content.
///
/// The content unique identifier.
/// A value indicating whether to the cache contains the specified content.
/// Considers published or unpublished content depending on defaults.
bool HasById(int contentId);
///
/// Gets contents at root.
///
/// A value indicating whether to consider unpublished content.
/// The contents.
/// The value of overrides defaults.
IEnumerable GetAtRoot(bool preview);
///
/// Gets contents at root.
///
/// The contents.
/// Considers published or unpublished content depending on defaults.
IEnumerable GetAtRoot();
///
/// Gets a content resulting from an XPath query.
///
/// A value indicating whether to consider unpublished content.
/// The XPath query.
/// Optional XPath variables.
/// The content, or null.
/// The value of overrides defaults.
IPublishedContent GetSingleByXPath(bool preview, string xpath, params XPathVariable[] vars);
///
/// Gets a content resulting from an XPath query.
///
/// The XPath query.
/// Optional XPath variables.
/// The content, or null.
/// Considers published or unpublished content depending on defaults.
IPublishedContent GetSingleByXPath(string xpath, params XPathVariable[] vars);
///
/// Gets a content resulting from an XPath query.
///
/// A value indicating whether to consider unpublished content.
/// The XPath query.
/// Optional XPath variables.
/// The content, or null.
/// The value of overrides defaults.
IPublishedContent GetSingleByXPath(bool preview, XPathExpression xpath, params XPathVariable[] vars);
///
/// Gets a content resulting from an XPath query.
///
/// The XPath query.
/// Optional XPath variables.
/// The content, or null.
/// Considers published or unpublished content depending on defaults.
IPublishedContent GetSingleByXPath(XPathExpression xpath, params XPathVariable[] vars);
///
/// Gets contents resulting from an XPath query.
///
/// A value indicating whether to consider unpublished content.
/// The XPath query.
/// Optional XPath variables.
/// The contents.
/// The value of overrides defaults.
IEnumerable GetByXPath(bool preview, string xpath, params XPathVariable[] vars);
///
/// Gets contents resulting from an XPath query.
///
/// The XPath query.
/// Optional XPath variables.
/// The contents.
/// Considers published or unpublished content depending on defaults.
IEnumerable GetByXPath(string xpath, params XPathVariable[] vars);
///
/// Gets contents resulting from an XPath query.
///
/// A value indicating whether to consider unpublished content.
/// The XPath query.
/// Optional XPath variables.
/// The contents.
/// The value of overrides defaults.
IEnumerable GetByXPath(bool preview, XPathExpression xpath, params XPathVariable[] vars);
///
/// Gets contents resulting from an XPath query.
///
/// The XPath query.
/// Optional XPath variables.
/// The contents.
/// Considers published or unpublished content depending on defaults.
IEnumerable GetByXPath(XPathExpression xpath, params XPathVariable[] vars);
///
/// Creates an XPath navigator that can be used to navigate contents.
///
/// A value indicating whether to consider unpublished content.
/// The XPath navigator.
///
/// The value of overrides the context.
/// The navigator is already a safe clone (no need to clone it again).
///
XPathNavigator CreateNavigator(bool preview);
///
/// Creates an XPath navigator that can be used to navigate one node.
///
/// The node identifier.
/// A value indicating whether to consider unpublished content.
/// The XPath navigator, or null.
///
/// The value of overrides the context.
/// The navigator is already a safe clone (no need to clone it again).
/// Navigates over the node - and only the node, ie no children. Exists only for backward
/// compatibility + transition reasons, we should obsolete that one as soon as possible.
/// If the node does not exist, returns null.
///
XPathNavigator CreateNodeNavigator(int id, bool preview);
///
/// Gets a value indicating whether the cache contains published content.
///
/// A value indicating whether to consider unpublished content.
/// A value indicating whether the cache contains published content.
/// The value of overrides defaults.
bool HasContent(bool preview);
///
/// Gets a value indicating whether the cache contains published content.
///
/// A value indicating whether the cache contains published content.
/// Considers published or unpublished content depending on defaults.
bool HasContent();
///
/// Gets a content type identified by its unique identifier.
///
/// The content type unique identifier.
/// The content type, or null.
IPublishedContentType GetContentType(int id);
///
/// Gets a content type identified by its alias.
///
/// The content type alias.
/// The content type, or null.
/// The alias is case-insensitive.
IPublishedContentType GetContentType(string alias);
///
/// Gets contents of a given content type.
///
/// The content type.
/// The contents.
IEnumerable GetByContentType(IPublishedContentType contentType);
}
}