using System;
using System.Collections.Generic;
namespace Umbraco.Cms.Core.Models.PublishedContent
{
///
/// Provides an abstract base class for IPublishedElement implementations that
/// wrap and extend another IPublishedElement.
///
public abstract class PublishedElementWrapped : IPublishedElement
{
private readonly IPublishedElement _content;
private readonly IPublishedValueFallback _publishedValueFallback;
///
/// Initializes a new instance of the class
/// with an IPublishedElement instance to wrap.
///
/// The content to wrap.
/// The published value fallback.
protected PublishedElementWrapped(IPublishedElement content, IPublishedValueFallback publishedValueFallback)
{
_content = content;
_publishedValueFallback = publishedValueFallback;
}
///
/// Gets the wrapped content.
///
/// The wrapped content, that was passed as an argument to the constructor.
public IPublishedElement Unwrap() => _content;
///
public IPublishedContentType ContentType => _content.ContentType;
///
public Guid Key => _content.Key;
///
public IEnumerable? Properties => _content.Properties;
///
public IPublishedProperty? GetProperty(string alias) => _content.GetProperty(alias);
}
}