1#[derive(Clone, Copy, Debug)]
2pub enum Language {
3 Chinese,
5 English,
7 Japanese,
9 Korean,
11 Russian,
13 French,
15 Spanish,
17 Vietnamese,
19 ChineseXinanese,
21 ChineseCantonese,
23 ChineseHenanese,
25 ChineseUyghur,
27 ChineseTibetan,
29 Arabic,
31 German,
33 Italian,
35}
36
37impl Into<&str> for Language {
38 fn into(self) -> &'static str {
39 match self {
40 Self::Chinese => "cn",
41 Self::English => "en",
42 Self::Japanese => "ja",
43 Self::Korean => "ko",
44 Self::Russian => "ru",
45 Self::French => "fr",
46 Self::Spanish => "es",
47 Self::Vietnamese => "vi",
48 Self::Arabic => "ar",
49 Self::ChineseXinanese => "cn_xinanese",
50 Self::ChineseCantonese => "cn_cantonese",
51 Self::ChineseHenanese => "cn_henanese",
52 Self::ChineseUyghur => "cn_uyghur",
53 Self::ChineseTibetan => "cn_tibetan",
54 Self::German => "de",
55 Self::Italian => "it",
56 }
57 }
58}
59
60impl From<&str> for Language {
61 fn from(value: &str) -> Self {
62 match value {
63 "cn" => Self::Chinese,
64 "en" => Self::English,
65 "ja" => Self::Japanese,
66 "ko" => Self::Korean,
67 "ru" => Self::Russian,
68 "fr" => Self::French,
69 "es" => Self::Spanish,
70 "vi" => Self::Vietnamese,
71 "ar" => Self::Arabic,
72 "cn_xinanese" => Self::ChineseXinanese,
73 "cn_cantonese" => Self::ChineseCantonese,
74 "cn_henanese" => Self::ChineseHenanese,
75 "cn_uyghur" => Self::ChineseUyghur,
76 "cn_tibetan" => Self::ChineseTibetan,
77 "de" => Self::German,
78 "it" => Self::Italian,
79 _ => panic!("Unsupported input value: {}", value),
80 }
81 }
82}
83
84impl serde::Serialize for Language {
85 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
86 where
87 S: serde::Serializer,
88 {
89 serializer.serialize_str(Into::<&'static str>::into(self.clone()))
90 }
91}
92
93#[derive(Clone, Copy, Debug)]
94pub enum ProfessionalDomain {
95 Court,
97 Edu,
99 Finance,
101 Medical,
103 Tech,
105 Culture,
107 Isp,
109 Sport,
111 Gov,
113 Game,
115 Ecom,
117 Mil,
119 Com,
121 Life,
123 Ent,
125 Car,
127}
128
129impl Into<&str> for ProfessionalDomain {
130 fn into(self) -> &'static str {
131 match self {
132 Self::Court => "court",
133 Self::Edu => "edu",
134 Self::Finance => "finance",
135 Self::Medical => "medical",
136 Self::Tech => "tech",
137 Self::Culture => "culture",
138 Self::Isp => "isp",
139 Self::Sport => "sport",
140 Self::Gov => "gov",
141 Self::Game => "game",
142 Self::Ecom => "ecom",
143 Self::Mil => "mil",
144 Self::Com => "com",
145 Self::Life => "life",
146 Self::Ent => "ent",
147 Self::Car => "car",
148 }
149 }
150}
151
152impl From<&str> for ProfessionalDomain {
153 fn from(value: &str) -> Self {
154 match value {
155 "court" => Self::Court,
156 "edu" => Self::Edu,
157 "finance" => Self::Finance,
158 "medical" => Self::Medical,
159 "tech" => Self::Tech,
160 "culture" => Self::Culture,
161 "isp" => Self::Isp,
162 "sport" => Self::Sport,
163 "gov" => Self::Gov,
164 "game" => Self::Game,
165 "ecom" => Self::Ecom,
166 "mil" => Self::Mil,
167 "com" => Self::Com,
168 "life" => Self::Life,
169 "ent" => Self::Ent,
170 "car" => Self::Car,
171 _ => panic!("Unsupported value: {}", value),
172 }
173 }
174}
175
176impl serde::Serialize for ProfessionalDomain {
177 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
178 where
179 S: serde::Serializer,
180 {
181 serializer.serialize_str(Into::<&'static str>::into(self.clone()))
182 }
183}
184
185#[derive(Clone, Copy, Debug)]
186pub enum AudioMode {
187 FileStream,
189 ExternalUrl,
191}
192
193impl Into<&str> for AudioMode {
194 fn into(self) -> &'static str {
195 match self {
196 Self::FileStream => "fileStream",
197 Self::ExternalUrl => "urlLink",
198 }
199 }
200}
201
202impl From<&str> for AudioMode {
203 fn from(value: &str) -> Self {
204 match value {
205 "fileStream" => Self::FileStream,
206 "urlLink" => Self::ExternalUrl,
207 _ => panic!("Unsupported value: {value}"),
208 }
209 }
210}
211impl serde::Serialize for AudioMode {
212 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
213 where
214 S: serde::Serializer,
215 {
216 serializer.serialize_str(Into::<&'static str>::into(self.clone()))
217 }
218}
219
220#[derive(Clone, Copy, Debug)]
221pub enum WavType {
222 StandardWav,
224 NonstandardWav,
226}
227
228impl Into<u8> for WavType {
229 fn into(self) -> u8 {
230 match self {
231 Self::StandardWav => 1,
232 Self::NonstandardWav => 0,
233 }
234 }
235}
236
237impl From<u8> for WavType {
238 fn from(value: u8) -> Self {
239 match value {
240 1 => Self::StandardWav,
241 0 => Self::NonstandardWav,
242 _ => panic!("Unsupported value: {value}"),
243 }
244 }
245}
246impl serde::Serialize for WavType {
247 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
248 where
249 S: serde::Serializer,
250 {
251 serializer.serialize_u8(Into::<u8>::into(self.clone()))
252 }
253}
254
255#[derive(Clone, Copy, Debug)]
256pub enum LanguageMixType {
257 MixedChineseEnglish,
259 MainlyChinese,
261 ChineseOnly,
263}
264
265impl Into<u8> for LanguageMixType {
266 fn into(self) -> u8 {
267 match self {
268 Self::MixedChineseEnglish => 1,
269 Self::MainlyChinese => 2,
270 Self::ChineseOnly => 4,
271 }
272 }
273}
274
275impl From<u8> for LanguageMixType {
276 fn from(value: u8) -> Self {
277 match value {
278 1 => Self::MixedChineseEnglish,
279 2 => Self::MainlyChinese,
280 4 => Self::ChineseOnly,
281 _ => panic!("Unsupported value: {value}"),
282 }
283 }
284}
285impl serde::Serialize for LanguageMixType {
286 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
287 where
288 S: serde::Serializer,
289 {
290 serializer.serialize_u8(Into::<u8>::into(self.clone()))
291 }
292}