1#[cfg(feature = "acmt")]
34pub mod acmt;
35#[cfg(feature = "admi")]
36pub mod admi;
37#[cfg(feature = "auth")]
38pub mod auth;
39#[cfg(feature = "caaa")]
40pub mod caaa;
41#[cfg(feature = "caad")]
42pub mod caad;
43#[cfg(feature = "caam")]
44pub mod caam;
45#[cfg(feature = "cafc")]
46pub mod cafc;
47#[cfg(feature = "cafm")]
48pub mod cafm;
49#[cfg(feature = "cafr")]
50pub mod cafr;
51#[cfg(feature = "cain")]
52pub mod cain;
53#[cfg(feature = "camt")]
54pub mod camt;
55#[cfg(feature = "canm")]
56pub mod canm;
57#[cfg(feature = "casp")]
58pub mod casp;
59#[cfg(feature = "casr")]
60pub mod casr;
61#[cfg(feature = "catm")]
62pub mod catm;
63#[cfg(feature = "catp")]
64pub mod catp;
65#[cfg(feature = "colr")]
66pub mod colr;
67#[cfg(feature = "fxtr")]
68pub mod fxtr;
69#[cfg(feature = "pacs")]
70pub mod pacs;
71#[cfg(feature = "pain")]
72pub mod pain;
73#[cfg(feature = "reda")]
74pub mod reda;
75#[cfg(feature = "remt")]
76pub mod remt;
77#[cfg(feature = "secl")]
78pub mod secl;
79#[cfg(feature = "seev")]
80pub mod seev;
81#[cfg(feature = "semt")]
82pub mod semt;
83#[cfg(feature = "sese")]
84pub mod sese;
85#[cfg(feature = "setr")]
86pub mod setr;
87#[cfg(test)]
88mod tests;
89#[cfg(feature = "tsin")]
90pub mod tsin;
91#[cfg(feature = "tsmt")]
92pub mod tsmt;
93#[cfg(feature = "tsrv")]
94pub mod tsrv;
95
96const DEFAULT_XLMNS_PREFIX: &str = "urn:iso:std:iso:20022:tech:xsd:";
98
99#[derive(
102 Debug,
103 Default,
104 Clone,
105 PartialEq,
106 ::serde::Serialize,
107 ::serde::Deserialize,
108 ::derive_builder::Builder,
109 ::validator::Validate,
110)]
111pub struct Dmkr {
112 #[serde(rename = "$text", skip_serializing_if = "Option::is_none")]
113 pub value: Option<String>,
114}
115
116#[derive(Debug, Default, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
118#[serde(rename = "Document")]
119pub enum DocumentType {
120 #[cfg(feature = "acmt")]
121 acmt(acmt::Document),
122 #[cfg(feature = "admi")]
123 admi(admi::Document),
124 #[cfg(feature = "auth")]
125 auth(auth::Document),
126 #[cfg(feature = "caaa")]
127 caaa(caaa::Document),
128 #[cfg(feature = "caad")]
129 caad(caad::Document),
130 #[cfg(feature = "caam")]
131 caam(caam::Document),
132 #[cfg(feature = "cafc")]
133 cafc(cafc::Document),
134 #[cfg(feature = "cafm")]
135 cafm(cafm::Document),
136 #[cfg(feature = "cafr")]
137 cafr(cafr::Document),
138 #[cfg(feature = "cain")]
139 cain(cain::Document),
140 #[cfg(feature = "camt")]
141 camt(camt::Document),
142 #[cfg(feature = "canm")]
143 canm(canm::Document),
144 #[cfg(feature = "casp")]
145 casp(casp::Document),
146 #[cfg(feature = "casr")]
147 casr(casr::Document),
148 #[cfg(feature = "catm")]
149 catm(catm::Document),
150 #[cfg(feature = "catp")]
151 catp(catp::Document),
152 #[cfg(feature = "colr")]
153 colr(colr::Document),
154 #[cfg(feature = "fxtr")]
155 fxtr(fxtr::Document),
156 #[cfg(feature = "pacs")]
157 pacs(pacs::Document),
158 #[cfg(feature = "pain")]
159 pain(pain::Document),
160 #[cfg(feature = "reda")]
161 reda(reda::Document),
162 #[cfg(feature = "remt")]
163 remt(remt::Document),
164 #[cfg(feature = "secl")]
165 secl(secl::Document),
166 #[cfg(feature = "seev")]
167 seev(seev::Document),
168 #[cfg(feature = "semt")]
169 semt(semt::Document),
170 #[cfg(feature = "sese")]
171 sese(sese::Document),
172 #[cfg(feature = "setr")]
173 setr(setr::Document),
174 #[cfg(feature = "tsin")]
175 tsin(tsin::Document),
176 #[cfg(feature = "tsmt")]
177 tsmt(tsmt::Document),
178 #[cfg(feature = "tsrv")]
179 tsrv(tsrv::Document),
180 Other(String),
181 #[default]
182 Unknown,
183}
184
185#[derive(
186 Debug,
187 Default,
188 Clone,
189 PartialEq,
190 ::serde::Serialize,
191 ::serde::Deserialize,
192 ::validator::Validate,
193)]
194#[serde(transparent)]
195pub struct Document {
196 #[serde(flatten, skip_serializing_if = "Option::is_none")]
197 pub value: Option<DocumentType>,
198}
199
200impl Document {
202 pub fn from_namespace(namespace: &str) -> Self {
203 let _schema = namespace.replace(DEFAULT_XLMNS_PREFIX, "");
204 #[cfg(feature = "acmt")]
205 if let Ok(doc) = acmt::Document::try_from(schema.as_str()) {
206 return Self {
207 value: Some(DocumentType::acmt(doc)),
208 };
209 }
210 #[cfg(feature = "admi")]
211 if let Ok(doc) = admi::Document::try_from(schema.as_str()) {
212 return Self {
213 value: Some(DocumentType::admi(doc)),
214 };
215 }
216 #[cfg(feature = "auth")]
217 if let Ok(doc) = auth::Document::try_from(schema.as_str()) {
218 return Self {
219 value: Some(DocumentType::auth(doc)),
220 };
221 }
222 #[cfg(feature = "caaa")]
223 if let Ok(doc) = caaa::Document::try_from(schema.as_str()) {
224 return Self {
225 value: Some(DocumentType::caaa(doc)),
226 };
227 }
228 #[cfg(feature = "caad")]
229 if let Ok(doc) = caad::Document::try_from(schema.as_str()) {
230 return Self {
231 value: Some(DocumentType::caad(doc)),
232 };
233 }
234 #[cfg(feature = "caam")]
235 if let Ok(doc) = caam::Document::try_from(schema.as_str()) {
236 return Self {
237 value: Some(DocumentType::caam(doc)),
238 };
239 }
240 #[cfg(feature = "cafc")]
241 if let Ok(doc) = cafc::Document::try_from(schema.as_str()) {
242 return Self {
243 value: Some(DocumentType::cafc(doc)),
244 };
245 }
246 #[cfg(feature = "cafm")]
247 if let Ok(doc) = cafm::Document::try_from(schema.as_str()) {
248 return Self {
249 value: Some(DocumentType::cafm(doc)),
250 };
251 }
252 #[cfg(feature = "cafr")]
253 if let Ok(doc) = cafr::Document::try_from(schema.as_str()) {
254 return Self {
255 value: Some(DocumentType::cafr(doc)),
256 };
257 }
258 #[cfg(feature = "cain")]
259 if let Ok(doc) = cain::Document::try_from(schema.as_str()) {
260 return Self {
261 value: Some(DocumentType::cain(doc)),
262 };
263 }
264 #[cfg(feature = "camt")]
265 if let Ok(doc) = camt::Document::try_from(schema.as_str()) {
266 return Self {
267 value: Some(DocumentType::camt(doc)),
268 };
269 }
270 #[cfg(feature = "canm")]
271 if let Ok(doc) = canm::Document::try_from(schema.as_str()) {
272 return Self {
273 value: Some(DocumentType::canm(doc)),
274 };
275 }
276 #[cfg(feature = "casp")]
277 if let Ok(doc) = casp::Document::try_from(schema.as_str()) {
278 return Self {
279 value: Some(DocumentType::casp(doc)),
280 };
281 }
282 #[cfg(feature = "casr")]
283 if let Ok(doc) = casr::Document::try_from(schema.as_str()) {
284 return Self {
285 value: Some(DocumentType::casr(doc)),
286 };
287 }
288 #[cfg(feature = "catm")]
289 if let Ok(doc) = catm::Document::try_from(schema.as_str()) {
290 return Self {
291 value: Some(DocumentType::catm(doc)),
292 };
293 }
294 #[cfg(feature = "catp")]
295 if let Ok(doc) = catp::Document::try_from(schema.as_str()) {
296 return Self {
297 value: Some(DocumentType::catp(doc)),
298 };
299 }
300 #[cfg(feature = "colr")]
301 if let Ok(doc) = colr::Document::try_from(schema.as_str()) {
302 return Self {
303 value: Some(DocumentType::colr(doc)),
304 };
305 }
306 #[cfg(feature = "fxtr")]
307 if let Ok(doc) = fxtr::Document::try_from(schema.as_str()) {
308 return Self {
309 value: Some(DocumentType::fxtr(doc)),
310 };
311 }
312 #[cfg(feature = "pacs")]
313 if let Ok(doc) = pacs::Document::try_from(schema.as_str()) {
314 return Self {
315 value: Some(DocumentType::pacs(doc)),
316 };
317 }
318 #[cfg(feature = "pain")]
319 if let Ok(doc) = pain::Document::try_from(schema.as_str()) {
320 return Self {
321 value: Some(DocumentType::pain(doc)),
322 };
323 }
324 #[cfg(feature = "reda")]
325 if let Ok(doc) = reda::Document::try_from(schema.as_str()) {
326 return Self {
327 value: Some(DocumentType::reda(doc)),
328 };
329 }
330 #[cfg(feature = "remt")]
331 if let Ok(doc) = remt::Document::try_from(schema.as_str()) {
332 return Self {
333 value: Some(DocumentType::remt(doc)),
334 };
335 }
336 #[cfg(feature = "secl")]
337 if let Ok(doc) = secl::Document::try_from(schema.as_str()) {
338 return Self {
339 value: Some(DocumentType::secl(doc)),
340 };
341 }
342 #[cfg(feature = "seev")]
343 if let Ok(doc) = seev::Document::try_from(schema.as_str()) {
344 return Self {
345 value: Some(DocumentType::seev(doc)),
346 };
347 }
348 #[cfg(feature = "semt")]
349 if let Ok(doc) = semt::Document::try_from(schema.as_str()) {
350 return Self {
351 value: Some(DocumentType::semt(doc)),
352 };
353 }
354 #[cfg(feature = "sese")]
355 if let Ok(doc) = sese::Document::try_from(schema.as_str()) {
356 return Self {
357 value: Some(DocumentType::sese(doc)),
358 };
359 }
360 #[cfg(feature = "setr")]
361 if let Ok(doc) = setr::Document::try_from(schema.as_str()) {
362 return Self {
363 value: Some(DocumentType::setr(doc)),
364 };
365 }
366 #[cfg(feature = "tsin")]
367 if let Ok(doc) = tsin::Document::try_from(schema.as_str()) {
368 return Self {
369 value: Some(DocumentType::tsin(doc)),
370 };
371 }
372 #[cfg(feature = "tsmt")]
373 if let Ok(doc) = tsmt::Document::try_from(schema.as_str()) {
374 return Self {
375 value: Some(DocumentType::tsmt(doc)),
376 };
377 }
378 #[cfg(feature = "tsrv")]
379 if let Ok(doc) = tsrv::Document::try_from(schema.as_str()) {
380 return Self {
381 value: Some(DocumentType::tsrv(doc)),
382 };
383 }
384
385 Self { value: None }
386 }
387}