1#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
8#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9pub struct SeriesId(String);
10
11impl SeriesId {
12 pub fn new(id: impl Into<String>) -> Self {
14 Self(id.into())
15 }
16
17 pub fn as_str(&self) -> &str {
19 &self.0
20 }
21}
22
23impl std::fmt::Display for SeriesId {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 f.write_str(&self.0)
26 }
27}
28
29impl From<&str> for SeriesId {
30 fn from(s: &str) -> Self {
31 Self(s.to_owned())
32 }
33}
34
35impl From<String> for SeriesId {
36 fn from(s: String) -> Self {
37 Self(s)
38 }
39}
40
41#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
49#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
50pub struct SeriesGroupId(String);
51
52impl SeriesGroupId {
53 pub fn new(id: impl Into<String>) -> Self {
55 Self(id.into())
56 }
57
58 pub fn as_str(&self) -> &str {
60 &self.0
61 }
62}
63
64impl std::fmt::Display for SeriesGroupId {
65 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66 f.write_str(&self.0)
67 }
68}
69
70impl From<&str> for SeriesGroupId {
71 fn from(s: &str) -> Self {
72 Self(s.to_owned())
73 }
74}
75
76impl From<String> for SeriesGroupId {
77 fn from(s: String) -> Self {
78 Self(s)
79 }
80}
81
82#[derive(
89 Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
90)]
91#[serde(transparent)]
92#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
93pub struct CategoryId(u32);
94
95impl CategoryId {
96 pub const ROOT: Self = Self(0);
98
99 pub fn new(id: u32) -> Self {
101 Self(id)
102 }
103
104 pub fn get(self) -> u32 {
106 self.0
107 }
108}
109
110impl std::fmt::Display for CategoryId {
111 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
112 write!(f, "{}", self.0)
113 }
114}
115
116impl From<u32> for CategoryId {
117 fn from(id: u32) -> Self {
118 Self(id)
119 }
120}
121
122#[derive(
128 Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
129)]
130#[serde(transparent)]
131#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
132pub struct ReleaseId(u32);
133
134impl ReleaseId {
135 pub fn new(id: u32) -> Self {
137 Self(id)
138 }
139
140 pub fn get(self) -> u32 {
142 self.0
143 }
144}
145
146impl std::fmt::Display for ReleaseId {
147 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
148 write!(f, "{}", self.0)
149 }
150}
151
152impl From<u32> for ReleaseId {
153 fn from(id: u32) -> Self {
154 Self(id)
155 }
156}
157
158#[derive(
166 Debug,
167 Clone,
168 Copy,
169 PartialEq,
170 Eq,
171 PartialOrd,
172 Ord,
173 Hash,
174 Default,
175 serde::Serialize,
176 serde::Deserialize,
177)]
178#[serde(transparent)]
179#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
180pub struct ReleaseElementId(u32);
181
182impl ReleaseElementId {
183 pub fn new(id: u32) -> Self {
185 Self(id)
186 }
187
188 pub fn get(self) -> u32 {
190 self.0
191 }
192}
193
194impl std::fmt::Display for ReleaseElementId {
195 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
196 write!(f, "{}", self.0)
197 }
198}
199
200impl From<u32> for ReleaseElementId {
201 fn from(id: u32) -> Self {
202 Self(id)
203 }
204}
205
206#[derive(
212 Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
213)]
214#[serde(transparent)]
215#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
216pub struct SourceId(u32);
217
218impl SourceId {
219 pub fn new(id: u32) -> Self {
221 Self(id)
222 }
223
224 pub fn get(self) -> u32 {
226 self.0
227 }
228}
229
230impl std::fmt::Display for SourceId {
231 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
232 write!(f, "{}", self.0)
233 }
234}
235
236impl From<u32> for SourceId {
237 fn from(id: u32) -> Self {
238 Self(id)
239 }
240}