// Copyright (c) Umbraco. // See LICENSE for more details. using System.Runtime.Serialization; using Umbraco.Cms.Core.Models.PublishedContent; namespace Umbraco.Cms.Core.Models.Blocks; /// /// Represents a layout item for the Block List editor. /// /// [DataContract(Name = "block", Namespace = "")] public class RichTextBlockItem : IBlockReference { /// /// Initializes a new instance of the class. /// /// The content UDI. /// The content. /// The settings UDI. /// The settings. /// /// contentUdi /// or /// content /// public RichTextBlockItem(Udi contentUdi, IPublishedElement content, Udi settingsUdi, IPublishedElement settings) { ContentUdi = contentUdi ?? throw new ArgumentNullException(nameof(contentUdi)); Content = content ?? throw new ArgumentNullException(nameof(content)); SettingsUdi = settingsUdi; Settings = settings; } /// /// Gets the content. /// /// /// The content. /// [DataMember(Name = "content")] public IPublishedElement Content { get; } /// /// Gets the settings UDI. /// /// /// The settings UDI. /// [DataMember(Name = "settingsUdi")] public Udi SettingsUdi { get; } /// /// Gets the content UDI. /// /// /// The content UDI. /// [DataMember(Name = "contentUdi")] public Udi ContentUdi { get; } /// /// Gets the settings. /// /// /// The settings. /// [DataMember(Name = "settings")] public IPublishedElement Settings { get; } } /// /// Represents a layout item with a generic content type for the Block List editor. /// /// The type of the content. /// public class RichTextBlockItem : RichTextBlockItem where T : IPublishedElement { /// /// Initializes a new instance of the class. /// /// The content UDI. /// The content. /// The settings UDI. /// The settings. public RichTextBlockItem(Udi contentUdi, T content, Udi settingsUdi, IPublishedElement settings) : base(contentUdi, content, settingsUdi, settings) => Content = content; /// /// Gets the content. /// /// /// The content. /// public new T Content { get; } } /// /// Represents a layout item with generic content and settings types for the Block List editor. /// /// The type of the content. /// The type of the settings. /// public class RichTextBlockItem : RichTextBlockItem where TContent : IPublishedElement where TSettings : IPublishedElement { /// /// Initializes a new instance of the class. /// /// The content udi. /// The content. /// The settings udi. /// The settings. public RichTextBlockItem(Udi contentUdi, TContent content, Udi settingsUdi, TSettings settings) : base(contentUdi, content, settingsUdi, settings) => Settings = settings; /// /// Gets the settings. /// /// /// The settings. /// public new TSettings Settings { get; } }