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 the whole content of the file referenced by this navigation element.
///
public class EpubNavigationItem
{
///
/// Initializes a new instance of the class.
///
/// 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 referenced by 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 EpubNavigationItem(EpubNavigationItemType type, string title, EpubNavigationItemLink? link, EpubLocalTextContentFile? htmlContentFile, List? nestedItems)
{
Type = type;
Title = title ?? throw new ArgumentNullException(nameof(title));
Link = link;
HtmlContentFile = htmlContentFile;
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 referenced by the navigation element or null if the value of the property is null.
///
public EpubLocalTextContentFile? HtmlContentFile { 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}";
}
}
}