-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathOLSubjectData.cs
More file actions
43 lines (40 loc) · 1.25 KB
/
OLSubjectData.cs
File metadata and controls
43 lines (40 loc) · 1.25 KB
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
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using OpenLibraryNET.Utility;
using CodeGeneration_Attributes;
namespace OpenLibraryNET.Data
{
/// <summary>
/// Holds data about a subject.
/// </summary>
[CollectionValueEquality]
public partial record OLSubjectData : OLContainer
{
/// <summary>
/// The name of this subject.
/// </summary>
[JsonProperty("name")]
public string Name { get; init; } = "";
/// <summary>
/// The amount of works associated with this subject.
/// </summary>
[JsonProperty("work_count")]
public int WorkCount { get; init; } = -1;
/// <summary>
/// The type of this subject.
/// </summary>
[JsonProperty("subject_type")]
public string SubjectType { get; init; } = "subject";
/// <summary>
/// The works associated with this subject.
/// </summary>
[JsonIgnore]
public IReadOnlyList<OLWorkData> Works
{
get => new ReadOnlyCollection<OLWorkData>(_works);
init => _works = value.ToArray();
}
[JsonProperty("works")]
private OLWorkData[] _works { get; init; } = Array.Empty<OLWorkData>();
}
}