using System.Collections.Generic;
namespace Umbraco.Core.Models.PublishedContent
{
///
/// Provides a fallback strategy for getting values.
///
// fixme - IPublishedValueFallback is still WorkInProgress
// todo - properly document methods, etc
// todo - understand caching vs fallback (recurse etc)
public interface IPublishedValueFallback
{
///
/// Gets a fallback value for a property.
///
/// The property.
/// The requested culture.
/// The requested segment.
/// An optional default value.
/// A fallback value, or null.
///
/// This method is called whenever property.Value(culture, segment, defaultValue) is called, and
/// property.HasValue(culture, segment) is false.
/// It can only fallback at property level (no recurse).
/// At property level, property.GetValue() does *not* implement fallback, and one has to
/// get property.Value() or property.Value{T}() to trigger fallback.
///
object GetValue(IPublishedProperty property, string culture, string segment, object defaultValue, ICollection visitedLanguages);
///
/// Gets a fallback value for a property.
///
/// The type of the value.
/// The property.
/// The requested culture.
/// The requested segment.
/// An optional default value.
/// A fallback value, or null.
///
/// This method is called whenever property.Value{T}(culture, segment, defaultValue) is called, and
/// property.HasValue(culture, segment) is false.
/// It can only fallback at property level (no recurse).
/// At property level, property.GetValue() does *not* implement fallback, and one has to
/// get property.Value() or property.Value{T}() to trigger fallback.
///
T GetValue(IPublishedProperty property, string culture, string segment, T defaultValue, ICollection visitedLanguages);
///
/// Gets a fallback value for a published element property.
///
/// The published element.
/// The property alias.
/// The requested culture.
/// The requested segment.
/// An optional default value.
/// A fallback value, or null.
///
/// This method is called whenever getting the property value for the specified alias, culture and
/// segment, either returned no property at all, or a property with HasValue(culture, segment) being false.
/// It can only fallback at element level (no recurse).
///
object GetValue(IPublishedElement content, string alias, string culture, string segment, object defaultValue, ICollection visitedLanguages);
///
/// Gets a fallback value for a published element property.
///
/// The type of the value.
/// The published element.
/// The property alias.
/// The requested culture.
/// The requested segment.
/// An optional default value.
/// A fallback value, or null.
///
/// This method is called whenever getting the property value for the specified alias, culture and
/// segment, either returned no property at all, or a property with HasValue(culture, segment) being false.
/// It can only fallback at element level (no recurse).
///
T GetValue(IPublishedElement content, string alias, string culture, string segment, T defaultValue, ICollection visitedLanguages);
///
/// Gets a fallback value for a published content property.
///
/// The published element.
/// The property alias.
/// The requested culture.
/// The requested segment.
/// An optional default value.
/// A fallback value, or null.
///
/// This method is called whenever getting the property value for the specified alias, culture and
/// segment, either returned no property at all, or a property with HasValue(culture, segment) being false.
/// fixme explain & document priority + merge w/recurse?
///
object GetValue(IPublishedContent content, string alias, string culture, string segment, object defaultValue, IEnumerable fallbackMethods, ICollection visitedLanguages);
///
/// Gets a fallback value for a published content property.
///
/// The type of the value.
/// The published element.
/// The property alias.
/// The requested culture.
/// The requested segment.
/// An optional default value.
/// A fallback value, or null.
///
/// This method is called whenever getting the property value for the specified alias, culture and
/// segment, either returned no property at all, or a property with HasValue(culture, segment) being false.
/// fixme explain & document priority + merge w/recurse?
///
T GetValue(IPublishedContent content, string alias, string culture, string segment, T defaultValue, IEnumerable fallbackMethods, ICollection visitedLanguages);
}
}