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(
48 Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
49)]
50#[serde(transparent)]
51#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
52pub struct CategoryId(u32);
53
54impl CategoryId {
55 pub const ROOT: Self = Self(0);
57
58 pub fn new(id: u32) -> Self {
60 Self(id)
61 }
62
63 pub fn get(self) -> u32 {
65 self.0
66 }
67}
68
69impl std::fmt::Display for CategoryId {
70 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
71 write!(f, "{}", self.0)
72 }
73}
74
75impl From<u32> for CategoryId {
76 fn from(id: u32) -> Self {
77 Self(id)
78 }
79}
80
81#[derive(
87 Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
88)]
89#[serde(transparent)]
90#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
91pub struct ReleaseId(u32);
92
93impl ReleaseId {
94 pub fn new(id: u32) -> Self {
96 Self(id)
97 }
98
99 pub fn get(self) -> u32 {
101 self.0
102 }
103}
104
105impl std::fmt::Display for ReleaseId {
106 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
107 write!(f, "{}", self.0)
108 }
109}
110
111impl From<u32> for ReleaseId {
112 fn from(id: u32) -> Self {
113 Self(id)
114 }
115}
116
117#[derive(
125 Debug,
126 Clone,
127 Copy,
128 PartialEq,
129 Eq,
130 PartialOrd,
131 Ord,
132 Hash,
133 Default,
134 serde::Serialize,
135 serde::Deserialize,
136)]
137#[serde(transparent)]
138#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
139pub struct ReleaseElementId(u32);
140
141impl ReleaseElementId {
142 pub fn new(id: u32) -> Self {
144 Self(id)
145 }
146
147 pub fn get(self) -> u32 {
149 self.0
150 }
151}
152
153impl std::fmt::Display for ReleaseElementId {
154 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
155 write!(f, "{}", self.0)
156 }
157}
158
159impl From<u32> for ReleaseElementId {
160 fn from(id: u32) -> Self {
161 Self(id)
162 }
163}
164
165#[derive(
171 Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
172)]
173#[serde(transparent)]
174#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
175pub struct SourceId(u32);
176
177impl SourceId {
178 pub fn new(id: u32) -> Self {
180 Self(id)
181 }
182
183 pub fn get(self) -> u32 {
185 self.0
186 }
187}
188
189impl std::fmt::Display for SourceId {
190 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
191 write!(f, "{}", self.0)
192 }
193}
194
195impl From<u32> for SourceId {
196 fn from(id: u32) -> Self {
197 Self(id)
198 }
199}