namespace Umbraco.Core.Models.PublishedContent
{
///
/// Provides a fallback strategy for getting values.
///
public interface IPublishedValueFallback
{
// fixme discussions & challenges
//
// - the fallback: parameter value must be open, so about anything can be passed to the IPublishedValueFallback
// we have it now, it's an integer + constants, cool
//
// - we need to be able to configure (via code for now) a default fallback policy?
// not! the default value of the fallback: parameter is 'default', not 'none', and if people
// want to implement a different default behavior, they have to override the fallback provider
//
// - (and...)
// ModelsBuilder model.Value(x => x.Price, ...) extensions need to be adjusted too
//
// - cache & perfs
// soon as ppl implement custom fallbacks, caching is a problem, so better just not cache
// OTOH we need to implement the readonly thing for languages
///
/// Tries to get a fallback value for a property.
///
/// The property.
/// The requested culture.
/// The requested segment.
/// A fallback strategy.
/// An optional default value.
/// The fallback value.
/// A value indicating whether a fallback value could be provided.
///
/// 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.
///
bool TryGetValue(IPublishedProperty property, string culture, string segment, Fallback fallback, object defaultValue, out object value);
///
/// Tries to get a fallback value for a property.
///
/// The type of the value.
/// The property.
/// The requested culture.
/// The requested segment.
/// A fallback strategy.
/// An optional default value.
/// The fallback value.
/// A value indicating whether a fallback value could be provided.
///
/// 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.
///
bool TryGetValue(IPublishedProperty property, string culture, string segment, Fallback fallback, T defaultValue, out T value);
///
/// Tries to get a fallback value for a published element property.
///
/// The published element.
/// The property alias.
/// The requested culture.
/// The requested segment.
/// A fallback strategy.
/// An optional default value.
/// The fallback value.
/// A value indicating whether a fallback value could be provided.
///
/// 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).
///
bool TryGetValue(IPublishedElement content, string alias, string culture, string segment, Fallback fallback, object defaultValue, out object value);
///
/// Tries to get 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.
/// A fallback strategy.
/// An optional default value.
/// The fallback value.
/// A value indicating whether a fallback value could be provided.
///
/// 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).
///
bool TryGetValue(IPublishedElement content, string alias, string culture, string segment, Fallback fallback, T defaultValue, out T value);
///
/// Tries to get a fallback value for a published content property.
///
/// The published element.
/// The property alias.
/// The requested culture.
/// The requested segment.
/// A fallback strategy.
/// An optional default value.
/// The fallback value.
/// A value indicating whether a fallback value could be provided.
///
/// 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.
///
bool TryGetValue(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, object defaultValue, out object value);
///
/// Tries to get 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.
/// A fallback strategy.
/// An optional default value.
/// The fallback value.
/// A value indicating whether a fallback value could be provided.
///
/// 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.
///
bool TryGetValue(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, T defaultValue, out T value);
}
}