File size: 4,786 Bytes
fab29d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;

namespace VersOne.Epub.Schema
{
    /// <summary>
    /// <para>
    /// Represents a unified collection of EPUB metadata items. A collection allows resources to be assembled into logical groups
    /// for a variety of potential uses: enabling content that has been split across multiple EPUB Content Documents to be reassembled
    /// back into a meaningful unit (e.g., an index split across multiple documents), identifying resources for specialized purposes
    /// (e.g., preview content), or collecting together resources that present additional information about this EPUB book.
    /// </para>
    /// <para>See <see href="https://www.w3.org/TR/epub-33/#sec-collection-elem" /> for more information.</para>
    /// </summary>
    public class EpubCollection
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="EpubCollection"/> class.
        /// </summary>
        /// <param name="role">The role of this collection.</param>
        /// <param name="metadata">The EPUB meta information included into this collection or <c>null</c> if the collection doesn't have any meta information.</param>
        /// <param name="nestedCollections">A list of sub-collections included in this collection.</param>
        /// <param name="links">A list of metadata links.</param>
        /// <param name="id">The unique ID of this collection or <c>null</c> if the collection doesn't have an ID.</param>
        /// <param name="textDirection">The text direction of this collection or <c>null</c> if the collection doesn't specify a text direction.</param>
        /// <param name="language">The language of this collection or <c>null</c> if the collection doesn't specify the language.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="role" /> parameter is <c>null</c>.</exception>
        public EpubCollection(string role, EpubMetadata? metadata = null, List<EpubCollection>? nestedCollections = null, List<EpubMetadataLink>? links = null,
            string? id = null, EpubTextDirection? textDirection = null, string? language = null)
        {
            Role = role ?? throw new ArgumentNullException(nameof(role));
            Metadata = metadata;
            NestedCollections = nestedCollections ?? new List<EpubCollection>();
            Links = links ?? new List<EpubMetadataLink>();
            Id = id;
            TextDirection = textDirection;
            Language = language;
        }

        /// <summary>
        /// <para>Gets the role of this collection.</para>
        /// <para>See <see href="https://www.w3.org/TR/epub-33/#attrdef-collection-role" /> for more information.</para>
        /// </summary>
        public string Role { get; }

        /// <summary>
        /// <para>Gets the EPUB meta information included into this collection or <c>null</c> if the collection doesn't have any meta information.</para>
        /// <para>See <see href="https://www.w3.org/TR/epub-33/#sec-metadata-elem" /> for more information.</para>
        /// </summary>
        public EpubMetadata? Metadata { get; }

        /// <summary>
        /// <para>Gets a list of sub-collections included in this collection.</para>
        /// <para>See <see href="https://www.w3.org/TR/epub-33/#elemdef-collection" /> for more information.</para>
        /// </summary>
        public List<EpubCollection> NestedCollections { get; }

        /// <summary>
        /// <para>Gets a list of metadata links. Links are used to associate resources with this collection, such as metadata records.</para>
        /// <para>See <see href="https://www.w3.org/TR/epub-33/#sec-link-elem" /> for more information.</para>
        /// </summary>
        public List<EpubMetadataLink> Links { get; }

        /// <summary>
        /// <para>Gets the unique ID of this collection or <c>null</c> if the collection doesn't have an ID.</para>
        /// <para>See <see href="https://www.w3.org/TR/epub-33/#attrdef-id" /> for more information.</para>
        /// </summary>
        public string? Id { get; }

        /// <summary>
        /// <para>Gets the text direction of this collection or <c>null</c> if the collection doesn't specify a text direction.</para>
        /// <para>See <see href="https://www.w3.org/TR/epub-33/#attrdef-dir" /> for more information.</para>
        /// </summary>
        public EpubTextDirection? TextDirection { get; }

        /// <summary>
        /// <para>Gets the language of this collection or <c>null</c> if the collection doesn't specify the language.</para>
        /// <para>See <see href="https://www.w3.org/TR/epub-33/#attrdef-xml-lang" /> for more information.</para>
        /// </summary>
        public string? Language { get; }
    }
}