File size: 5,213 Bytes
3374e90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
//! Plain Rust data structs that mirror FlatBuffer types.
//!
//! These are easy to construct from any source (WIT bindgen types, JSON, etc.)
//! and are consumed by the builder functions in `builders.rs`.
//!
//! Note: FlatBuffer primitive fields are non-optional (they default to 0/false).
//! Our Data structs follow the same convention — primitive fields are plain
//! values, not Option-wrapped. Use 0/empty-string/false for "missing" values.

/// Data struct for `Image`.
#[derive(Debug, Clone, Default)]
pub struct ImageData {
    pub url: String,
    pub layout: String,
    pub width: u32,
    pub height: u32,
    pub blurhash: Option<String>,
}

/// Data struct for `ImageSet`.
#[derive(Debug, Clone, Default)]
pub struct ImageSetData {
    pub low: Option<ImageData>,
    pub medium: Option<ImageData>,
    pub high: Option<ImageData>,
    pub backdrop: Option<ImageData>,
    pub logo: Option<ImageData>,
}

/// Data struct for `LinkedId`.
#[derive(Debug, Clone, Default)]
pub struct LinkedIdData {
    pub source: String,
    pub id: String,
}

/// Data struct for `Attr`.
#[derive(Debug, Clone, Default)]
pub struct AttrData {
    pub key: String,
    pub value: String,
}

/// Data struct for `MediaCard`.
#[derive(Debug, Clone, Default)]
pub struct MediaCardData {
    pub id: String,
    pub title: String,
    pub kind: u8,
    pub images: Option<ImageSetData>,
    pub original_title: Option<String>,
    pub tagline: Option<String>,
    pub year: Option<String>,
    pub score: u32,
    pub genres: Vec<String>,
    pub status: u8,
    pub content_rating: Option<String>,
    pub url: Option<String>,
    pub ids: Vec<LinkedIdData>,
    pub extra: Vec<AttrData>,
}

/// Data struct for `CategoryLink`.
#[derive(Debug, Clone, Default)]
pub struct CategoryLinkData {
    pub id: String,
    pub title: String,
    pub subtitle: Option<String>,
    pub image: Option<ImageData>,
}

/// Data struct for `HomeSection`.
#[derive(Debug, Clone, Default)]
pub struct HomeSectionData {
    pub id: String,
    pub title: String,
    pub subtitle: Option<String>,
    pub items: Vec<MediaCardData>,
    pub next_page: Option<String>,
    pub layout: Option<String>,
    pub show_rank: bool,
    pub categories: Vec<CategoryLinkData>,
    pub extra: Vec<AttrData>,
}

/// Data struct for `Episode`.
#[derive(Debug, Clone, Default)]
pub struct EpisodeData {
    pub id: String,
    pub title: String,
    pub number: f64,
    pub season: f64,
    pub images: Option<ImageSetData>,
    pub description: Option<String>,
    pub released: Option<String>,
    pub score: u32,
    pub url: Option<String>,
    pub tags: Vec<String>,
    pub extra: Vec<AttrData>,
}

/// Data struct for `Season`.
#[derive(Debug, Clone, Default)]
pub struct SeasonData {
    pub id: String,
    pub title: String,
    pub number: f64,
    pub year: u32,
    pub episodes: Vec<EpisodeData>,
}

/// Data struct for `Person`.
#[derive(Debug, Clone, Default)]
pub struct PersonData {
    pub id: String,
    pub name: String,
    pub image: Option<ImageSetData>,
    pub role: Option<String>,
    pub url: Option<String>,
}

/// Data struct for `MediaInfo`.
#[derive(Debug, Clone, Default)]
pub struct MediaInfoData {
    pub id: String,
    pub title: String,
    pub kind: u8,
    pub images: Option<ImageSetData>,
    pub original_title: Option<String>,
    pub description: Option<String>,
    pub score: u32,
    pub scored_by: u64,
    pub year: Option<String>,
    pub release_date: Option<String>,
    pub genres: Vec<String>,
    pub tags: Vec<String>,
    pub status: u8,
    pub content_rating: Option<String>,
    pub seasons: Vec<SeasonData>,
    pub cast: Vec<PersonData>,
    pub crew: Vec<PersonData>,
    pub runtime_minutes: u32,
    pub trailer_url: Option<String>,
    pub ids: Vec<LinkedIdData>,
    pub studio: Option<String>,
    pub country: Option<String>,
    pub language: Option<String>,
    pub url: Option<String>,
    pub extra: Vec<AttrData>,
}

/// Data struct for `VideoResolution`.
#[derive(Debug, Clone, Default)]
pub struct VideoResolutionData {
    pub width: u32,
    pub height: u32,
    pub hdr: bool,
    pub label: Option<String>,
}

/// Data struct for `VideoTrack`.
#[derive(Debug, Clone, Default)]
pub struct VideoTrackData {
    pub resolution: Option<VideoResolutionData>,
    pub url: String,
    pub mime_type: Option<String>,
    pub bitrate: u64,
    pub codecs: Option<String>,
}

/// Data struct for `SubtitleTrack`.
#[derive(Debug, Clone, Default)]
pub struct SubtitleTrackData {
    pub label: Option<String>,
    pub url: String,
    pub language: Option<String>,
    pub format: Option<String>,
}

/// Data struct for `Server`.
#[derive(Debug, Clone, Default)]
pub struct ServerData {
    pub id: String,
    pub label: Option<String>,
    pub url: Option<String>,
    pub priority: u8,
    pub extra: Vec<AttrData>,
}

/// Data struct for `StreamSource`.
#[derive(Debug, Clone, Default)]
pub struct StreamSourceData {
    pub id: String,
    pub label: Option<String>,
    pub format: u8,
    pub manifest_url: Option<String>,
    pub videos: Vec<VideoTrackData>,
    pub subtitles: Vec<SubtitleTrackData>,
    pub headers: Vec<AttrData>,
    pub extra: Vec<AttrData>,
}