File size: 2,753 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
using System;

namespace VersOne.Epub.Schema
{
    /// <summary>
    /// <para>Reference element of the <see cref="EpubGuide" />.</para>
    /// <para>See <see href="https://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6" /> for more information.</para>
    /// </summary>
    public class EpubGuideReference
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="EpubGuideReference" /> class.
        /// </summary>
        /// <param name="type">The type of the publication component referenced by the <see cref="Href" /> property.</param>
        /// <param name="title">The title of the reference or <c>null</c> if the reference doesn't have a title.</param>
        /// <param name="href">The link to a content document included in the manifest, with an optional fragment identifier.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="type" /> parameter is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="href" /> parameter is <c>null</c>.</exception>
        public EpubGuideReference(string type, string? title, string href)
        {
            Type = type ?? throw new ArgumentNullException(nameof(type));
            Title = title;
            Href = href ?? throw new ArgumentNullException(nameof(href));
        }

        /// <summary>
        /// <para>Gets the type of the publication component referenced by the <see cref="Href" /> property.</para>
        /// <para>See <see href="https://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6" /> for more information.</para>
        /// </summary>
        public string Type { get; }

        /// <summary>
        /// <para>Gets the title of the reference or <c>null</c> if the reference doesn't have a title.</para>
        /// <para>See <see href="https://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6" /> for more information.</para>
        /// </summary>
        public string? Title { get; }

        /// <summary>
        /// <para>Gets the link to a content document included in the manifest, with an optional fragment identifier.</para>
        /// <para>See <see href="https://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6" /> for more information.</para>
        /// </summary>
        public string Href { get; }

        /// <summary>
        /// Returns a string containing the values of the <see cref="Type" /> and <see cref="Href" /> properties for debugging purposes.
        /// </summary>
        /// <returns>A string containing the values of the <see cref="Type" /> and <see cref="Href" /> properties.</returns>
        public override string ToString()
        {
            return $"Type: {Type}, Href: {Href}";
        }
    }
}