using System; using System.Collections.Generic; namespace VersOne.Epub { /// /// A single navigation element of the book (typically within the table of contents). /// Depending on the value of the property, it can act either as a header or as a navigation link. /// Unlike , this class contains the property /// which (if it's not null) holds only the reference to the file but doesn't have its content. /// public class EpubNavigationItemRef { /// /// Initializes a new instance of the class with specified type, title, and nested items. /// /// The value determining whether this navigation item acts as a header or as a navigation link. /// The title of the navigation element (which is either the text of the header or the title of the navigation link). /// A list of child navigation elements constituting the nested navigational hierarchy within the navigation element. /// The parameter is null. public EpubNavigationItemRef(EpubNavigationItemType type, string title, List? nestedItems = null) : this(type, title, null, null, nestedItems) { } /// /// Initializes a new instance of the class with specified type, title, link, HTML content file reference, and nested items. /// /// The value determining whether this navigation item acts as a header or as a navigation link. /// The title of the navigation element (which is either the text of the header or the title of the navigation link). /// The link of the navigation element if it acts as a navigation link or null if it acts as a header. /// /// The EPUB content file reference for the navigation element or null if the value of the parameter is null. /// /// A list of child navigation elements constituting the nested navigational hierarchy within the navigation element. /// The parameter is null. public EpubNavigationItemRef(EpubNavigationItemType type, string title, EpubNavigationItemLink? link, EpubLocalTextContentFileRef? htmlContentFileRef, List? nestedItems = null) { Type = type; Title = title ?? throw new ArgumentNullException(nameof(title)); Link = link; HtmlContentFileRef = htmlContentFileRef; NestedItems = nestedItems ?? new List(); } /// /// Gets the value determining whether this navigation item acts as a header or as a navigation link. /// public EpubNavigationItemType Type { get; } /// /// Gets the title of the navigation element (which is either the text of the header or the title of the navigation link). /// public string Title { get; } /// /// Gets the link of the navigation element if it acts as a navigation link or null if it acts as a header. /// public EpubNavigationItemLink? Link { get; } /// /// Gets the EPUB content file reference for the navigation element or null if the value of the property is null. /// public EpubLocalTextContentFileRef? HtmlContentFileRef { get; } /// /// Gets a list of child navigation elements constituting the nested navigational hierarchy within the navigation element. /// public List NestedItems { get; } /// /// Returns a string containing the values of the and properties /// and the number of the elements in the property for debugging purposes. /// /// /// A string containing the values of the and properties /// and the number of the elements in the property. /// public override string ToString() { return $"Type: {Type}, Title: {Title}, NestedItems.Count: {NestedItems.Count}"; } } }