1use crate::parse_result::{ErrorCollector, ParserConfig};
20use crate::validation::{Validate, helpers};
21use serde::{Deserialize, Serialize};
22
23#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
25pub struct AccountIdentification4Choice {
26 #[serde(rename = "IBAN", skip_serializing_if = "Option::is_none")]
27 pub iban: Option<String>,
28 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
29 pub othr: Option<GenericAccountIdentification1>,
30}
31
32impl Validate for AccountIdentification4Choice {
33 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
34 if let Some(ref val) = self.iban {
35 helpers::validate_pattern(
36 val,
37 "IBAN",
38 "[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}",
39 &helpers::child_path(path, "IBAN"),
40 config,
41 collector,
42 );
43 }
44 if let Some(ref val) = self.othr
45 && config.validate_optional_fields
46 {
47 val.validate(&helpers::child_path(path, "Othr"), config, collector);
48 }
49 }
50}
51
52#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
54pub struct AccountSchemeName1Choice {
55 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
56 pub cd: Option<String>,
57 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
58 pub prtry: Option<String>,
59}
60
61impl Validate for AccountSchemeName1Choice {
62 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
63 if let Some(ref val) = self.cd {
64 helpers::validate_length(
65 val,
66 "Cd",
67 Some(1),
68 Some(4),
69 &helpers::child_path(path, "Cd"),
70 config,
71 collector,
72 );
73 }
74 if let Some(ref val) = self.prtry {
75 helpers::validate_length(
76 val,
77 "Prtry",
78 Some(1),
79 Some(35),
80 &helpers::child_path(path, "Prtry"),
81 config,
82 collector,
83 );
84 }
85 }
86}
87
88#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
90pub struct ActiveOrHistoricCurrencyAndAmount {
91 #[serde(rename = "@Ccy")]
92 pub ccy: String,
93 #[serde(rename = "$value")]
94 pub value: f64,
95}
96
97impl Validate for ActiveOrHistoricCurrencyAndAmount {
98 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
99}
100
101#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
103pub enum AddressType2Code {
104 #[default]
105 #[serde(rename = "ADDR")]
106 CodeADDR,
107 #[serde(rename = "PBOX")]
108 CodePBOX,
109 #[serde(rename = "HOME")]
110 CodeHOME,
111 #[serde(rename = "BIZZ")]
112 CodeBIZZ,
113 #[serde(rename = "MLTO")]
114 CodeMLTO,
115 #[serde(rename = "DLVY")]
116 CodeDLVY,
117}
118
119impl Validate for AddressType2Code {
120 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
121 }
123}
124
125#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
127pub struct AddressType3Choice {
128 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
129 pub cd: Option<AddressType2Code>,
130 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
131 pub prtry: Option<GenericIdentification30>,
132}
133
134impl Validate for AddressType3Choice {
135 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
136 if let Some(ref val) = self.cd
137 && config.validate_optional_fields
138 {
139 val.validate(&helpers::child_path(path, "Cd"), config, collector);
140 }
141 if let Some(ref val) = self.prtry
142 && config.validate_optional_fields
143 {
144 val.validate(&helpers::child_path(path, "Prtry"), config, collector);
145 }
146 }
147}
148
149#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
151pub struct AmountType4Choice {
152 #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
153 pub instd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
154 #[serde(rename = "EqvtAmt", skip_serializing_if = "Option::is_none")]
155 pub eqvt_amt: Option<EquivalentAmount2>,
156}
157
158impl Validate for AmountType4Choice {
159 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
160 if let Some(ref val) = self.instd_amt
161 && config.validate_optional_fields
162 {
163 val.validate(&helpers::child_path(path, "InstdAmt"), config, collector);
164 }
165 if let Some(ref val) = self.eqvt_amt
166 && config.validate_optional_fields
167 {
168 val.validate(&helpers::child_path(path, "EqvtAmt"), config, collector);
169 }
170 }
171}
172
173#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
175pub struct Authorisation1Choice {
176 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
177 pub cd: Option<Authorisation1Code>,
178 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
179 pub prtry: Option<String>,
180}
181
182impl Validate for Authorisation1Choice {
183 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
184 if let Some(ref val) = self.cd
185 && config.validate_optional_fields
186 {
187 val.validate(&helpers::child_path(path, "Cd"), config, collector);
188 }
189 if let Some(ref val) = self.prtry {
190 helpers::validate_length(
191 val,
192 "Prtry",
193 Some(1),
194 Some(128),
195 &helpers::child_path(path, "Prtry"),
196 config,
197 collector,
198 );
199 }
200 }
201}
202
203#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
205pub enum Authorisation1Code {
206 #[default]
207 #[serde(rename = "AUTH")]
208 CodeAUTH,
209 #[serde(rename = "FDET")]
210 CodeFDET,
211 #[serde(rename = "FSUM")]
212 CodeFSUM,
213 #[serde(rename = "ILEV")]
214 CodeILEV,
215}
216
217impl Validate for Authorisation1Code {
218 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
219 }
221}
222
223#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
227pub struct BranchAndFinancialInstitutionIdentification6 {
228 #[serde(rename = "FinInstnId")]
229 pub fin_instn_id: FinancialInstitutionIdentification18,
230 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
231 pub brnch_id: Option<BranchData3>,
232}
233
234impl Validate for BranchAndFinancialInstitutionIdentification6 {
235 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
236 self.fin_instn_id
237 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
238 if let Some(ref val) = self.brnch_id
239 && config.validate_optional_fields
240 {
241 val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
242 }
243 }
244}
245
246#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
248pub struct BranchAndFinancialInstitutionIdentification61 {
249 #[serde(rename = "FinInstnId")]
250 pub fin_instn_id: FinancialInstitutionIdentification181,
251}
252
253impl Validate for BranchAndFinancialInstitutionIdentification61 {
254 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
255 self.fin_instn_id
256 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
257 }
258}
259
260#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
262pub struct BranchAndFinancialInstitutionIdentification62 {
263 #[serde(rename = "FinInstnId")]
264 pub fin_instn_id: FinancialInstitutionIdentification182,
265}
266
267impl Validate for BranchAndFinancialInstitutionIdentification62 {
268 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
269 self.fin_instn_id
270 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
271 }
272}
273
274#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
278pub struct BranchAndFinancialInstitutionIdentification63 {
279 #[serde(rename = "FinInstnId")]
280 pub fin_instn_id: FinancialInstitutionIdentification182,
281 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
282 pub brnch_id: Option<BranchData31>,
283}
284
285impl Validate for BranchAndFinancialInstitutionIdentification63 {
286 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
287 self.fin_instn_id
288 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
289 if let Some(ref val) = self.brnch_id
290 && config.validate_optional_fields
291 {
292 val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
293 }
294 }
295}
296
297#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
299pub struct BranchData3 {
300 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
301 pub id: Option<String>,
302 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
303 pub lei: Option<String>,
304 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
305 pub nm: Option<String>,
306 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
307 pub pstl_adr: Option<PostalAddress24>,
308}
309
310impl Validate for BranchData3 {
311 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
312 if let Some(ref val) = self.id {
313 helpers::validate_length(
314 val,
315 "Id",
316 Some(1),
317 Some(35),
318 &helpers::child_path(path, "Id"),
319 config,
320 collector,
321 );
322 }
323 if let Some(ref val) = self.lei {
324 helpers::validate_pattern(
325 val,
326 "LEI",
327 "[A-Z0-9]{18,18}[0-9]{2,2}",
328 &helpers::child_path(path, "LEI"),
329 config,
330 collector,
331 );
332 }
333 if let Some(ref val) = self.nm {
334 helpers::validate_length(
335 val,
336 "Nm",
337 Some(1),
338 Some(140),
339 &helpers::child_path(path, "Nm"),
340 config,
341 collector,
342 );
343 }
344 if let Some(ref val) = self.pstl_adr
345 && config.validate_optional_fields
346 {
347 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
348 }
349 }
350}
351
352#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
354pub struct BranchData31 {
355 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
356 pub id: Option<String>,
357}
358
359impl Validate for BranchData31 {
360 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
361 if let Some(ref val) = self.id {
362 helpers::validate_length(
363 val,
364 "Id",
365 Some(1),
366 Some(35),
367 &helpers::child_path(path, "Id"),
368 config,
369 collector,
370 );
371 }
372 }
373}
374
375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
377pub struct CashAccount38 {
378 #[serde(rename = "Id")]
379 pub id: AccountIdentification4Choice,
380 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
381 pub tp: Option<CashAccountType2Choice>,
382 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
383 pub ccy: Option<String>,
384 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
385 pub nm: Option<String>,
386 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
387 pub prxy: Option<ProxyAccountIdentification1>,
388}
389
390impl Validate for CashAccount38 {
391 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
392 self.id
393 .validate(&helpers::child_path(path, "Id"), config, collector);
394 if let Some(ref val) = self.tp
395 && config.validate_optional_fields
396 {
397 val.validate(&helpers::child_path(path, "Tp"), config, collector);
398 }
399 if let Some(ref val) = self.ccy {
400 helpers::validate_pattern(
401 val,
402 "Ccy",
403 "[A-Z]{3,3}",
404 &helpers::child_path(path, "Ccy"),
405 config,
406 collector,
407 );
408 }
409 if let Some(ref val) = self.nm {
410 helpers::validate_length(
411 val,
412 "Nm",
413 Some(1),
414 Some(70),
415 &helpers::child_path(path, "Nm"),
416 config,
417 collector,
418 );
419 }
420 if let Some(ref val) = self.prxy
421 && config.validate_optional_fields
422 {
423 val.validate(&helpers::child_path(path, "Prxy"), config, collector);
424 }
425 }
426}
427
428#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
430pub struct CashAccountType2Choice {
431 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
432 pub cd: Option<String>,
433 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
434 pub prtry: Option<String>,
435}
436
437impl Validate for CashAccountType2Choice {
438 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
439 if let Some(ref val) = self.cd {
440 helpers::validate_length(
441 val,
442 "Cd",
443 Some(1),
444 Some(4),
445 &helpers::child_path(path, "Cd"),
446 config,
447 collector,
448 );
449 }
450 if let Some(ref val) = self.prtry {
451 helpers::validate_length(
452 val,
453 "Prtry",
454 Some(1),
455 Some(35),
456 &helpers::child_path(path, "Prtry"),
457 config,
458 collector,
459 );
460 }
461 }
462}
463
464#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
466pub struct CategoryPurpose1Choice {
467 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
468 pub cd: Option<String>,
469 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
470 pub prtry: Option<String>,
471}
472
473impl Validate for CategoryPurpose1Choice {
474 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
475 if let Some(ref val) = self.cd {
476 helpers::validate_length(
477 val,
478 "Cd",
479 Some(1),
480 Some(4),
481 &helpers::child_path(path, "Cd"),
482 config,
483 collector,
484 );
485 }
486 if let Some(ref val) = self.prtry {
487 helpers::validate_length(
488 val,
489 "Prtry",
490 Some(1),
491 Some(35),
492 &helpers::child_path(path, "Prtry"),
493 config,
494 collector,
495 );
496 }
497 }
498}
499
500#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
502pub enum ChargeBearerType1Code1 {
503 #[default]
504 #[serde(rename = "DEBT")]
505 CodeDEBT,
506 #[serde(rename = "CRED")]
507 CodeCRED,
508 #[serde(rename = "SHAR")]
509 CodeSHAR,
510}
511
512impl Validate for ChargeBearerType1Code1 {
513 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
514 }
516}
517
518#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
520pub struct Cheque111 {
521 #[serde(rename = "ChqTp", skip_serializing_if = "Option::is_none")]
522 pub chq_tp: Option<ChequeType2Code1>,
523 #[serde(rename = "ChqNb", skip_serializing_if = "Option::is_none")]
524 pub chq_nb: Option<String>,
525 #[serde(rename = "ChqFr", skip_serializing_if = "Option::is_none")]
526 pub chq_fr: Option<NameAndAddress161>,
527 #[serde(rename = "DlvryMtd", skip_serializing_if = "Option::is_none")]
528 pub dlvry_mtd: Option<ChequeDeliveryMethod1Choice>,
529 #[serde(rename = "DlvrTo", skip_serializing_if = "Option::is_none")]
530 pub dlvr_to: Option<NameAndAddress161>,
531 #[serde(rename = "InstrPrty", skip_serializing_if = "Option::is_none")]
532 pub instr_prty: Option<Priority2Code>,
533 #[serde(rename = "ChqMtrtyDt", skip_serializing_if = "Option::is_none")]
534 pub chq_mtrty_dt: Option<String>,
535 #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
536 pub frms_cd: Option<String>,
537 #[serde(rename = "MemoFld", skip_serializing_if = "Option::is_none")]
538 pub memo_fld: Option<Vec<String>>,
539 #[serde(rename = "RgnlClrZone", skip_serializing_if = "Option::is_none")]
540 pub rgnl_clr_zone: Option<String>,
541 #[serde(rename = "PrtLctn", skip_serializing_if = "Option::is_none")]
542 pub prt_lctn: Option<String>,
543 #[serde(rename = "Sgntr", skip_serializing_if = "Option::is_none")]
544 pub sgntr: Option<Vec<String>>,
545}
546
547impl Validate for Cheque111 {
548 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
549 if let Some(ref val) = self.chq_tp
550 && config.validate_optional_fields
551 {
552 val.validate(&helpers::child_path(path, "ChqTp"), config, collector);
553 }
554 if let Some(ref val) = self.chq_nb {
555 helpers::validate_length(
556 val,
557 "ChqNb",
558 Some(1),
559 Some(35),
560 &helpers::child_path(path, "ChqNb"),
561 config,
562 collector,
563 );
564 }
565 if let Some(ref val) = self.chq_fr
566 && config.validate_optional_fields
567 {
568 val.validate(&helpers::child_path(path, "ChqFr"), config, collector);
569 }
570 if let Some(ref val) = self.dlvry_mtd
571 && config.validate_optional_fields
572 {
573 val.validate(&helpers::child_path(path, "DlvryMtd"), config, collector);
574 }
575 if let Some(ref val) = self.dlvr_to
576 && config.validate_optional_fields
577 {
578 val.validate(&helpers::child_path(path, "DlvrTo"), config, collector);
579 }
580 if let Some(ref val) = self.instr_prty
581 && config.validate_optional_fields
582 {
583 val.validate(&helpers::child_path(path, "InstrPrty"), config, collector);
584 }
585 if let Some(ref val) = self.frms_cd {
586 helpers::validate_length(
587 val,
588 "FrmsCd",
589 Some(1),
590 Some(35),
591 &helpers::child_path(path, "FrmsCd"),
592 config,
593 collector,
594 );
595 }
596 if let Some(ref vec) = self.memo_fld {
597 for item in vec {
598 helpers::validate_length(
599 item,
600 "MemoFld",
601 Some(1),
602 Some(35),
603 &helpers::child_path(path, "MemoFld"),
604 config,
605 collector,
606 );
607 }
608 }
609 if let Some(ref val) = self.rgnl_clr_zone {
610 helpers::validate_length(
611 val,
612 "RgnlClrZone",
613 Some(1),
614 Some(35),
615 &helpers::child_path(path, "RgnlClrZone"),
616 config,
617 collector,
618 );
619 }
620 if let Some(ref val) = self.prt_lctn {
621 helpers::validate_length(
622 val,
623 "PrtLctn",
624 Some(1),
625 Some(35),
626 &helpers::child_path(path, "PrtLctn"),
627 config,
628 collector,
629 );
630 }
631 if let Some(ref vec) = self.sgntr {
632 for item in vec {
633 helpers::validate_length(
634 item,
635 "Sgntr",
636 Some(1),
637 Some(70),
638 &helpers::child_path(path, "Sgntr"),
639 config,
640 collector,
641 );
642 }
643 }
644 }
645}
646
647#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
649pub enum ChequeDelivery1Code {
650 #[default]
651 #[serde(rename = "MLDB")]
652 CodeMLDB,
653 #[serde(rename = "MLCD")]
654 CodeMLCD,
655 #[serde(rename = "MLFA")]
656 CodeMLFA,
657 #[serde(rename = "CRDB")]
658 CodeCRDB,
659 #[serde(rename = "CRCD")]
660 CodeCRCD,
661 #[serde(rename = "CRFA")]
662 CodeCRFA,
663 #[serde(rename = "PUDB")]
664 CodePUDB,
665 #[serde(rename = "PUCD")]
666 CodePUCD,
667 #[serde(rename = "PUFA")]
668 CodePUFA,
669 #[serde(rename = "RGDB")]
670 CodeRGDB,
671 #[serde(rename = "RGCD")]
672 CodeRGCD,
673 #[serde(rename = "RGFA")]
674 CodeRGFA,
675}
676
677impl Validate for ChequeDelivery1Code {
678 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
679 }
681}
682
683#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
685pub struct ChequeDeliveryMethod1Choice {
686 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
687 pub cd: Option<ChequeDelivery1Code>,
688 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
689 pub prtry: Option<String>,
690}
691
692impl Validate for ChequeDeliveryMethod1Choice {
693 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
694 if let Some(ref val) = self.cd
695 && config.validate_optional_fields
696 {
697 val.validate(&helpers::child_path(path, "Cd"), config, collector);
698 }
699 if let Some(ref val) = self.prtry {
700 helpers::validate_length(
701 val,
702 "Prtry",
703 Some(1),
704 Some(35),
705 &helpers::child_path(path, "Prtry"),
706 config,
707 collector,
708 );
709 }
710 }
711}
712
713#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
715pub enum ChequeType2Code1 {
716 #[default]
717 #[serde(rename = "CCHQ")]
718 CodeCCHQ,
719 #[serde(rename = "BCHQ")]
720 CodeBCHQ,
721 #[serde(rename = "DRFT")]
722 CodeDRFT,
723}
724
725impl Validate for ChequeType2Code1 {
726 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
727 }
729}
730
731#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
733pub struct ClearingSystemIdentification2Choice {
734 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
735 pub cd: Option<String>,
736 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
737 pub prtry: Option<String>,
738}
739
740impl Validate for ClearingSystemIdentification2Choice {
741 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
742 if let Some(ref val) = self.cd {
743 helpers::validate_length(
744 val,
745 "Cd",
746 Some(1),
747 Some(5),
748 &helpers::child_path(path, "Cd"),
749 config,
750 collector,
751 );
752 }
753 if let Some(ref val) = self.prtry {
754 helpers::validate_length(
755 val,
756 "Prtry",
757 Some(1),
758 Some(35),
759 &helpers::child_path(path, "Prtry"),
760 config,
761 collector,
762 );
763 }
764 }
765}
766
767#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
769pub struct ClearingSystemIdentification2Choice1 {
770 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
771 pub cd: Option<String>,
772}
773
774impl Validate for ClearingSystemIdentification2Choice1 {
775 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
776 if let Some(ref val) = self.cd {
777 helpers::validate_length(
778 val,
779 "Cd",
780 Some(1),
781 Some(5),
782 &helpers::child_path(path, "Cd"),
783 config,
784 collector,
785 );
786 }
787 }
788}
789
790#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
792pub struct ClearingSystemMemberIdentification2 {
793 #[serde(rename = "ClrSysId", skip_serializing_if = "Option::is_none")]
794 pub clr_sys_id: Option<ClearingSystemIdentification2Choice>,
795 #[serde(rename = "MmbId")]
796 pub mmb_id: String,
797}
798
799impl Validate for ClearingSystemMemberIdentification2 {
800 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
801 if let Some(ref val) = self.clr_sys_id
802 && config.validate_optional_fields
803 {
804 val.validate(&helpers::child_path(path, "ClrSysId"), config, collector);
805 }
806 helpers::validate_length(
807 &self.mmb_id,
808 "MmbId",
809 Some(1),
810 Some(35),
811 &helpers::child_path(path, "MmbId"),
812 config,
813 collector,
814 );
815 }
816}
817
818#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
820pub struct ClearingSystemMemberIdentification21 {
821 #[serde(rename = "ClrSysId")]
822 pub clr_sys_id: ClearingSystemIdentification2Choice1,
823 #[serde(rename = "MmbId")]
824 pub mmb_id: String,
825}
826
827impl Validate for ClearingSystemMemberIdentification21 {
828 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
829 self.clr_sys_id
830 .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
831 helpers::validate_length(
832 &self.mmb_id,
833 "MmbId",
834 Some(1),
835 Some(35),
836 &helpers::child_path(path, "MmbId"),
837 config,
838 collector,
839 );
840 }
841}
842
843#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
845pub struct Contact4 {
846 #[serde(rename = "NmPrfx", skip_serializing_if = "Option::is_none")]
847 pub nm_prfx: Option<NamePrefix2Code>,
848 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
849 pub nm: Option<String>,
850 #[serde(rename = "PhneNb", skip_serializing_if = "Option::is_none")]
851 pub phne_nb: Option<String>,
852 #[serde(rename = "MobNb", skip_serializing_if = "Option::is_none")]
853 pub mob_nb: Option<String>,
854 #[serde(rename = "FaxNb", skip_serializing_if = "Option::is_none")]
855 pub fax_nb: Option<String>,
856 #[serde(rename = "EmailAdr", skip_serializing_if = "Option::is_none")]
857 pub email_adr: Option<String>,
858 #[serde(rename = "EmailPurp", skip_serializing_if = "Option::is_none")]
859 pub email_purp: Option<String>,
860 #[serde(rename = "JobTitl", skip_serializing_if = "Option::is_none")]
861 pub job_titl: Option<String>,
862 #[serde(rename = "Rspnsblty", skip_serializing_if = "Option::is_none")]
863 pub rspnsblty: Option<String>,
864 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
865 pub dept: Option<String>,
866 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
867 pub othr: Option<Vec<OtherContact1>>,
868 #[serde(rename = "PrefrdMtd", skip_serializing_if = "Option::is_none")]
869 pub prefrd_mtd: Option<PreferredContactMethod1Code>,
870}
871
872impl Validate for Contact4 {
873 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
874 if let Some(ref val) = self.nm_prfx
875 && config.validate_optional_fields
876 {
877 val.validate(&helpers::child_path(path, "NmPrfx"), config, collector);
878 }
879 if let Some(ref val) = self.nm {
880 helpers::validate_length(
881 val,
882 "Nm",
883 Some(1),
884 Some(140),
885 &helpers::child_path(path, "Nm"),
886 config,
887 collector,
888 );
889 }
890 if let Some(ref val) = self.phne_nb {
891 helpers::validate_pattern(
892 val,
893 "PhneNb",
894 "\\+[0-9]{1,3}-[0-9()+\\-]{1,30}",
895 &helpers::child_path(path, "PhneNb"),
896 config,
897 collector,
898 );
899 }
900 if let Some(ref val) = self.mob_nb {
901 helpers::validate_pattern(
902 val,
903 "MobNb",
904 "\\+[0-9]{1,3}-[0-9()+\\-]{1,30}",
905 &helpers::child_path(path, "MobNb"),
906 config,
907 collector,
908 );
909 }
910 if let Some(ref val) = self.fax_nb {
911 helpers::validate_pattern(
912 val,
913 "FaxNb",
914 "\\+[0-9]{1,3}-[0-9()+\\-]{1,30}",
915 &helpers::child_path(path, "FaxNb"),
916 config,
917 collector,
918 );
919 }
920 if let Some(ref val) = self.email_adr {
921 helpers::validate_length(
922 val,
923 "EmailAdr",
924 Some(1),
925 Some(2048),
926 &helpers::child_path(path, "EmailAdr"),
927 config,
928 collector,
929 );
930 }
931 if let Some(ref val) = self.email_purp {
932 helpers::validate_length(
933 val,
934 "EmailPurp",
935 Some(1),
936 Some(35),
937 &helpers::child_path(path, "EmailPurp"),
938 config,
939 collector,
940 );
941 }
942 if let Some(ref val) = self.job_titl {
943 helpers::validate_length(
944 val,
945 "JobTitl",
946 Some(1),
947 Some(35),
948 &helpers::child_path(path, "JobTitl"),
949 config,
950 collector,
951 );
952 }
953 if let Some(ref val) = self.rspnsblty {
954 helpers::validate_length(
955 val,
956 "Rspnsblty",
957 Some(1),
958 Some(35),
959 &helpers::child_path(path, "Rspnsblty"),
960 config,
961 collector,
962 );
963 }
964 if let Some(ref val) = self.dept {
965 helpers::validate_length(
966 val,
967 "Dept",
968 Some(1),
969 Some(70),
970 &helpers::child_path(path, "Dept"),
971 config,
972 collector,
973 );
974 }
975 if let Some(ref vec) = self.othr
976 && config.validate_optional_fields
977 {
978 for item in vec {
979 item.validate(&helpers::child_path(path, "Othr"), config, collector);
980 }
981 }
982 if let Some(ref val) = self.prefrd_mtd
983 && config.validate_optional_fields
984 {
985 val.validate(&helpers::child_path(path, "PrefrdMtd"), config, collector);
986 }
987 }
988}
989
990#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
992pub enum CreditDebitCode {
993 #[default]
994 #[serde(rename = "CRDT")]
995 CodeCRDT,
996 #[serde(rename = "DBIT")]
997 CodeDBIT,
998}
999
1000impl Validate for CreditDebitCode {
1001 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1002 }
1004}
1005
1006#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1008pub struct CreditTransferTransaction341 {
1009 #[serde(rename = "PmtId")]
1010 pub pmt_id: PaymentIdentification61,
1011 #[serde(rename = "PmtTpInf", skip_serializing_if = "Option::is_none")]
1012 pub pmt_tp_inf: Option<PaymentTypeInformation261>,
1013 #[serde(rename = "Amt")]
1014 pub amt: AmountType4Choice,
1015 #[serde(rename = "XchgRateInf", skip_serializing_if = "Option::is_none")]
1016 pub xchg_rate_inf: Option<ExchangeRate1>,
1017 #[serde(rename = "ChrgBr", skip_serializing_if = "Option::is_none")]
1018 pub chrg_br: Option<ChargeBearerType1Code1>,
1019 #[serde(rename = "ChqInstr", skip_serializing_if = "Option::is_none")]
1020 pub chq_instr: Option<Cheque111>,
1021 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
1022 pub ultmt_dbtr: Option<PartyIdentification1353>,
1023 #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
1024 pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification62>,
1025 #[serde(rename = "IntrmyAgt1Acct", skip_serializing_if = "Option::is_none")]
1026 pub intrmy_agt1_acct: Option<CashAccount38>,
1027 #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
1028 pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification62>,
1029 #[serde(rename = "IntrmyAgt2Acct", skip_serializing_if = "Option::is_none")]
1030 pub intrmy_agt2_acct: Option<CashAccount38>,
1031 #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
1032 pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification62>,
1033 #[serde(rename = "IntrmyAgt3Acct", skip_serializing_if = "Option::is_none")]
1034 pub intrmy_agt3_acct: Option<CashAccount38>,
1035 #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
1036 pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification63>,
1037 #[serde(rename = "CdtrAgtAcct", skip_serializing_if = "Option::is_none")]
1038 pub cdtr_agt_acct: Option<CashAccount38>,
1039 #[serde(rename = "Cdtr")]
1040 pub cdtr: PartyIdentification1354,
1041 #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
1042 pub cdtr_acct: Option<CashAccount38>,
1043 #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
1044 pub ultmt_cdtr: Option<PartyIdentification1353>,
1045 #[serde(rename = "InstrForCdtrAgt", skip_serializing_if = "Option::is_none")]
1046 pub instr_for_cdtr_agt: Option<Vec<InstructionForCreditorAgent1>>,
1047 #[serde(rename = "InstrForDbtrAgt", skip_serializing_if = "Option::is_none")]
1048 pub instr_for_dbtr_agt: Option<String>,
1049 #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
1050 pub purp: Option<Purpose2Choice>,
1051 #[serde(rename = "RgltryRptg", skip_serializing_if = "Option::is_none")]
1052 pub rgltry_rptg: Option<Vec<RegulatoryReporting3>>,
1053 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
1054 pub tax: Option<TaxInformation8>,
1055 #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
1056 pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
1057 #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
1058 pub rmt_inf: Option<RemittanceInformation161>,
1059}
1060
1061impl Validate for CreditTransferTransaction341 {
1062 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1063 self.pmt_id
1064 .validate(&helpers::child_path(path, "PmtId"), config, collector);
1065 if let Some(ref val) = self.pmt_tp_inf
1066 && config.validate_optional_fields
1067 {
1068 val.validate(&helpers::child_path(path, "PmtTpInf"), config, collector);
1069 }
1070 self.amt
1071 .validate(&helpers::child_path(path, "Amt"), config, collector);
1072 if let Some(ref val) = self.xchg_rate_inf
1073 && config.validate_optional_fields
1074 {
1075 val.validate(&helpers::child_path(path, "XchgRateInf"), config, collector);
1076 }
1077 if let Some(ref val) = self.chrg_br
1078 && config.validate_optional_fields
1079 {
1080 val.validate(&helpers::child_path(path, "ChrgBr"), config, collector);
1081 }
1082 if let Some(ref val) = self.chq_instr
1083 && config.validate_optional_fields
1084 {
1085 val.validate(&helpers::child_path(path, "ChqInstr"), config, collector);
1086 }
1087 if let Some(ref val) = self.ultmt_dbtr
1088 && config.validate_optional_fields
1089 {
1090 val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
1091 }
1092 if let Some(ref val) = self.intrmy_agt1
1093 && config.validate_optional_fields
1094 {
1095 val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
1096 }
1097 if let Some(ref val) = self.intrmy_agt1_acct
1098 && config.validate_optional_fields
1099 {
1100 val.validate(
1101 &helpers::child_path(path, "IntrmyAgt1Acct"),
1102 config,
1103 collector,
1104 );
1105 }
1106 if let Some(ref val) = self.intrmy_agt2
1107 && config.validate_optional_fields
1108 {
1109 val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
1110 }
1111 if let Some(ref val) = self.intrmy_agt2_acct
1112 && config.validate_optional_fields
1113 {
1114 val.validate(
1115 &helpers::child_path(path, "IntrmyAgt2Acct"),
1116 config,
1117 collector,
1118 );
1119 }
1120 if let Some(ref val) = self.intrmy_agt3
1121 && config.validate_optional_fields
1122 {
1123 val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
1124 }
1125 if let Some(ref val) = self.intrmy_agt3_acct
1126 && config.validate_optional_fields
1127 {
1128 val.validate(
1129 &helpers::child_path(path, "IntrmyAgt3Acct"),
1130 config,
1131 collector,
1132 );
1133 }
1134 if let Some(ref val) = self.cdtr_agt
1135 && config.validate_optional_fields
1136 {
1137 val.validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
1138 }
1139 if let Some(ref val) = self.cdtr_agt_acct
1140 && config.validate_optional_fields
1141 {
1142 val.validate(&helpers::child_path(path, "CdtrAgtAcct"), config, collector);
1143 }
1144 self.cdtr
1145 .validate(&helpers::child_path(path, "Cdtr"), config, collector);
1146 if let Some(ref val) = self.cdtr_acct
1147 && config.validate_optional_fields
1148 {
1149 val.validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
1150 }
1151 if let Some(ref val) = self.ultmt_cdtr
1152 && config.validate_optional_fields
1153 {
1154 val.validate(&helpers::child_path(path, "UltmtCdtr"), config, collector);
1155 }
1156 if let Some(ref vec) = self.instr_for_cdtr_agt
1157 && config.validate_optional_fields
1158 {
1159 for item in vec {
1160 item.validate(
1161 &helpers::child_path(path, "InstrForCdtrAgt"),
1162 config,
1163 collector,
1164 );
1165 }
1166 }
1167 if let Some(ref val) = self.instr_for_dbtr_agt {
1168 helpers::validate_length(
1169 val,
1170 "InstrForDbtrAgt",
1171 Some(1),
1172 Some(140),
1173 &helpers::child_path(path, "InstrForDbtrAgt"),
1174 config,
1175 collector,
1176 );
1177 }
1178 if let Some(ref val) = self.purp
1179 && config.validate_optional_fields
1180 {
1181 val.validate(&helpers::child_path(path, "Purp"), config, collector);
1182 }
1183 if let Some(ref vec) = self.rgltry_rptg
1184 && config.validate_optional_fields
1185 {
1186 for item in vec {
1187 item.validate(&helpers::child_path(path, "RgltryRptg"), config, collector);
1188 }
1189 }
1190 if let Some(ref val) = self.tax
1191 && config.validate_optional_fields
1192 {
1193 val.validate(&helpers::child_path(path, "Tax"), config, collector);
1194 }
1195 if let Some(ref vec) = self.rltd_rmt_inf
1196 && config.validate_optional_fields
1197 {
1198 for item in vec {
1199 item.validate(&helpers::child_path(path, "RltdRmtInf"), config, collector);
1200 }
1201 }
1202 if let Some(ref val) = self.rmt_inf
1203 && config.validate_optional_fields
1204 {
1205 val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
1206 }
1207 }
1208}
1209
1210#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1216pub struct CreditorReferenceInformation2 {
1217 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1218 pub tp: Option<CreditorReferenceType2>,
1219 #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
1220 pub ref_attr: Option<String>,
1221}
1222
1223impl Validate for CreditorReferenceInformation2 {
1224 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1225 if let Some(ref val) = self.tp
1226 && config.validate_optional_fields
1227 {
1228 val.validate(&helpers::child_path(path, "Tp"), config, collector);
1229 }
1230 if let Some(ref val) = self.ref_attr {
1231 helpers::validate_length(
1232 val,
1233 "Ref",
1234 Some(1),
1235 Some(35),
1236 &helpers::child_path(path, "Ref"),
1237 config,
1238 collector,
1239 );
1240 }
1241 }
1242}
1243
1244#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1246pub struct CreditorReferenceType1Choice {
1247 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1248 pub cd: Option<DocumentType3Code>,
1249 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1250 pub prtry: Option<String>,
1251}
1252
1253impl Validate for CreditorReferenceType1Choice {
1254 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1255 if let Some(ref val) = self.cd
1256 && config.validate_optional_fields
1257 {
1258 val.validate(&helpers::child_path(path, "Cd"), config, collector);
1259 }
1260 if let Some(ref val) = self.prtry {
1261 helpers::validate_length(
1262 val,
1263 "Prtry",
1264 Some(1),
1265 Some(35),
1266 &helpers::child_path(path, "Prtry"),
1267 config,
1268 collector,
1269 );
1270 }
1271 }
1272}
1273
1274#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1276pub struct CreditorReferenceType2 {
1277 #[serde(rename = "CdOrPrtry")]
1278 pub cd_or_prtry: CreditorReferenceType1Choice,
1279 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1280 pub issr: Option<String>,
1281}
1282
1283impl Validate for CreditorReferenceType2 {
1284 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1285 self.cd_or_prtry
1286 .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
1287 if let Some(ref val) = self.issr {
1288 helpers::validate_length(
1289 val,
1290 "Issr",
1291 Some(1),
1292 Some(35),
1293 &helpers::child_path(path, "Issr"),
1294 config,
1295 collector,
1296 );
1297 }
1298 }
1299}
1300
1301#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1303pub struct CustomerCreditTransferInitiationV09 {
1304 #[serde(rename = "GrpHdr")]
1305 pub grp_hdr: GroupHeader851,
1306 #[serde(rename = "PmtInf")]
1307 pub pmt_inf: PaymentInstruction301,
1308}
1309
1310impl Validate for CustomerCreditTransferInitiationV09 {
1311 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1312 self.grp_hdr
1313 .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
1314 self.pmt_inf
1315 .validate(&helpers::child_path(path, "PmtInf"), config, collector);
1316 }
1317}
1318
1319#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1321pub struct DateAndDateTime2Choice {
1322 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
1323 pub dt: Option<String>,
1324 #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
1325 pub dt_tm: Option<String>,
1326}
1327
1328impl Validate for DateAndDateTime2Choice {
1329 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
1330}
1331
1332#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1334pub struct DateAndPlaceOfBirth1 {
1335 #[serde(rename = "BirthDt")]
1336 pub birth_dt: String,
1337 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
1338 pub prvc_of_birth: Option<String>,
1339 #[serde(rename = "CityOfBirth")]
1340 pub city_of_birth: String,
1341 #[serde(rename = "CtryOfBirth")]
1342 pub ctry_of_birth: String,
1343}
1344
1345impl Validate for DateAndPlaceOfBirth1 {
1346 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1347 if let Some(ref val) = self.prvc_of_birth {
1348 helpers::validate_length(
1349 val,
1350 "PrvcOfBirth",
1351 Some(1),
1352 Some(35),
1353 &helpers::child_path(path, "PrvcOfBirth"),
1354 config,
1355 collector,
1356 );
1357 }
1358 helpers::validate_length(
1359 &self.city_of_birth,
1360 "CityOfBirth",
1361 Some(1),
1362 Some(35),
1363 &helpers::child_path(path, "CityOfBirth"),
1364 config,
1365 collector,
1366 );
1367 helpers::validate_pattern(
1368 &self.ctry_of_birth,
1369 "CtryOfBirth",
1370 "[A-Z]{2,2}",
1371 &helpers::child_path(path, "CtryOfBirth"),
1372 config,
1373 collector,
1374 );
1375 }
1376}
1377
1378#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1380pub struct DatePeriod2 {
1381 #[serde(rename = "FrDt")]
1382 pub fr_dt: String,
1383 #[serde(rename = "ToDt")]
1384 pub to_dt: String,
1385}
1386
1387impl Validate for DatePeriod2 {
1388 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
1389}
1390
1391#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1393pub struct DiscountAmountAndType1 {
1394 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1395 pub tp: Option<DiscountAmountType1Choice>,
1396 #[serde(rename = "Amt")]
1397 pub amt: ActiveOrHistoricCurrencyAndAmount,
1398}
1399
1400impl Validate for DiscountAmountAndType1 {
1401 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1402 if let Some(ref val) = self.tp
1403 && config.validate_optional_fields
1404 {
1405 val.validate(&helpers::child_path(path, "Tp"), config, collector);
1406 }
1407 self.amt
1408 .validate(&helpers::child_path(path, "Amt"), config, collector);
1409 }
1410}
1411
1412#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1414pub struct DiscountAmountType1Choice {
1415 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1416 pub cd: Option<String>,
1417 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1418 pub prtry: Option<String>,
1419}
1420
1421impl Validate for DiscountAmountType1Choice {
1422 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1423 if let Some(ref val) = self.cd {
1424 helpers::validate_length(
1425 val,
1426 "Cd",
1427 Some(1),
1428 Some(4),
1429 &helpers::child_path(path, "Cd"),
1430 config,
1431 collector,
1432 );
1433 }
1434 if let Some(ref val) = self.prtry {
1435 helpers::validate_length(
1436 val,
1437 "Prtry",
1438 Some(1),
1439 Some(35),
1440 &helpers::child_path(path, "Prtry"),
1441 config,
1442 collector,
1443 );
1444 }
1445 }
1446}
1447
1448#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1450pub struct DocumentAdjustment1 {
1451 #[serde(rename = "Amt")]
1452 pub amt: ActiveOrHistoricCurrencyAndAmount,
1453 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
1454 pub cdt_dbt_ind: Option<CreditDebitCode>,
1455 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
1456 pub rsn: Option<String>,
1457 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
1458 pub addtl_inf: Option<String>,
1459}
1460
1461impl Validate for DocumentAdjustment1 {
1462 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1463 self.amt
1464 .validate(&helpers::child_path(path, "Amt"), config, collector);
1465 if let Some(ref val) = self.cdt_dbt_ind
1466 && config.validate_optional_fields
1467 {
1468 val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
1469 }
1470 if let Some(ref val) = self.rsn {
1471 helpers::validate_length(
1472 val,
1473 "Rsn",
1474 Some(1),
1475 Some(4),
1476 &helpers::child_path(path, "Rsn"),
1477 config,
1478 collector,
1479 );
1480 }
1481 if let Some(ref val) = self.addtl_inf {
1482 helpers::validate_length(
1483 val,
1484 "AddtlInf",
1485 Some(1),
1486 Some(140),
1487 &helpers::child_path(path, "AddtlInf"),
1488 config,
1489 collector,
1490 );
1491 }
1492 }
1493}
1494
1495#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1497pub struct DocumentLineIdentification1 {
1498 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1499 pub tp: Option<DocumentLineType1>,
1500 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
1501 pub nb: Option<String>,
1502 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
1503 pub rltd_dt: Option<String>,
1504}
1505
1506impl Validate for DocumentLineIdentification1 {
1507 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1508 if let Some(ref val) = self.tp
1509 && config.validate_optional_fields
1510 {
1511 val.validate(&helpers::child_path(path, "Tp"), config, collector);
1512 }
1513 if let Some(ref val) = self.nb {
1514 helpers::validate_length(
1515 val,
1516 "Nb",
1517 Some(1),
1518 Some(35),
1519 &helpers::child_path(path, "Nb"),
1520 config,
1521 collector,
1522 );
1523 }
1524 }
1525}
1526
1527#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1529pub struct DocumentLineInformation1 {
1530 #[serde(rename = "Id")]
1531 pub id: Vec<DocumentLineIdentification1>,
1532 #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
1533 pub desc: Option<String>,
1534 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
1535 pub amt: Option<RemittanceAmount3>,
1536}
1537
1538impl Validate for DocumentLineInformation1 {
1539 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1540 for item in &self.id {
1541 item.validate(&helpers::child_path(path, "Id"), config, collector);
1542 }
1543 if let Some(ref val) = self.desc {
1544 helpers::validate_length(
1545 val,
1546 "Desc",
1547 Some(1),
1548 Some(2048),
1549 &helpers::child_path(path, "Desc"),
1550 config,
1551 collector,
1552 );
1553 }
1554 if let Some(ref val) = self.amt
1555 && config.validate_optional_fields
1556 {
1557 val.validate(&helpers::child_path(path, "Amt"), config, collector);
1558 }
1559 }
1560}
1561
1562#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1564pub struct DocumentLineType1 {
1565 #[serde(rename = "CdOrPrtry")]
1566 pub cd_or_prtry: DocumentLineType1Choice,
1567 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1568 pub issr: Option<String>,
1569}
1570
1571impl Validate for DocumentLineType1 {
1572 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1573 self.cd_or_prtry
1574 .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
1575 if let Some(ref val) = self.issr {
1576 helpers::validate_length(
1577 val,
1578 "Issr",
1579 Some(1),
1580 Some(35),
1581 &helpers::child_path(path, "Issr"),
1582 config,
1583 collector,
1584 );
1585 }
1586 }
1587}
1588
1589#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1591pub struct DocumentLineType1Choice {
1592 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1593 pub cd: Option<String>,
1594 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1595 pub prtry: Option<String>,
1596}
1597
1598impl Validate for DocumentLineType1Choice {
1599 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1600 if let Some(ref val) = self.cd {
1601 helpers::validate_length(
1602 val,
1603 "Cd",
1604 Some(1),
1605 Some(4),
1606 &helpers::child_path(path, "Cd"),
1607 config,
1608 collector,
1609 );
1610 }
1611 if let Some(ref val) = self.prtry {
1612 helpers::validate_length(
1613 val,
1614 "Prtry",
1615 Some(1),
1616 Some(35),
1617 &helpers::child_path(path, "Prtry"),
1618 config,
1619 collector,
1620 );
1621 }
1622 }
1623}
1624
1625#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1627pub enum DocumentType3Code {
1628 #[default]
1629 #[serde(rename = "RADM")]
1630 CodeRADM,
1631 #[serde(rename = "RPIN")]
1632 CodeRPIN,
1633 #[serde(rename = "FXDR")]
1634 CodeFXDR,
1635 #[serde(rename = "DISP")]
1636 CodeDISP,
1637 #[serde(rename = "PUOR")]
1638 CodePUOR,
1639 #[serde(rename = "SCOR")]
1640 CodeSCOR,
1641}
1642
1643impl Validate for DocumentType3Code {
1644 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1645 }
1647}
1648
1649#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1651pub enum DocumentType6Code {
1652 #[default]
1653 #[serde(rename = "MSIN")]
1654 CodeMSIN,
1655 #[serde(rename = "CNFA")]
1656 CodeCNFA,
1657 #[serde(rename = "DNFA")]
1658 CodeDNFA,
1659 #[serde(rename = "CINV")]
1660 CodeCINV,
1661 #[serde(rename = "CREN")]
1662 CodeCREN,
1663 #[serde(rename = "DEBN")]
1664 CodeDEBN,
1665 #[serde(rename = "HIRI")]
1666 CodeHIRI,
1667 #[serde(rename = "SBIN")]
1668 CodeSBIN,
1669 #[serde(rename = "CMCN")]
1670 CodeCMCN,
1671 #[serde(rename = "SOAC")]
1672 CodeSOAC,
1673 #[serde(rename = "DISP")]
1674 CodeDISP,
1675 #[serde(rename = "BOLD")]
1676 CodeBOLD,
1677 #[serde(rename = "VCHR")]
1678 CodeVCHR,
1679 #[serde(rename = "AROI")]
1680 CodeAROI,
1681 #[serde(rename = "TSUT")]
1682 CodeTSUT,
1683 #[serde(rename = "PUOR")]
1684 CodePUOR,
1685}
1686
1687impl Validate for DocumentType6Code {
1688 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1689 }
1691}
1692
1693#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1695pub struct EquivalentAmount2 {
1696 #[serde(rename = "Amt")]
1697 pub amt: ActiveOrHistoricCurrencyAndAmount,
1698 #[serde(rename = "CcyOfTrf")]
1699 pub ccy_of_trf: String,
1700}
1701
1702impl Validate for EquivalentAmount2 {
1703 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1704 self.amt
1705 .validate(&helpers::child_path(path, "Amt"), config, collector);
1706 helpers::validate_pattern(
1707 &self.ccy_of_trf,
1708 "CcyOfTrf",
1709 "[A-Z]{3,3}",
1710 &helpers::child_path(path, "CcyOfTrf"),
1711 config,
1712 collector,
1713 );
1714 }
1715}
1716
1717#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1719pub struct ExchangeRate1 {
1720 #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
1721 pub unit_ccy: Option<String>,
1722 #[serde(rename = "XchgRate", skip_serializing_if = "Option::is_none")]
1723 pub xchg_rate: Option<f64>,
1724 #[serde(rename = "RateTp", skip_serializing_if = "Option::is_none")]
1725 pub rate_tp: Option<ExchangeRateType1Code>,
1726 #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
1727 pub ctrct_id: Option<String>,
1728}
1729
1730impl Validate for ExchangeRate1 {
1731 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1732 if let Some(ref val) = self.unit_ccy {
1733 helpers::validate_pattern(
1734 val,
1735 "UnitCcy",
1736 "[A-Z]{3,3}",
1737 &helpers::child_path(path, "UnitCcy"),
1738 config,
1739 collector,
1740 );
1741 }
1742 if let Some(ref val) = self.rate_tp
1743 && config.validate_optional_fields
1744 {
1745 val.validate(&helpers::child_path(path, "RateTp"), config, collector);
1746 }
1747 if let Some(ref val) = self.ctrct_id {
1748 helpers::validate_length(
1749 val,
1750 "CtrctId",
1751 Some(1),
1752 Some(35),
1753 &helpers::child_path(path, "CtrctId"),
1754 config,
1755 collector,
1756 );
1757 }
1758 }
1759}
1760
1761#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1763pub enum ExchangeRateType1Code {
1764 #[default]
1765 #[serde(rename = "SPOT")]
1766 CodeSPOT,
1767 #[serde(rename = "SALE")]
1768 CodeSALE,
1769 #[serde(rename = "AGRD")]
1770 CodeAGRD,
1771}
1772
1773impl Validate for ExchangeRateType1Code {
1774 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1775 }
1777}
1778
1779#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1781pub struct FinancialIdentificationSchemeName1Choice {
1782 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1783 pub cd: Option<String>,
1784 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1785 pub prtry: Option<String>,
1786}
1787
1788impl Validate for FinancialIdentificationSchemeName1Choice {
1789 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1790 if let Some(ref val) = self.cd {
1791 helpers::validate_length(
1792 val,
1793 "Cd",
1794 Some(1),
1795 Some(4),
1796 &helpers::child_path(path, "Cd"),
1797 config,
1798 collector,
1799 );
1800 }
1801 if let Some(ref val) = self.prtry {
1802 helpers::validate_length(
1803 val,
1804 "Prtry",
1805 Some(1),
1806 Some(35),
1807 &helpers::child_path(path, "Prtry"),
1808 config,
1809 collector,
1810 );
1811 }
1812 }
1813}
1814
1815#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1817pub struct FinancialInstitutionIdentification18 {
1818 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1819 pub bicfi: Option<String>,
1820 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1821 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification2>,
1822 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1823 pub lei: Option<String>,
1824 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1825 pub nm: Option<String>,
1826 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1827 pub pstl_adr: Option<PostalAddress24>,
1828 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1829 pub othr: Option<GenericFinancialIdentification1>,
1830}
1831
1832impl Validate for FinancialInstitutionIdentification18 {
1833 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1834 if let Some(ref val) = self.bicfi {
1835 helpers::validate_pattern(
1836 val,
1837 "BICFI",
1838 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1839 &helpers::child_path(path, "BICFI"),
1840 config,
1841 collector,
1842 );
1843 }
1844 if let Some(ref val) = self.clr_sys_mmb_id
1845 && config.validate_optional_fields
1846 {
1847 val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
1848 }
1849 if let Some(ref val) = self.lei {
1850 helpers::validate_pattern(
1851 val,
1852 "LEI",
1853 "[A-Z0-9]{18,18}[0-9]{2,2}",
1854 &helpers::child_path(path, "LEI"),
1855 config,
1856 collector,
1857 );
1858 }
1859 if let Some(ref val) = self.nm {
1860 helpers::validate_length(
1861 val,
1862 "Nm",
1863 Some(1),
1864 Some(140),
1865 &helpers::child_path(path, "Nm"),
1866 config,
1867 collector,
1868 );
1869 }
1870 if let Some(ref val) = self.pstl_adr
1871 && config.validate_optional_fields
1872 {
1873 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1874 }
1875 if let Some(ref val) = self.othr
1876 && config.validate_optional_fields
1877 {
1878 val.validate(&helpers::child_path(path, "Othr"), config, collector);
1879 }
1880 }
1881}
1882
1883#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1885pub struct FinancialInstitutionIdentification181 {
1886 #[serde(rename = "BICFI")]
1887 pub bicfi: String,
1888 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1889 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1890 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1891 pub lei: Option<String>,
1892}
1893
1894impl Validate for FinancialInstitutionIdentification181 {
1895 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1896 helpers::validate_pattern(
1897 &self.bicfi,
1898 "BICFI",
1899 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1900 &helpers::child_path(path, "BICFI"),
1901 config,
1902 collector,
1903 );
1904 if let Some(ref val) = self.clr_sys_mmb_id
1905 && config.validate_optional_fields
1906 {
1907 val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
1908 }
1909 if let Some(ref val) = self.lei {
1910 helpers::validate_pattern(
1911 val,
1912 "LEI",
1913 "[A-Z0-9]{18,18}[0-9]{2,2}",
1914 &helpers::child_path(path, "LEI"),
1915 config,
1916 collector,
1917 );
1918 }
1919 }
1920}
1921
1922#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1924pub struct FinancialInstitutionIdentification182 {
1925 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1926 pub bicfi: Option<String>,
1927 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1928 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1929 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1930 pub lei: Option<String>,
1931 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1932 pub nm: Option<String>,
1933 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1934 pub pstl_adr: Option<PostalAddress242>,
1935}
1936
1937impl Validate for FinancialInstitutionIdentification182 {
1938 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1939 if let Some(ref val) = self.bicfi {
1940 helpers::validate_pattern(
1941 val,
1942 "BICFI",
1943 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1944 &helpers::child_path(path, "BICFI"),
1945 config,
1946 collector,
1947 );
1948 }
1949 if let Some(ref val) = self.clr_sys_mmb_id
1950 && config.validate_optional_fields
1951 {
1952 val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
1953 }
1954 if let Some(ref val) = self.lei {
1955 helpers::validate_pattern(
1956 val,
1957 "LEI",
1958 "[A-Z0-9]{18,18}[0-9]{2,2}",
1959 &helpers::child_path(path, "LEI"),
1960 config,
1961 collector,
1962 );
1963 }
1964 if let Some(ref val) = self.nm {
1965 helpers::validate_length(
1966 val,
1967 "Nm",
1968 Some(1),
1969 Some(140),
1970 &helpers::child_path(path, "Nm"),
1971 config,
1972 collector,
1973 );
1974 }
1975 if let Some(ref val) = self.pstl_adr
1976 && config.validate_optional_fields
1977 {
1978 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1979 }
1980 }
1981}
1982
1983#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1985pub struct Garnishment31 {
1986 #[serde(rename = "Tp")]
1987 pub tp: GarnishmentType1,
1988 #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
1989 pub grnshee: Option<PartyIdentification1353>,
1990 #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
1991 pub grnshmt_admstr: Option<PartyIdentification1353>,
1992 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
1993 pub ref_nb: Option<String>,
1994 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
1995 pub dt: Option<String>,
1996 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
1997 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
1998 #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
1999 pub fmly_mdcl_insrnc_ind: Option<bool>,
2000 #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
2001 pub mplyee_termntn_ind: Option<bool>,
2002}
2003
2004impl Validate for Garnishment31 {
2005 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2006 self.tp
2007 .validate(&helpers::child_path(path, "Tp"), config, collector);
2008 if let Some(ref val) = self.grnshee
2009 && config.validate_optional_fields
2010 {
2011 val.validate(&helpers::child_path(path, "Grnshee"), config, collector);
2012 }
2013 if let Some(ref val) = self.grnshmt_admstr
2014 && config.validate_optional_fields
2015 {
2016 val.validate(
2017 &helpers::child_path(path, "GrnshmtAdmstr"),
2018 config,
2019 collector,
2020 );
2021 }
2022 if let Some(ref val) = self.ref_nb {
2023 helpers::validate_length(
2024 val,
2025 "RefNb",
2026 Some(1),
2027 Some(140),
2028 &helpers::child_path(path, "RefNb"),
2029 config,
2030 collector,
2031 );
2032 }
2033 if let Some(ref val) = self.rmtd_amt
2034 && config.validate_optional_fields
2035 {
2036 val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
2037 }
2038 }
2039}
2040
2041#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2043pub struct GarnishmentType1 {
2044 #[serde(rename = "CdOrPrtry")]
2045 pub cd_or_prtry: GarnishmentType1Choice,
2046 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2047 pub issr: Option<String>,
2048}
2049
2050impl Validate for GarnishmentType1 {
2051 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2052 self.cd_or_prtry
2053 .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
2054 if let Some(ref val) = self.issr {
2055 helpers::validate_length(
2056 val,
2057 "Issr",
2058 Some(1),
2059 Some(35),
2060 &helpers::child_path(path, "Issr"),
2061 config,
2062 collector,
2063 );
2064 }
2065 }
2066}
2067
2068#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2070pub struct GarnishmentType1Choice {
2071 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2072 pub cd: Option<String>,
2073 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2074 pub prtry: Option<String>,
2075}
2076
2077impl Validate for GarnishmentType1Choice {
2078 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2079 if let Some(ref val) = self.cd {
2080 helpers::validate_length(
2081 val,
2082 "Cd",
2083 Some(1),
2084 Some(4),
2085 &helpers::child_path(path, "Cd"),
2086 config,
2087 collector,
2088 );
2089 }
2090 if let Some(ref val) = self.prtry {
2091 helpers::validate_length(
2092 val,
2093 "Prtry",
2094 Some(1),
2095 Some(35),
2096 &helpers::child_path(path, "Prtry"),
2097 config,
2098 collector,
2099 );
2100 }
2101 }
2102}
2103
2104#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2106pub struct GenericAccountIdentification1 {
2107 #[serde(rename = "Id")]
2108 pub id: String,
2109 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2110 pub schme_nm: Option<AccountSchemeName1Choice>,
2111 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2112 pub issr: Option<String>,
2113}
2114
2115impl Validate for GenericAccountIdentification1 {
2116 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2117 helpers::validate_length(
2118 &self.id,
2119 "Id",
2120 Some(1),
2121 Some(34),
2122 &helpers::child_path(path, "Id"),
2123 config,
2124 collector,
2125 );
2126 if let Some(ref val) = self.schme_nm
2127 && config.validate_optional_fields
2128 {
2129 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2130 }
2131 if let Some(ref val) = self.issr {
2132 helpers::validate_length(
2133 val,
2134 "Issr",
2135 Some(1),
2136 Some(35),
2137 &helpers::child_path(path, "Issr"),
2138 config,
2139 collector,
2140 );
2141 }
2142 }
2143}
2144
2145#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2147pub struct GenericFinancialIdentification1 {
2148 #[serde(rename = "Id")]
2149 pub id: String,
2150 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2151 pub schme_nm: Option<FinancialIdentificationSchemeName1Choice>,
2152 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2153 pub issr: Option<String>,
2154}
2155
2156impl Validate for GenericFinancialIdentification1 {
2157 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2158 helpers::validate_length(
2159 &self.id,
2160 "Id",
2161 Some(1),
2162 Some(35),
2163 &helpers::child_path(path, "Id"),
2164 config,
2165 collector,
2166 );
2167 if let Some(ref val) = self.schme_nm
2168 && config.validate_optional_fields
2169 {
2170 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2171 }
2172 if let Some(ref val) = self.issr {
2173 helpers::validate_length(
2174 val,
2175 "Issr",
2176 Some(1),
2177 Some(35),
2178 &helpers::child_path(path, "Issr"),
2179 config,
2180 collector,
2181 );
2182 }
2183 }
2184}
2185
2186#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2188pub struct GenericIdentification30 {
2189 #[serde(rename = "Id")]
2190 pub id: String,
2191 #[serde(rename = "Issr")]
2192 pub issr: String,
2193 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2194 pub schme_nm: Option<String>,
2195}
2196
2197impl Validate for GenericIdentification30 {
2198 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2199 helpers::validate_pattern(
2200 &self.id,
2201 "Id",
2202 "[a-zA-Z0-9]{4}",
2203 &helpers::child_path(path, "Id"),
2204 config,
2205 collector,
2206 );
2207 helpers::validate_length(
2208 &self.issr,
2209 "Issr",
2210 Some(1),
2211 Some(35),
2212 &helpers::child_path(path, "Issr"),
2213 config,
2214 collector,
2215 );
2216 if let Some(ref val) = self.schme_nm {
2217 helpers::validate_length(
2218 val,
2219 "SchmeNm",
2220 Some(1),
2221 Some(35),
2222 &helpers::child_path(path, "SchmeNm"),
2223 config,
2224 collector,
2225 );
2226 }
2227 }
2228}
2229
2230#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2232pub struct GenericOrganisationIdentification1 {
2233 #[serde(rename = "Id")]
2234 pub id: String,
2235 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2236 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice>,
2237 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2238 pub issr: Option<String>,
2239}
2240
2241impl Validate for GenericOrganisationIdentification1 {
2242 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2243 helpers::validate_length(
2244 &self.id,
2245 "Id",
2246 Some(1),
2247 Some(35),
2248 &helpers::child_path(path, "Id"),
2249 config,
2250 collector,
2251 );
2252 if let Some(ref val) = self.schme_nm
2253 && config.validate_optional_fields
2254 {
2255 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2256 }
2257 if let Some(ref val) = self.issr {
2258 helpers::validate_length(
2259 val,
2260 "Issr",
2261 Some(1),
2262 Some(35),
2263 &helpers::child_path(path, "Issr"),
2264 config,
2265 collector,
2266 );
2267 }
2268 }
2269}
2270
2271#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2273pub struct GenericOrganisationIdentification11 {
2274 #[serde(rename = "Id")]
2275 pub id: String,
2276 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2277 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
2278 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2279 pub issr: Option<String>,
2280}
2281
2282impl Validate for GenericOrganisationIdentification11 {
2283 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2284 helpers::validate_length(
2285 &self.id,
2286 "Id",
2287 Some(1),
2288 Some(35),
2289 &helpers::child_path(path, "Id"),
2290 config,
2291 collector,
2292 );
2293 if let Some(ref val) = self.schme_nm
2294 && config.validate_optional_fields
2295 {
2296 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2297 }
2298 if let Some(ref val) = self.issr {
2299 helpers::validate_length(
2300 val,
2301 "Issr",
2302 Some(1),
2303 Some(35),
2304 &helpers::child_path(path, "Issr"),
2305 config,
2306 collector,
2307 );
2308 }
2309 }
2310}
2311
2312#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2314pub struct GenericPersonIdentification1 {
2315 #[serde(rename = "Id")]
2316 pub id: String,
2317 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2318 pub schme_nm: Option<PersonIdentificationSchemeName1Choice>,
2319 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2320 pub issr: Option<String>,
2321}
2322
2323impl Validate for GenericPersonIdentification1 {
2324 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2325 helpers::validate_length(
2326 &self.id,
2327 "Id",
2328 Some(1),
2329 Some(35),
2330 &helpers::child_path(path, "Id"),
2331 config,
2332 collector,
2333 );
2334 if let Some(ref val) = self.schme_nm
2335 && config.validate_optional_fields
2336 {
2337 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2338 }
2339 if let Some(ref val) = self.issr {
2340 helpers::validate_length(
2341 val,
2342 "Issr",
2343 Some(1),
2344 Some(35),
2345 &helpers::child_path(path, "Issr"),
2346 config,
2347 collector,
2348 );
2349 }
2350 }
2351}
2352
2353#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2355pub struct GenericPersonIdentification11 {
2356 #[serde(rename = "Id")]
2357 pub id: String,
2358 #[serde(rename = "SchmeNm")]
2359 pub schme_nm: PersonIdentificationSchemeName1Choice1,
2360 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2361 pub issr: Option<String>,
2362}
2363
2364impl Validate for GenericPersonIdentification11 {
2365 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2366 helpers::validate_length(
2367 &self.id,
2368 "Id",
2369 Some(1),
2370 Some(35),
2371 &helpers::child_path(path, "Id"),
2372 config,
2373 collector,
2374 );
2375 self.schme_nm
2376 .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2377 if let Some(ref val) = self.issr {
2378 helpers::validate_length(
2379 val,
2380 "Issr",
2381 Some(1),
2382 Some(35),
2383 &helpers::child_path(path, "Issr"),
2384 config,
2385 collector,
2386 );
2387 }
2388 }
2389}
2390
2391#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2393pub struct GroupHeader851 {
2394 #[serde(rename = "MsgId")]
2395 pub msg_id: String,
2396 #[serde(rename = "CreDtTm")]
2397 pub cre_dt_tm: String,
2398 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
2399 pub authstn: Option<Vec<Authorisation1Choice>>,
2400 #[serde(rename = "NbOfTxs")]
2401 pub nb_of_txs: Max15NumericTextfixed,
2402 #[serde(rename = "InitgPty")]
2403 pub initg_pty: PartyIdentification1351,
2404 #[serde(rename = "FwdgAgt", skip_serializing_if = "Option::is_none")]
2405 pub fwdg_agt: Option<BranchAndFinancialInstitutionIdentification61>,
2406}
2407
2408impl Validate for GroupHeader851 {
2409 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2410 helpers::validate_length(
2411 &self.msg_id,
2412 "MsgId",
2413 Some(1),
2414 Some(35),
2415 &helpers::child_path(path, "MsgId"),
2416 config,
2417 collector,
2418 );
2419 helpers::validate_pattern(
2420 &self.msg_id,
2421 "MsgId",
2422 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2423 &helpers::child_path(path, "MsgId"),
2424 config,
2425 collector,
2426 );
2427 if let Some(ref vec) = self.authstn
2428 && config.validate_optional_fields
2429 {
2430 for item in vec {
2431 item.validate(&helpers::child_path(path, "Authstn"), config, collector);
2432 }
2433 }
2434 self.nb_of_txs
2435 .validate(&helpers::child_path(path, "NbOfTxs"), config, collector);
2436 self.initg_pty
2437 .validate(&helpers::child_path(path, "InitgPty"), config, collector);
2438 if let Some(ref val) = self.fwdg_agt
2439 && config.validate_optional_fields
2440 {
2441 val.validate(&helpers::child_path(path, "FwdgAgt"), config, collector);
2442 }
2443 }
2444}
2445
2446#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2448pub enum Instruction3Code {
2449 #[default]
2450 #[serde(rename = "CHQB")]
2451 CodeCHQB,
2452 #[serde(rename = "HOLD")]
2453 CodeHOLD,
2454 #[serde(rename = "PHOB")]
2455 CodePHOB,
2456 #[serde(rename = "TELB")]
2457 CodeTELB,
2458}
2459
2460impl Validate for Instruction3Code {
2461 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2462 }
2464}
2465
2466#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2468pub struct InstructionForCreditorAgent1 {
2469 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2470 pub cd: Option<Instruction3Code>,
2471 #[serde(rename = "InstrInf", skip_serializing_if = "Option::is_none")]
2472 pub instr_inf: Option<String>,
2473}
2474
2475impl Validate for InstructionForCreditorAgent1 {
2476 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2477 if let Some(ref val) = self.cd
2478 && config.validate_optional_fields
2479 {
2480 val.validate(&helpers::child_path(path, "Cd"), config, collector);
2481 }
2482 if let Some(ref val) = self.instr_inf {
2483 helpers::validate_length(
2484 val,
2485 "InstrInf",
2486 Some(1),
2487 Some(140),
2488 &helpers::child_path(path, "InstrInf"),
2489 config,
2490 collector,
2491 );
2492 }
2493 }
2494}
2495
2496#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2498pub struct LocalInstrument2Choice {
2499 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2500 pub cd: Option<String>,
2501 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2502 pub prtry: Option<String>,
2503}
2504
2505impl Validate for LocalInstrument2Choice {
2506 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2507 if let Some(ref val) = self.cd {
2508 helpers::validate_length(
2509 val,
2510 "Cd",
2511 Some(1),
2512 Some(35),
2513 &helpers::child_path(path, "Cd"),
2514 config,
2515 collector,
2516 );
2517 }
2518 if let Some(ref val) = self.prtry {
2519 helpers::validate_length(
2520 val,
2521 "Prtry",
2522 Some(1),
2523 Some(35),
2524 &helpers::child_path(path, "Prtry"),
2525 config,
2526 collector,
2527 );
2528 }
2529 }
2530}
2531
2532#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2534pub enum Max15NumericTextfixed {
2535 #[default]
2536 #[serde(rename = "1")]
2537 Code1,
2538}
2539
2540impl Validate for Max15NumericTextfixed {
2541 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2542 }
2544}
2545
2546#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2548pub struct NameAndAddress161 {
2549 #[serde(rename = "Nm")]
2550 pub nm: String,
2551 #[serde(rename = "Adr")]
2552 pub adr: PostalAddress242,
2553}
2554
2555impl Validate for NameAndAddress161 {
2556 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2557 helpers::validate_length(
2558 &self.nm,
2559 "Nm",
2560 Some(1),
2561 Some(140),
2562 &helpers::child_path(path, "Nm"),
2563 config,
2564 collector,
2565 );
2566 self.adr
2567 .validate(&helpers::child_path(path, "Adr"), config, collector);
2568 }
2569}
2570
2571#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2573pub enum NamePrefix2Code {
2574 #[default]
2575 #[serde(rename = "DOCT")]
2576 CodeDOCT,
2577 #[serde(rename = "MADM")]
2578 CodeMADM,
2579 #[serde(rename = "MISS")]
2580 CodeMISS,
2581 #[serde(rename = "MIST")]
2582 CodeMIST,
2583 #[serde(rename = "MIKS")]
2584 CodeMIKS,
2585}
2586
2587impl Validate for NamePrefix2Code {
2588 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2589 }
2591}
2592
2593#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2595pub struct OrganisationIdentification291 {
2596 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2597 pub any_bic: Option<String>,
2598 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2599 pub lei: Option<String>,
2600 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2601 pub othr: Option<Vec<GenericOrganisationIdentification1>>,
2602}
2603
2604impl Validate for OrganisationIdentification291 {
2605 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2606 if let Some(ref val) = self.any_bic {
2607 helpers::validate_pattern(
2608 val,
2609 "AnyBIC",
2610 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
2611 &helpers::child_path(path, "AnyBIC"),
2612 config,
2613 collector,
2614 );
2615 }
2616 if let Some(ref val) = self.lei {
2617 helpers::validate_pattern(
2618 val,
2619 "LEI",
2620 "[A-Z0-9]{18,18}[0-9]{2,2}",
2621 &helpers::child_path(path, "LEI"),
2622 config,
2623 collector,
2624 );
2625 }
2626 if let Some(ref vec) = self.othr
2627 && config.validate_optional_fields
2628 {
2629 for item in vec {
2630 item.validate(&helpers::child_path(path, "Othr"), config, collector);
2631 }
2632 }
2633 }
2634}
2635
2636#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2638pub struct OrganisationIdentification292 {
2639 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2640 pub any_bic: Option<String>,
2641 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2642 pub lei: Option<String>,
2643 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2644 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
2645}
2646
2647impl Validate for OrganisationIdentification292 {
2648 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2649 if let Some(ref val) = self.any_bic {
2650 helpers::validate_pattern(
2651 val,
2652 "AnyBIC",
2653 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
2654 &helpers::child_path(path, "AnyBIC"),
2655 config,
2656 collector,
2657 );
2658 }
2659 if let Some(ref val) = self.lei {
2660 helpers::validate_pattern(
2661 val,
2662 "LEI",
2663 "[A-Z0-9]{18,18}[0-9]{2,2}",
2664 &helpers::child_path(path, "LEI"),
2665 config,
2666 collector,
2667 );
2668 }
2669 if let Some(ref vec) = self.othr
2670 && config.validate_optional_fields
2671 {
2672 for item in vec {
2673 item.validate(&helpers::child_path(path, "Othr"), config, collector);
2674 }
2675 }
2676 }
2677}
2678
2679#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2681pub struct OrganisationIdentificationSchemeName1Choice {
2682 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2683 pub cd: Option<String>,
2684 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2685 pub prtry: Option<String>,
2686}
2687
2688impl Validate for OrganisationIdentificationSchemeName1Choice {
2689 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2690 if let Some(ref val) = self.cd {
2691 helpers::validate_length(
2692 val,
2693 "Cd",
2694 Some(1),
2695 Some(4),
2696 &helpers::child_path(path, "Cd"),
2697 config,
2698 collector,
2699 );
2700 }
2701 if let Some(ref val) = self.prtry {
2702 helpers::validate_length(
2703 val,
2704 "Prtry",
2705 Some(1),
2706 Some(35),
2707 &helpers::child_path(path, "Prtry"),
2708 config,
2709 collector,
2710 );
2711 }
2712 }
2713}
2714
2715#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2717pub struct OrganisationIdentificationSchemeName1Choice1 {
2718 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2719 pub cd: Option<String>,
2720}
2721
2722impl Validate for OrganisationIdentificationSchemeName1Choice1 {
2723 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2724 if let Some(ref val) = self.cd {
2725 helpers::validate_length(
2726 val,
2727 "Cd",
2728 Some(1),
2729 Some(4),
2730 &helpers::child_path(path, "Cd"),
2731 config,
2732 collector,
2733 );
2734 }
2735 }
2736}
2737
2738#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2740pub struct OtherContact1 {
2741 #[serde(rename = "ChanlTp")]
2742 pub chanl_tp: String,
2743 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2744 pub id: Option<String>,
2745}
2746
2747impl Validate for OtherContact1 {
2748 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2749 helpers::validate_length(
2750 &self.chanl_tp,
2751 "ChanlTp",
2752 Some(1),
2753 Some(4),
2754 &helpers::child_path(path, "ChanlTp"),
2755 config,
2756 collector,
2757 );
2758 if let Some(ref val) = self.id {
2759 helpers::validate_length(
2760 val,
2761 "Id",
2762 Some(1),
2763 Some(128),
2764 &helpers::child_path(path, "Id"),
2765 config,
2766 collector,
2767 );
2768 }
2769 }
2770}
2771
2772#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2774pub struct Party38Choice1 {
2775 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
2776 pub org_id: Option<OrganisationIdentification291>,
2777 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
2778 pub prvt_id: Option<PersonIdentification131>,
2779}
2780
2781impl Validate for Party38Choice1 {
2782 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2783 if let Some(ref val) = self.org_id
2784 && config.validate_optional_fields
2785 {
2786 val.validate(&helpers::child_path(path, "OrgId"), config, collector);
2787 }
2788 if let Some(ref val) = self.prvt_id
2789 && config.validate_optional_fields
2790 {
2791 val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
2792 }
2793 }
2794}
2795
2796#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2798pub struct Party38Choice2 {
2799 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
2800 pub org_id: Option<OrganisationIdentification292>,
2801 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
2802 pub prvt_id: Option<PersonIdentification132>,
2803}
2804
2805impl Validate for Party38Choice2 {
2806 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2807 if let Some(ref val) = self.org_id
2808 && config.validate_optional_fields
2809 {
2810 val.validate(&helpers::child_path(path, "OrgId"), config, collector);
2811 }
2812 if let Some(ref val) = self.prvt_id
2813 && config.validate_optional_fields
2814 {
2815 val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
2816 }
2817 }
2818}
2819
2820#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2822pub struct PartyIdentification1351 {
2823 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2824 pub nm: Option<String>,
2825 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2826 pub pstl_adr: Option<PostalAddress241>,
2827 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2828 pub id: Option<Party38Choice1>,
2829 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2830 pub ctry_of_res: Option<String>,
2831 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
2832 pub ctct_dtls: Option<Contact4>,
2833}
2834
2835impl Validate for PartyIdentification1351 {
2836 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2837 if let Some(ref val) = self.nm {
2838 helpers::validate_length(
2839 val,
2840 "Nm",
2841 Some(1),
2842 Some(140),
2843 &helpers::child_path(path, "Nm"),
2844 config,
2845 collector,
2846 );
2847 }
2848 if let Some(ref val) = self.pstl_adr
2849 && config.validate_optional_fields
2850 {
2851 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
2852 }
2853 if let Some(ref val) = self.id
2854 && config.validate_optional_fields
2855 {
2856 val.validate(&helpers::child_path(path, "Id"), config, collector);
2857 }
2858 if let Some(ref val) = self.ctry_of_res {
2859 helpers::validate_pattern(
2860 val,
2861 "CtryOfRes",
2862 "[A-Z]{2,2}",
2863 &helpers::child_path(path, "CtryOfRes"),
2864 config,
2865 collector,
2866 );
2867 }
2868 if let Some(ref val) = self.ctct_dtls
2869 && config.validate_optional_fields
2870 {
2871 val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
2872 }
2873 }
2874}
2875
2876#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2878pub struct PartyIdentification1352 {
2879 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2880 pub nm: Option<String>,
2881 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2882 pub pstl_adr: Option<PostalAddress242>,
2883 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2884 pub id: Option<Party38Choice2>,
2885 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2886 pub ctry_of_res: Option<String>,
2887}
2888
2889impl Validate for PartyIdentification1352 {
2890 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2891 if let Some(ref val) = self.nm {
2892 helpers::validate_length(
2893 val,
2894 "Nm",
2895 Some(1),
2896 Some(140),
2897 &helpers::child_path(path, "Nm"),
2898 config,
2899 collector,
2900 );
2901 }
2902 if let Some(ref val) = self.pstl_adr
2903 && config.validate_optional_fields
2904 {
2905 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
2906 }
2907 if let Some(ref val) = self.id
2908 && config.validate_optional_fields
2909 {
2910 val.validate(&helpers::child_path(path, "Id"), config, collector);
2911 }
2912 if let Some(ref val) = self.ctry_of_res {
2913 helpers::validate_pattern(
2914 val,
2915 "CtryOfRes",
2916 "[A-Z]{2,2}",
2917 &helpers::child_path(path, "CtryOfRes"),
2918 config,
2919 collector,
2920 );
2921 }
2922 }
2923}
2924
2925#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2927pub struct PartyIdentification1353 {
2928 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2929 pub nm: Option<String>,
2930 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2931 pub pstl_adr: Option<PostalAddress241>,
2932 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2933 pub id: Option<Party38Choice1>,
2934 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2935 pub ctry_of_res: Option<String>,
2936}
2937
2938impl Validate for PartyIdentification1353 {
2939 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2940 if let Some(ref val) = self.nm {
2941 helpers::validate_length(
2942 val,
2943 "Nm",
2944 Some(1),
2945 Some(140),
2946 &helpers::child_path(path, "Nm"),
2947 config,
2948 collector,
2949 );
2950 }
2951 if let Some(ref val) = self.pstl_adr
2952 && config.validate_optional_fields
2953 {
2954 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
2955 }
2956 if let Some(ref val) = self.id
2957 && config.validate_optional_fields
2958 {
2959 val.validate(&helpers::child_path(path, "Id"), config, collector);
2960 }
2961 if let Some(ref val) = self.ctry_of_res {
2962 helpers::validate_pattern(
2963 val,
2964 "CtryOfRes",
2965 "[A-Z]{2,2}",
2966 &helpers::child_path(path, "CtryOfRes"),
2967 config,
2968 collector,
2969 );
2970 }
2971 }
2972}
2973
2974#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2976pub struct PartyIdentification1354 {
2977 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2978 pub nm: Option<String>,
2979 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2980 pub pstl_adr: Option<PostalAddress242>,
2981 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2982 pub id: Option<Party38Choice1>,
2983 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2984 pub ctry_of_res: Option<String>,
2985}
2986
2987impl Validate for PartyIdentification1354 {
2988 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2989 if let Some(ref val) = self.nm {
2990 helpers::validate_length(
2991 val,
2992 "Nm",
2993 Some(1),
2994 Some(140),
2995 &helpers::child_path(path, "Nm"),
2996 config,
2997 collector,
2998 );
2999 }
3000 if let Some(ref val) = self.pstl_adr
3001 && config.validate_optional_fields
3002 {
3003 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
3004 }
3005 if let Some(ref val) = self.id
3006 && config.validate_optional_fields
3007 {
3008 val.validate(&helpers::child_path(path, "Id"), config, collector);
3009 }
3010 if let Some(ref val) = self.ctry_of_res {
3011 helpers::validate_pattern(
3012 val,
3013 "CtryOfRes",
3014 "[A-Z]{2,2}",
3015 &helpers::child_path(path, "CtryOfRes"),
3016 config,
3017 collector,
3018 );
3019 }
3020 }
3021}
3022
3023#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3025pub struct PaymentIdentification61 {
3026 #[serde(rename = "InstrId", skip_serializing_if = "Option::is_none")]
3027 pub instr_id: Option<String>,
3028 #[serde(rename = "EndToEndId")]
3029 pub end_to_end_id: String,
3030 #[serde(rename = "UETR")]
3031 pub uetr: String,
3032}
3033
3034impl Validate for PaymentIdentification61 {
3035 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3036 if let Some(ref val) = self.instr_id {
3037 helpers::validate_length(
3038 val,
3039 "InstrId",
3040 Some(1),
3041 Some(35),
3042 &helpers::child_path(path, "InstrId"),
3043 config,
3044 collector,
3045 );
3046 }
3047 helpers::validate_length(
3048 &self.end_to_end_id,
3049 "EndToEndId",
3050 Some(1),
3051 Some(35),
3052 &helpers::child_path(path, "EndToEndId"),
3053 config,
3054 collector,
3055 );
3056 helpers::validate_pattern(
3057 &self.uetr,
3058 "UETR",
3059 "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
3060 &helpers::child_path(path, "UETR"),
3061 config,
3062 collector,
3063 );
3064 }
3065}
3066
3067#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3069pub struct PaymentInstruction301 {
3070 #[serde(rename = "PmtInfId")]
3071 pub pmt_inf_id: String,
3072 #[serde(rename = "PmtMtd")]
3073 pub pmt_mtd: PaymentMethod3Code1,
3074 #[serde(rename = "PmtTpInf", skip_serializing_if = "Option::is_none")]
3075 pub pmt_tp_inf: Option<PaymentTypeInformation261>,
3076 #[serde(rename = "ReqdExctnDt")]
3077 pub reqd_exctn_dt: DateAndDateTime2Choice,
3078 #[serde(rename = "PoolgAdjstmntDt", skip_serializing_if = "Option::is_none")]
3079 pub poolg_adjstmnt_dt: Option<String>,
3080 #[serde(rename = "Dbtr")]
3081 pub dbtr: PartyIdentification1352,
3082 #[serde(rename = "DbtrAcct")]
3083 pub dbtr_acct: CashAccount38,
3084 #[serde(rename = "DbtrAgt")]
3085 pub dbtr_agt: BranchAndFinancialInstitutionIdentification62,
3086 #[serde(rename = "DbtrAgtAcct", skip_serializing_if = "Option::is_none")]
3087 pub dbtr_agt_acct: Option<CashAccount38>,
3088 #[serde(rename = "InstrForDbtrAgt", skip_serializing_if = "Option::is_none")]
3089 pub instr_for_dbtr_agt: Option<String>,
3090 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
3091 pub ultmt_dbtr: Option<PartyIdentification1353>,
3092 #[serde(rename = "ChrgBr", skip_serializing_if = "Option::is_none")]
3093 pub chrg_br: Option<ChargeBearerType1Code1>,
3094 #[serde(rename = "ChrgsAcct", skip_serializing_if = "Option::is_none")]
3095 pub chrgs_acct: Option<CashAccount38>,
3096 #[serde(rename = "ChrgsAcctAgt", skip_serializing_if = "Option::is_none")]
3097 pub chrgs_acct_agt: Option<BranchAndFinancialInstitutionIdentification6>,
3098 #[serde(rename = "CdtTrfTxInf")]
3099 pub cdt_trf_tx_inf: CreditTransferTransaction341,
3100}
3101
3102impl Validate for PaymentInstruction301 {
3103 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3104 helpers::validate_length(
3105 &self.pmt_inf_id,
3106 "PmtInfId",
3107 Some(1),
3108 Some(35),
3109 &helpers::child_path(path, "PmtInfId"),
3110 config,
3111 collector,
3112 );
3113 self.pmt_mtd
3114 .validate(&helpers::child_path(path, "PmtMtd"), config, collector);
3115 if let Some(ref val) = self.pmt_tp_inf
3116 && config.validate_optional_fields
3117 {
3118 val.validate(&helpers::child_path(path, "PmtTpInf"), config, collector);
3119 }
3120 self.reqd_exctn_dt
3121 .validate(&helpers::child_path(path, "ReqdExctnDt"), config, collector);
3122 self.dbtr
3123 .validate(&helpers::child_path(path, "Dbtr"), config, collector);
3124 self.dbtr_acct
3125 .validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
3126 self.dbtr_agt
3127 .validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
3128 if let Some(ref val) = self.dbtr_agt_acct
3129 && config.validate_optional_fields
3130 {
3131 val.validate(&helpers::child_path(path, "DbtrAgtAcct"), config, collector);
3132 }
3133 if let Some(ref val) = self.instr_for_dbtr_agt {
3134 helpers::validate_length(
3135 val,
3136 "InstrForDbtrAgt",
3137 Some(1),
3138 Some(140),
3139 &helpers::child_path(path, "InstrForDbtrAgt"),
3140 config,
3141 collector,
3142 );
3143 }
3144 if let Some(ref val) = self.ultmt_dbtr
3145 && config.validate_optional_fields
3146 {
3147 val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
3148 }
3149 if let Some(ref val) = self.chrg_br
3150 && config.validate_optional_fields
3151 {
3152 val.validate(&helpers::child_path(path, "ChrgBr"), config, collector);
3153 }
3154 if let Some(ref val) = self.chrgs_acct
3155 && config.validate_optional_fields
3156 {
3157 val.validate(&helpers::child_path(path, "ChrgsAcct"), config, collector);
3158 }
3159 if let Some(ref val) = self.chrgs_acct_agt
3160 && config.validate_optional_fields
3161 {
3162 val.validate(
3163 &helpers::child_path(path, "ChrgsAcctAgt"),
3164 config,
3165 collector,
3166 );
3167 }
3168 self.cdt_trf_tx_inf
3169 .validate(&helpers::child_path(path, "CdtTrfTxInf"), config, collector);
3170 }
3171}
3172
3173#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3175pub enum PaymentMethod3Code1 {
3176 #[default]
3177 #[serde(rename = "CHK")]
3178 CodeCHK,
3179 #[serde(rename = "TRF")]
3180 CodeTRF,
3181}
3182
3183impl Validate for PaymentMethod3Code1 {
3184 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3185 }
3187}
3188
3189#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3192pub struct PaymentTypeInformation261 {
3193 #[serde(rename = "InstrPrty", skip_serializing_if = "Option::is_none")]
3194 pub instr_prty: Option<Priority2Code>,
3195 #[serde(rename = "SvcLvl", skip_serializing_if = "Option::is_none")]
3196 pub svc_lvl: Option<Vec<ServiceLevel8Choice>>,
3197 #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3198 pub lcl_instrm: Option<LocalInstrument2Choice>,
3199 #[serde(rename = "CtgyPurp", skip_serializing_if = "Option::is_none")]
3200 pub ctgy_purp: Option<CategoryPurpose1Choice>,
3201}
3202
3203impl Validate for PaymentTypeInformation261 {
3204 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3205 if let Some(ref val) = self.instr_prty
3206 && config.validate_optional_fields
3207 {
3208 val.validate(&helpers::child_path(path, "InstrPrty"), config, collector);
3209 }
3210 if let Some(ref vec) = self.svc_lvl
3211 && config.validate_optional_fields
3212 {
3213 for item in vec {
3214 item.validate(&helpers::child_path(path, "SvcLvl"), config, collector);
3215 }
3216 }
3217 if let Some(ref val) = self.lcl_instrm
3218 && config.validate_optional_fields
3219 {
3220 val.validate(&helpers::child_path(path, "LclInstrm"), config, collector);
3221 }
3222 if let Some(ref val) = self.ctgy_purp
3223 && config.validate_optional_fields
3224 {
3225 val.validate(&helpers::child_path(path, "CtgyPurp"), config, collector);
3226 }
3227 }
3228}
3229
3230#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3232pub struct PersonIdentification131 {
3233 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3234 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
3235 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3236 pub othr: Option<Vec<GenericPersonIdentification1>>,
3237}
3238
3239impl Validate for PersonIdentification131 {
3240 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3241 if let Some(ref val) = self.dt_and_plc_of_birth
3242 && config.validate_optional_fields
3243 {
3244 val.validate(
3245 &helpers::child_path(path, "DtAndPlcOfBirth"),
3246 config,
3247 collector,
3248 );
3249 }
3250 if let Some(ref vec) = self.othr
3251 && config.validate_optional_fields
3252 {
3253 for item in vec {
3254 item.validate(&helpers::child_path(path, "Othr"), config, collector);
3255 }
3256 }
3257 }
3258}
3259
3260#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3262pub struct PersonIdentification132 {
3263 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3264 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
3265 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3266 pub othr: Option<Vec<GenericPersonIdentification11>>,
3267}
3268
3269impl Validate for PersonIdentification132 {
3270 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3271 if let Some(ref val) = self.dt_and_plc_of_birth
3272 && config.validate_optional_fields
3273 {
3274 val.validate(
3275 &helpers::child_path(path, "DtAndPlcOfBirth"),
3276 config,
3277 collector,
3278 );
3279 }
3280 if let Some(ref vec) = self.othr
3281 && config.validate_optional_fields
3282 {
3283 for item in vec {
3284 item.validate(&helpers::child_path(path, "Othr"), config, collector);
3285 }
3286 }
3287 }
3288}
3289
3290#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3292pub struct PersonIdentificationSchemeName1Choice {
3293 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3294 pub cd: Option<String>,
3295 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3296 pub prtry: Option<String>,
3297}
3298
3299impl Validate for PersonIdentificationSchemeName1Choice {
3300 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3301 if let Some(ref val) = self.cd {
3302 helpers::validate_length(
3303 val,
3304 "Cd",
3305 Some(1),
3306 Some(4),
3307 &helpers::child_path(path, "Cd"),
3308 config,
3309 collector,
3310 );
3311 }
3312 if let Some(ref val) = self.prtry {
3313 helpers::validate_length(
3314 val,
3315 "Prtry",
3316 Some(1),
3317 Some(35),
3318 &helpers::child_path(path, "Prtry"),
3319 config,
3320 collector,
3321 );
3322 }
3323 }
3324}
3325
3326#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3328pub struct PersonIdentificationSchemeName1Choice1 {
3329 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3330 pub cd: Option<String>,
3331}
3332
3333impl Validate for PersonIdentificationSchemeName1Choice1 {
3334 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3335 if let Some(ref val) = self.cd {
3336 helpers::validate_length(
3337 val,
3338 "Cd",
3339 Some(1),
3340 Some(4),
3341 &helpers::child_path(path, "Cd"),
3342 config,
3343 collector,
3344 );
3345 }
3346 }
3347}
3348
3349#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3351pub struct PostalAddress24 {
3352 #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
3353 pub adr_tp: Option<AddressType3Choice>,
3354 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
3355 pub dept: Option<String>,
3356 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
3357 pub sub_dept: Option<String>,
3358 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
3359 pub strt_nm: Option<String>,
3360 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
3361 pub bldg_nb: Option<String>,
3362 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
3363 pub bldg_nm: Option<String>,
3364 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
3365 pub flr: Option<String>,
3366 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
3367 pub pst_bx: Option<String>,
3368 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
3369 pub room: Option<String>,
3370 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
3371 pub pst_cd: Option<String>,
3372 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
3373 pub twn_nm: Option<String>,
3374 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
3375 pub twn_lctn_nm: Option<String>,
3376 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
3377 pub dstrct_nm: Option<String>,
3378 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
3379 pub ctry_sub_dvsn: Option<String>,
3380 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
3381 pub ctry: Option<String>,
3382 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
3383 pub adr_line: Option<Vec<String>>,
3384}
3385
3386impl Validate for PostalAddress24 {
3387 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3388 if let Some(ref val) = self.adr_tp
3389 && config.validate_optional_fields
3390 {
3391 val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
3392 }
3393 if let Some(ref val) = self.dept {
3394 helpers::validate_length(
3395 val,
3396 "Dept",
3397 Some(1),
3398 Some(70),
3399 &helpers::child_path(path, "Dept"),
3400 config,
3401 collector,
3402 );
3403 }
3404 if let Some(ref val) = self.sub_dept {
3405 helpers::validate_length(
3406 val,
3407 "SubDept",
3408 Some(1),
3409 Some(70),
3410 &helpers::child_path(path, "SubDept"),
3411 config,
3412 collector,
3413 );
3414 }
3415 if let Some(ref val) = self.strt_nm {
3416 helpers::validate_length(
3417 val,
3418 "StrtNm",
3419 Some(1),
3420 Some(70),
3421 &helpers::child_path(path, "StrtNm"),
3422 config,
3423 collector,
3424 );
3425 }
3426 if let Some(ref val) = self.bldg_nb {
3427 helpers::validate_length(
3428 val,
3429 "BldgNb",
3430 Some(1),
3431 Some(16),
3432 &helpers::child_path(path, "BldgNb"),
3433 config,
3434 collector,
3435 );
3436 }
3437 if let Some(ref val) = self.bldg_nm {
3438 helpers::validate_length(
3439 val,
3440 "BldgNm",
3441 Some(1),
3442 Some(35),
3443 &helpers::child_path(path, "BldgNm"),
3444 config,
3445 collector,
3446 );
3447 }
3448 if let Some(ref val) = self.flr {
3449 helpers::validate_length(
3450 val,
3451 "Flr",
3452 Some(1),
3453 Some(70),
3454 &helpers::child_path(path, "Flr"),
3455 config,
3456 collector,
3457 );
3458 }
3459 if let Some(ref val) = self.pst_bx {
3460 helpers::validate_length(
3461 val,
3462 "PstBx",
3463 Some(1),
3464 Some(16),
3465 &helpers::child_path(path, "PstBx"),
3466 config,
3467 collector,
3468 );
3469 }
3470 if let Some(ref val) = self.room {
3471 helpers::validate_length(
3472 val,
3473 "Room",
3474 Some(1),
3475 Some(70),
3476 &helpers::child_path(path, "Room"),
3477 config,
3478 collector,
3479 );
3480 }
3481 if let Some(ref val) = self.pst_cd {
3482 helpers::validate_length(
3483 val,
3484 "PstCd",
3485 Some(1),
3486 Some(16),
3487 &helpers::child_path(path, "PstCd"),
3488 config,
3489 collector,
3490 );
3491 }
3492 if let Some(ref val) = self.twn_nm {
3493 helpers::validate_length(
3494 val,
3495 "TwnNm",
3496 Some(1),
3497 Some(35),
3498 &helpers::child_path(path, "TwnNm"),
3499 config,
3500 collector,
3501 );
3502 }
3503 if let Some(ref val) = self.twn_lctn_nm {
3504 helpers::validate_length(
3505 val,
3506 "TwnLctnNm",
3507 Some(1),
3508 Some(35),
3509 &helpers::child_path(path, "TwnLctnNm"),
3510 config,
3511 collector,
3512 );
3513 }
3514 if let Some(ref val) = self.dstrct_nm {
3515 helpers::validate_length(
3516 val,
3517 "DstrctNm",
3518 Some(1),
3519 Some(35),
3520 &helpers::child_path(path, "DstrctNm"),
3521 config,
3522 collector,
3523 );
3524 }
3525 if let Some(ref val) = self.ctry_sub_dvsn {
3526 helpers::validate_length(
3527 val,
3528 "CtrySubDvsn",
3529 Some(1),
3530 Some(35),
3531 &helpers::child_path(path, "CtrySubDvsn"),
3532 config,
3533 collector,
3534 );
3535 }
3536 if let Some(ref val) = self.ctry {
3537 helpers::validate_pattern(
3538 val,
3539 "Ctry",
3540 "[A-Z]{2,2}",
3541 &helpers::child_path(path, "Ctry"),
3542 config,
3543 collector,
3544 );
3545 }
3546 if let Some(ref vec) = self.adr_line {
3547 for item in vec {
3548 helpers::validate_length(
3549 item,
3550 "AdrLine",
3551 Some(1),
3552 Some(70),
3553 &helpers::child_path(path, "AdrLine"),
3554 config,
3555 collector,
3556 );
3557 }
3558 }
3559 }
3560}
3561
3562#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3564pub struct PostalAddress241 {
3565 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
3566 pub dept: Option<String>,
3567 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
3568 pub sub_dept: Option<String>,
3569 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
3570 pub strt_nm: Option<String>,
3571 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
3572 pub bldg_nb: Option<String>,
3573 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
3574 pub bldg_nm: Option<String>,
3575 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
3576 pub flr: Option<String>,
3577 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
3578 pub pst_bx: Option<String>,
3579 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
3580 pub room: Option<String>,
3581 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
3582 pub pst_cd: Option<String>,
3583 #[serde(rename = "TwnNm")]
3584 pub twn_nm: String,
3585 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
3586 pub twn_lctn_nm: Option<String>,
3587 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
3588 pub dstrct_nm: Option<String>,
3589 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
3590 pub ctry_sub_dvsn: Option<String>,
3591 #[serde(rename = "Ctry")]
3592 pub ctry: String,
3593 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
3594 pub adr_line: Option<Vec<String>>,
3595}
3596
3597impl Validate for PostalAddress241 {
3598 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3599 if let Some(ref val) = self.dept {
3600 helpers::validate_length(
3601 val,
3602 "Dept",
3603 Some(1),
3604 Some(70),
3605 &helpers::child_path(path, "Dept"),
3606 config,
3607 collector,
3608 );
3609 }
3610 if let Some(ref val) = self.sub_dept {
3611 helpers::validate_length(
3612 val,
3613 "SubDept",
3614 Some(1),
3615 Some(70),
3616 &helpers::child_path(path, "SubDept"),
3617 config,
3618 collector,
3619 );
3620 }
3621 if let Some(ref val) = self.strt_nm {
3622 helpers::validate_length(
3623 val,
3624 "StrtNm",
3625 Some(1),
3626 Some(70),
3627 &helpers::child_path(path, "StrtNm"),
3628 config,
3629 collector,
3630 );
3631 }
3632 if let Some(ref val) = self.bldg_nb {
3633 helpers::validate_length(
3634 val,
3635 "BldgNb",
3636 Some(1),
3637 Some(16),
3638 &helpers::child_path(path, "BldgNb"),
3639 config,
3640 collector,
3641 );
3642 }
3643 if let Some(ref val) = self.bldg_nm {
3644 helpers::validate_length(
3645 val,
3646 "BldgNm",
3647 Some(1),
3648 Some(35),
3649 &helpers::child_path(path, "BldgNm"),
3650 config,
3651 collector,
3652 );
3653 }
3654 if let Some(ref val) = self.flr {
3655 helpers::validate_length(
3656 val,
3657 "Flr",
3658 Some(1),
3659 Some(70),
3660 &helpers::child_path(path, "Flr"),
3661 config,
3662 collector,
3663 );
3664 }
3665 if let Some(ref val) = self.pst_bx {
3666 helpers::validate_length(
3667 val,
3668 "PstBx",
3669 Some(1),
3670 Some(16),
3671 &helpers::child_path(path, "PstBx"),
3672 config,
3673 collector,
3674 );
3675 }
3676 if let Some(ref val) = self.room {
3677 helpers::validate_length(
3678 val,
3679 "Room",
3680 Some(1),
3681 Some(70),
3682 &helpers::child_path(path, "Room"),
3683 config,
3684 collector,
3685 );
3686 }
3687 if let Some(ref val) = self.pst_cd {
3688 helpers::validate_length(
3689 val,
3690 "PstCd",
3691 Some(1),
3692 Some(16),
3693 &helpers::child_path(path, "PstCd"),
3694 config,
3695 collector,
3696 );
3697 }
3698 helpers::validate_length(
3699 &self.twn_nm,
3700 "TwnNm",
3701 Some(1),
3702 Some(35),
3703 &helpers::child_path(path, "TwnNm"),
3704 config,
3705 collector,
3706 );
3707 if let Some(ref val) = self.twn_lctn_nm {
3708 helpers::validate_length(
3709 val,
3710 "TwnLctnNm",
3711 Some(1),
3712 Some(35),
3713 &helpers::child_path(path, "TwnLctnNm"),
3714 config,
3715 collector,
3716 );
3717 }
3718 if let Some(ref val) = self.dstrct_nm {
3719 helpers::validate_length(
3720 val,
3721 "DstrctNm",
3722 Some(1),
3723 Some(35),
3724 &helpers::child_path(path, "DstrctNm"),
3725 config,
3726 collector,
3727 );
3728 }
3729 if let Some(ref val) = self.ctry_sub_dvsn {
3730 helpers::validate_length(
3731 val,
3732 "CtrySubDvsn",
3733 Some(1),
3734 Some(35),
3735 &helpers::child_path(path, "CtrySubDvsn"),
3736 config,
3737 collector,
3738 );
3739 }
3740 helpers::validate_pattern(
3741 &self.ctry,
3742 "Ctry",
3743 "[A-Z]{2,2}",
3744 &helpers::child_path(path, "Ctry"),
3745 config,
3746 collector,
3747 );
3748 if let Some(ref vec) = self.adr_line {
3749 for item in vec {
3750 helpers::validate_length(
3751 item,
3752 "AdrLine",
3753 Some(1),
3754 Some(70),
3755 &helpers::child_path(path, "AdrLine"),
3756 config,
3757 collector,
3758 );
3759 }
3760 }
3761 }
3762}
3763
3764#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3766pub struct PostalAddress242 {
3767 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
3768 pub dept: Option<String>,
3769 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
3770 pub sub_dept: Option<String>,
3771 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
3772 pub strt_nm: Option<String>,
3773 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
3774 pub bldg_nb: Option<String>,
3775 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
3776 pub bldg_nm: Option<String>,
3777 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
3778 pub flr: Option<String>,
3779 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
3780 pub pst_bx: Option<String>,
3781 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
3782 pub room: Option<String>,
3783 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
3784 pub pst_cd: Option<String>,
3785 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
3786 pub twn_nm: Option<String>,
3787 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
3788 pub twn_lctn_nm: Option<String>,
3789 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
3790 pub dstrct_nm: Option<String>,
3791 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
3792 pub ctry_sub_dvsn: Option<String>,
3793 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
3794 pub ctry: Option<String>,
3795 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
3796 pub adr_line: Option<Vec<String>>,
3797}
3798
3799impl Validate for PostalAddress242 {
3800 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3801 if let Some(ref val) = self.dept {
3802 helpers::validate_length(
3803 val,
3804 "Dept",
3805 Some(1),
3806 Some(70),
3807 &helpers::child_path(path, "Dept"),
3808 config,
3809 collector,
3810 );
3811 }
3812 if let Some(ref val) = self.sub_dept {
3813 helpers::validate_length(
3814 val,
3815 "SubDept",
3816 Some(1),
3817 Some(70),
3818 &helpers::child_path(path, "SubDept"),
3819 config,
3820 collector,
3821 );
3822 }
3823 if let Some(ref val) = self.strt_nm {
3824 helpers::validate_length(
3825 val,
3826 "StrtNm",
3827 Some(1),
3828 Some(70),
3829 &helpers::child_path(path, "StrtNm"),
3830 config,
3831 collector,
3832 );
3833 }
3834 if let Some(ref val) = self.bldg_nb {
3835 helpers::validate_length(
3836 val,
3837 "BldgNb",
3838 Some(1),
3839 Some(16),
3840 &helpers::child_path(path, "BldgNb"),
3841 config,
3842 collector,
3843 );
3844 }
3845 if let Some(ref val) = self.bldg_nm {
3846 helpers::validate_length(
3847 val,
3848 "BldgNm",
3849 Some(1),
3850 Some(35),
3851 &helpers::child_path(path, "BldgNm"),
3852 config,
3853 collector,
3854 );
3855 }
3856 if let Some(ref val) = self.flr {
3857 helpers::validate_length(
3858 val,
3859 "Flr",
3860 Some(1),
3861 Some(70),
3862 &helpers::child_path(path, "Flr"),
3863 config,
3864 collector,
3865 );
3866 }
3867 if let Some(ref val) = self.pst_bx {
3868 helpers::validate_length(
3869 val,
3870 "PstBx",
3871 Some(1),
3872 Some(16),
3873 &helpers::child_path(path, "PstBx"),
3874 config,
3875 collector,
3876 );
3877 }
3878 if let Some(ref val) = self.room {
3879 helpers::validate_length(
3880 val,
3881 "Room",
3882 Some(1),
3883 Some(70),
3884 &helpers::child_path(path, "Room"),
3885 config,
3886 collector,
3887 );
3888 }
3889 if let Some(ref val) = self.pst_cd {
3890 helpers::validate_length(
3891 val,
3892 "PstCd",
3893 Some(1),
3894 Some(16),
3895 &helpers::child_path(path, "PstCd"),
3896 config,
3897 collector,
3898 );
3899 }
3900 if let Some(ref val) = self.twn_nm {
3901 helpers::validate_length(
3902 val,
3903 "TwnNm",
3904 Some(1),
3905 Some(35),
3906 &helpers::child_path(path, "TwnNm"),
3907 config,
3908 collector,
3909 );
3910 }
3911 if let Some(ref val) = self.twn_lctn_nm {
3912 helpers::validate_length(
3913 val,
3914 "TwnLctnNm",
3915 Some(1),
3916 Some(35),
3917 &helpers::child_path(path, "TwnLctnNm"),
3918 config,
3919 collector,
3920 );
3921 }
3922 if let Some(ref val) = self.dstrct_nm {
3923 helpers::validate_length(
3924 val,
3925 "DstrctNm",
3926 Some(1),
3927 Some(35),
3928 &helpers::child_path(path, "DstrctNm"),
3929 config,
3930 collector,
3931 );
3932 }
3933 if let Some(ref val) = self.ctry_sub_dvsn {
3934 helpers::validate_length(
3935 val,
3936 "CtrySubDvsn",
3937 Some(1),
3938 Some(35),
3939 &helpers::child_path(path, "CtrySubDvsn"),
3940 config,
3941 collector,
3942 );
3943 }
3944 if let Some(ref val) = self.ctry {
3945 helpers::validate_pattern(
3946 val,
3947 "Ctry",
3948 "[A-Z]{2,2}",
3949 &helpers::child_path(path, "Ctry"),
3950 config,
3951 collector,
3952 );
3953 }
3954 if let Some(ref vec) = self.adr_line {
3955 for item in vec {
3956 helpers::validate_length(
3957 item,
3958 "AdrLine",
3959 Some(1),
3960 Some(70),
3961 &helpers::child_path(path, "AdrLine"),
3962 config,
3963 collector,
3964 );
3965 }
3966 }
3967 }
3968}
3969
3970#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3972pub enum PreferredContactMethod1Code {
3973 #[default]
3974 #[serde(rename = "LETT")]
3975 CodeLETT,
3976 #[serde(rename = "MAIL")]
3977 CodeMAIL,
3978 #[serde(rename = "PHON")]
3979 CodePHON,
3980 #[serde(rename = "FAXX")]
3981 CodeFAXX,
3982 #[serde(rename = "CELL")]
3983 CodeCELL,
3984}
3985
3986impl Validate for PreferredContactMethod1Code {
3987 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3988 }
3990}
3991
3992#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3994pub enum Priority2Code {
3995 #[default]
3996 #[serde(rename = "HIGH")]
3997 CodeHIGH,
3998 #[serde(rename = "NORM")]
3999 CodeNORM,
4000}
4001
4002impl Validate for Priority2Code {
4003 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
4004 }
4006}
4007
4008#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4010pub struct ProxyAccountIdentification1 {
4011 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4012 pub tp: Option<ProxyAccountType1Choice>,
4013 #[serde(rename = "Id")]
4014 pub id: String,
4015}
4016
4017impl Validate for ProxyAccountIdentification1 {
4018 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4019 if let Some(ref val) = self.tp
4020 && config.validate_optional_fields
4021 {
4022 val.validate(&helpers::child_path(path, "Tp"), config, collector);
4023 }
4024 helpers::validate_length(
4025 &self.id,
4026 "Id",
4027 Some(1),
4028 Some(2048),
4029 &helpers::child_path(path, "Id"),
4030 config,
4031 collector,
4032 );
4033 }
4034}
4035
4036#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4038pub struct ProxyAccountType1Choice {
4039 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4040 pub cd: Option<String>,
4041 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4042 pub prtry: Option<String>,
4043}
4044
4045impl Validate for ProxyAccountType1Choice {
4046 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4047 if let Some(ref val) = self.cd {
4048 helpers::validate_length(
4049 val,
4050 "Cd",
4051 Some(1),
4052 Some(4),
4053 &helpers::child_path(path, "Cd"),
4054 config,
4055 collector,
4056 );
4057 }
4058 if let Some(ref val) = self.prtry {
4059 helpers::validate_length(
4060 val,
4061 "Prtry",
4062 Some(1),
4063 Some(35),
4064 &helpers::child_path(path, "Prtry"),
4065 config,
4066 collector,
4067 );
4068 }
4069 }
4070}
4071
4072#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4074pub struct Purpose2Choice {
4075 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4076 pub cd: Option<String>,
4077 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4078 pub prtry: Option<String>,
4079}
4080
4081impl Validate for Purpose2Choice {
4082 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4083 if let Some(ref val) = self.cd {
4084 helpers::validate_length(
4085 val,
4086 "Cd",
4087 Some(1),
4088 Some(4),
4089 &helpers::child_path(path, "Cd"),
4090 config,
4091 collector,
4092 );
4093 }
4094 if let Some(ref val) = self.prtry {
4095 helpers::validate_length(
4096 val,
4097 "Prtry",
4098 Some(1),
4099 Some(35),
4100 &helpers::child_path(path, "Prtry"),
4101 config,
4102 collector,
4103 );
4104 }
4105 }
4106}
4107
4108#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4110pub struct ReferredDocumentInformation7 {
4111 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4112 pub tp: Option<ReferredDocumentType4>,
4113 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
4114 pub nb: Option<String>,
4115 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
4116 pub rltd_dt: Option<String>,
4117 #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
4118 pub line_dtls: Option<Vec<DocumentLineInformation1>>,
4119}
4120
4121impl Validate for ReferredDocumentInformation7 {
4122 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4123 if let Some(ref val) = self.tp
4124 && config.validate_optional_fields
4125 {
4126 val.validate(&helpers::child_path(path, "Tp"), config, collector);
4127 }
4128 if let Some(ref val) = self.nb {
4129 helpers::validate_length(
4130 val,
4131 "Nb",
4132 Some(1),
4133 Some(35),
4134 &helpers::child_path(path, "Nb"),
4135 config,
4136 collector,
4137 );
4138 }
4139 if let Some(ref vec) = self.line_dtls
4140 && config.validate_optional_fields
4141 {
4142 for item in vec {
4143 item.validate(&helpers::child_path(path, "LineDtls"), config, collector);
4144 }
4145 }
4146 }
4147}
4148
4149#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4151pub struct ReferredDocumentType3Choice {
4152 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4153 pub cd: Option<DocumentType6Code>,
4154 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4155 pub prtry: Option<String>,
4156}
4157
4158impl Validate for ReferredDocumentType3Choice {
4159 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4160 if let Some(ref val) = self.cd
4161 && config.validate_optional_fields
4162 {
4163 val.validate(&helpers::child_path(path, "Cd"), config, collector);
4164 }
4165 if let Some(ref val) = self.prtry {
4166 helpers::validate_length(
4167 val,
4168 "Prtry",
4169 Some(1),
4170 Some(35),
4171 &helpers::child_path(path, "Prtry"),
4172 config,
4173 collector,
4174 );
4175 }
4176 }
4177}
4178
4179#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4181pub struct ReferredDocumentType4 {
4182 #[serde(rename = "CdOrPrtry")]
4183 pub cd_or_prtry: ReferredDocumentType3Choice,
4184 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4185 pub issr: Option<String>,
4186}
4187
4188impl Validate for ReferredDocumentType4 {
4189 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4190 self.cd_or_prtry
4191 .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
4192 if let Some(ref val) = self.issr {
4193 helpers::validate_length(
4194 val,
4195 "Issr",
4196 Some(1),
4197 Some(35),
4198 &helpers::child_path(path, "Issr"),
4199 config,
4200 collector,
4201 );
4202 }
4203 }
4204}
4205
4206#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4208pub struct RegulatoryAuthority2 {
4209 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4210 pub nm: Option<String>,
4211 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
4212 pub ctry: Option<String>,
4213}
4214
4215impl Validate for RegulatoryAuthority2 {
4216 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4217 if let Some(ref val) = self.nm {
4218 helpers::validate_length(
4219 val,
4220 "Nm",
4221 Some(1),
4222 Some(140),
4223 &helpers::child_path(path, "Nm"),
4224 config,
4225 collector,
4226 );
4227 }
4228 if let Some(ref val) = self.ctry {
4229 helpers::validate_pattern(
4230 val,
4231 "Ctry",
4232 "[A-Z]{2,2}",
4233 &helpers::child_path(path, "Ctry"),
4234 config,
4235 collector,
4236 );
4237 }
4238 }
4239}
4240
4241#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4243pub struct RegulatoryReporting3 {
4244 #[serde(rename = "DbtCdtRptgInd", skip_serializing_if = "Option::is_none")]
4245 pub dbt_cdt_rptg_ind: Option<RegulatoryReportingType1Code>,
4246 #[serde(rename = "Authrty", skip_serializing_if = "Option::is_none")]
4247 pub authrty: Option<RegulatoryAuthority2>,
4248 #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
4249 pub dtls: Option<Vec<StructuredRegulatoryReporting3>>,
4250}
4251
4252impl Validate for RegulatoryReporting3 {
4253 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4254 if let Some(ref val) = self.dbt_cdt_rptg_ind
4255 && config.validate_optional_fields
4256 {
4257 val.validate(
4258 &helpers::child_path(path, "DbtCdtRptgInd"),
4259 config,
4260 collector,
4261 );
4262 }
4263 if let Some(ref val) = self.authrty
4264 && config.validate_optional_fields
4265 {
4266 val.validate(&helpers::child_path(path, "Authrty"), config, collector);
4267 }
4268 if let Some(ref vec) = self.dtls
4269 && config.validate_optional_fields
4270 {
4271 for item in vec {
4272 item.validate(&helpers::child_path(path, "Dtls"), config, collector);
4273 }
4274 }
4275 }
4276}
4277
4278#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4280pub enum RegulatoryReportingType1Code {
4281 #[default]
4282 #[serde(rename = "CRED")]
4283 CodeCRED,
4284 #[serde(rename = "DEBT")]
4285 CodeDEBT,
4286 #[serde(rename = "BOTH")]
4287 CodeBOTH,
4288}
4289
4290impl Validate for RegulatoryReportingType1Code {
4291 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
4292 }
4294}
4295
4296#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4298pub struct RemittanceAmount2 {
4299 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
4300 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4301 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
4302 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
4303 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
4304 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4305 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
4306 pub tax_amt: Option<Vec<TaxAmountAndType1>>,
4307 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
4308 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment1>>,
4309 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4310 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4311}
4312
4313impl Validate for RemittanceAmount2 {
4314 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4315 if let Some(ref val) = self.due_pybl_amt
4316 && config.validate_optional_fields
4317 {
4318 val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
4319 }
4320 if let Some(ref vec) = self.dscnt_apld_amt
4321 && config.validate_optional_fields
4322 {
4323 for item in vec {
4324 item.validate(
4325 &helpers::child_path(path, "DscntApldAmt"),
4326 config,
4327 collector,
4328 );
4329 }
4330 }
4331 if let Some(ref val) = self.cdt_note_amt
4332 && config.validate_optional_fields
4333 {
4334 val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
4335 }
4336 if let Some(ref vec) = self.tax_amt
4337 && config.validate_optional_fields
4338 {
4339 for item in vec {
4340 item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
4341 }
4342 }
4343 if let Some(ref vec) = self.adjstmnt_amt_and_rsn
4344 && config.validate_optional_fields
4345 {
4346 for item in vec {
4347 item.validate(
4348 &helpers::child_path(path, "AdjstmntAmtAndRsn"),
4349 config,
4350 collector,
4351 );
4352 }
4353 }
4354 if let Some(ref val) = self.rmtd_amt
4355 && config.validate_optional_fields
4356 {
4357 val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
4358 }
4359 }
4360}
4361
4362#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4364pub struct RemittanceAmount3 {
4365 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
4366 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4367 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
4368 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
4369 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
4370 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4371 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
4372 pub tax_amt: Option<Vec<TaxAmountAndType1>>,
4373 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
4374 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment1>>,
4375 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4376 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4377}
4378
4379impl Validate for RemittanceAmount3 {
4380 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4381 if let Some(ref val) = self.due_pybl_amt
4382 && config.validate_optional_fields
4383 {
4384 val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
4385 }
4386 if let Some(ref vec) = self.dscnt_apld_amt
4387 && config.validate_optional_fields
4388 {
4389 for item in vec {
4390 item.validate(
4391 &helpers::child_path(path, "DscntApldAmt"),
4392 config,
4393 collector,
4394 );
4395 }
4396 }
4397 if let Some(ref val) = self.cdt_note_amt
4398 && config.validate_optional_fields
4399 {
4400 val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
4401 }
4402 if let Some(ref vec) = self.tax_amt
4403 && config.validate_optional_fields
4404 {
4405 for item in vec {
4406 item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
4407 }
4408 }
4409 if let Some(ref vec) = self.adjstmnt_amt_and_rsn
4410 && config.validate_optional_fields
4411 {
4412 for item in vec {
4413 item.validate(
4414 &helpers::child_path(path, "AdjstmntAmtAndRsn"),
4415 config,
4416 collector,
4417 );
4418 }
4419 }
4420 if let Some(ref val) = self.rmtd_amt
4421 && config.validate_optional_fields
4422 {
4423 val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
4424 }
4425 }
4426}
4427
4428#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4430pub struct RemittanceInformation161 {
4431 #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
4432 pub ustrd: Option<String>,
4433 #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
4434 pub strd: Option<Vec<StructuredRemittanceInformation161>>,
4435}
4436
4437impl Validate for RemittanceInformation161 {
4438 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4439 if let Some(ref val) = self.ustrd {
4440 helpers::validate_length(
4441 val,
4442 "Ustrd",
4443 Some(1),
4444 Some(140),
4445 &helpers::child_path(path, "Ustrd"),
4446 config,
4447 collector,
4448 );
4449 }
4450 if let Some(ref vec) = self.strd
4451 && config.validate_optional_fields
4452 {
4453 for item in vec {
4454 item.validate(&helpers::child_path(path, "Strd"), config, collector);
4455 }
4456 }
4457 }
4458}
4459
4460#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4462pub struct RemittanceLocation71 {
4463 #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
4464 pub rmt_id: Option<String>,
4465 #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
4466 pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
4467}
4468
4469impl Validate for RemittanceLocation71 {
4470 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4471 if let Some(ref val) = self.rmt_id {
4472 helpers::validate_length(
4473 val,
4474 "RmtId",
4475 Some(1),
4476 Some(35),
4477 &helpers::child_path(path, "RmtId"),
4478 config,
4479 collector,
4480 );
4481 }
4482 if let Some(ref vec) = self.rmt_lctn_dtls
4483 && config.validate_optional_fields
4484 {
4485 for item in vec {
4486 item.validate(&helpers::child_path(path, "RmtLctnDtls"), config, collector);
4487 }
4488 }
4489 }
4490}
4491
4492#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4494pub struct RemittanceLocationData11 {
4495 #[serde(rename = "Mtd")]
4496 pub mtd: RemittanceLocationMethod2Code,
4497 #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
4498 pub elctrnc_adr: Option<String>,
4499 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4500 pub pstl_adr: Option<NameAndAddress161>,
4501}
4502
4503impl Validate for RemittanceLocationData11 {
4504 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4505 self.mtd
4506 .validate(&helpers::child_path(path, "Mtd"), config, collector);
4507 if let Some(ref val) = self.elctrnc_adr {
4508 helpers::validate_length(
4509 val,
4510 "ElctrncAdr",
4511 Some(1),
4512 Some(2048),
4513 &helpers::child_path(path, "ElctrncAdr"),
4514 config,
4515 collector,
4516 );
4517 }
4518 if let Some(ref val) = self.pstl_adr
4519 && config.validate_optional_fields
4520 {
4521 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4522 }
4523 }
4524}
4525
4526#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4528pub enum RemittanceLocationMethod2Code {
4529 #[default]
4530 #[serde(rename = "FAXI")]
4531 CodeFAXI,
4532 #[serde(rename = "EDIC")]
4533 CodeEDIC,
4534 #[serde(rename = "URID")]
4535 CodeURID,
4536 #[serde(rename = "EMAL")]
4537 CodeEMAL,
4538 #[serde(rename = "POST")]
4539 CodePOST,
4540 #[serde(rename = "SMSM")]
4541 CodeSMSM,
4542}
4543
4544impl Validate for RemittanceLocationMethod2Code {
4545 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
4546 }
4548}
4549
4550#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4552pub struct ServiceLevel8Choice {
4553 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4554 pub cd: Option<String>,
4555 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4556 pub prtry: Option<String>,
4557}
4558
4559impl Validate for ServiceLevel8Choice {
4560 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4561 if let Some(ref val) = self.cd {
4562 helpers::validate_length(
4563 val,
4564 "Cd",
4565 Some(1),
4566 Some(4),
4567 &helpers::child_path(path, "Cd"),
4568 config,
4569 collector,
4570 );
4571 }
4572 if let Some(ref val) = self.prtry {
4573 helpers::validate_length(
4574 val,
4575 "Prtry",
4576 Some(1),
4577 Some(35),
4578 &helpers::child_path(path, "Prtry"),
4579 config,
4580 collector,
4581 );
4582 }
4583 }
4584}
4585
4586#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4588pub struct StructuredRegulatoryReporting3 {
4589 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4590 pub tp: Option<String>,
4591 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4592 pub dt: Option<String>,
4593 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
4594 pub ctry: Option<String>,
4595 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4596 pub cd: Option<String>,
4597 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
4598 pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4599 #[serde(rename = "Inf", skip_serializing_if = "Option::is_none")]
4600 pub inf: Option<Vec<String>>,
4601}
4602
4603impl Validate for StructuredRegulatoryReporting3 {
4604 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4605 if let Some(ref val) = self.tp {
4606 helpers::validate_length(
4607 val,
4608 "Tp",
4609 Some(1),
4610 Some(35),
4611 &helpers::child_path(path, "Tp"),
4612 config,
4613 collector,
4614 );
4615 }
4616 if let Some(ref val) = self.ctry {
4617 helpers::validate_pattern(
4618 val,
4619 "Ctry",
4620 "[A-Z]{2,2}",
4621 &helpers::child_path(path, "Ctry"),
4622 config,
4623 collector,
4624 );
4625 }
4626 if let Some(ref val) = self.cd {
4627 helpers::validate_length(
4628 val,
4629 "Cd",
4630 Some(1),
4631 Some(10),
4632 &helpers::child_path(path, "Cd"),
4633 config,
4634 collector,
4635 );
4636 }
4637 if let Some(ref val) = self.amt
4638 && config.validate_optional_fields
4639 {
4640 val.validate(&helpers::child_path(path, "Amt"), config, collector);
4641 }
4642 if let Some(ref vec) = self.inf {
4643 for item in vec {
4644 helpers::validate_length(
4645 item,
4646 "Inf",
4647 Some(1),
4648 Some(35),
4649 &helpers::child_path(path, "Inf"),
4650 config,
4651 collector,
4652 );
4653 }
4654 }
4655 }
4656}
4657
4658#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4660pub struct StructuredRemittanceInformation161 {
4661 #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
4662 pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation7>>,
4663 #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
4664 pub rfrd_doc_amt: Option<RemittanceAmount2>,
4665 #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
4666 pub cdtr_ref_inf: Option<CreditorReferenceInformation2>,
4667 #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
4668 pub invcr: Option<PartyIdentification1353>,
4669 #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
4670 pub invcee: Option<PartyIdentification1353>,
4671 #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
4672 pub tax_rmt: Option<TaxInformation7>,
4673 #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
4674 pub grnshmt_rmt: Option<Garnishment31>,
4675 #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
4676 pub addtl_rmt_inf: Option<Vec<String>>,
4677}
4678
4679impl Validate for StructuredRemittanceInformation161 {
4680 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4681 if let Some(ref vec) = self.rfrd_doc_inf
4682 && config.validate_optional_fields
4683 {
4684 for item in vec {
4685 item.validate(&helpers::child_path(path, "RfrdDocInf"), config, collector);
4686 }
4687 }
4688 if let Some(ref val) = self.rfrd_doc_amt
4689 && config.validate_optional_fields
4690 {
4691 val.validate(&helpers::child_path(path, "RfrdDocAmt"), config, collector);
4692 }
4693 if let Some(ref val) = self.cdtr_ref_inf
4694 && config.validate_optional_fields
4695 {
4696 val.validate(&helpers::child_path(path, "CdtrRefInf"), config, collector);
4697 }
4698 if let Some(ref val) = self.invcr
4699 && config.validate_optional_fields
4700 {
4701 val.validate(&helpers::child_path(path, "Invcr"), config, collector);
4702 }
4703 if let Some(ref val) = self.invcee
4704 && config.validate_optional_fields
4705 {
4706 val.validate(&helpers::child_path(path, "Invcee"), config, collector);
4707 }
4708 if let Some(ref val) = self.tax_rmt
4709 && config.validate_optional_fields
4710 {
4711 val.validate(&helpers::child_path(path, "TaxRmt"), config, collector);
4712 }
4713 if let Some(ref val) = self.grnshmt_rmt
4714 && config.validate_optional_fields
4715 {
4716 val.validate(&helpers::child_path(path, "GrnshmtRmt"), config, collector);
4717 }
4718 if let Some(ref vec) = self.addtl_rmt_inf {
4719 for item in vec {
4720 helpers::validate_length(
4721 item,
4722 "AddtlRmtInf",
4723 Some(1),
4724 Some(140),
4725 &helpers::child_path(path, "AddtlRmtInf"),
4726 config,
4727 collector,
4728 );
4729 }
4730 }
4731 }
4732}
4733
4734#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4736pub struct TaxAmount2 {
4737 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
4738 pub rate: Option<f64>,
4739 #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
4740 pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4741 #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
4742 pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4743 #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
4744 pub dtls: Option<Vec<TaxRecordDetails2>>,
4745}
4746
4747impl Validate for TaxAmount2 {
4748 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4749 if let Some(ref val) = self.taxbl_base_amt
4750 && config.validate_optional_fields
4751 {
4752 val.validate(
4753 &helpers::child_path(path, "TaxblBaseAmt"),
4754 config,
4755 collector,
4756 );
4757 }
4758 if let Some(ref val) = self.ttl_amt
4759 && config.validate_optional_fields
4760 {
4761 val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
4762 }
4763 if let Some(ref vec) = self.dtls
4764 && config.validate_optional_fields
4765 {
4766 for item in vec {
4767 item.validate(&helpers::child_path(path, "Dtls"), config, collector);
4768 }
4769 }
4770 }
4771}
4772
4773#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4775pub struct TaxAmountAndType1 {
4776 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4777 pub tp: Option<TaxAmountType1Choice>,
4778 #[serde(rename = "Amt")]
4779 pub amt: ActiveOrHistoricCurrencyAndAmount,
4780}
4781
4782impl Validate for TaxAmountAndType1 {
4783 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4784 if let Some(ref val) = self.tp
4785 && config.validate_optional_fields
4786 {
4787 val.validate(&helpers::child_path(path, "Tp"), config, collector);
4788 }
4789 self.amt
4790 .validate(&helpers::child_path(path, "Amt"), config, collector);
4791 }
4792}
4793
4794#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4796pub struct TaxAmountType1Choice {
4797 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4798 pub cd: Option<String>,
4799 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4800 pub prtry: Option<String>,
4801}
4802
4803impl Validate for TaxAmountType1Choice {
4804 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4805 if let Some(ref val) = self.cd {
4806 helpers::validate_length(
4807 val,
4808 "Cd",
4809 Some(1),
4810 Some(4),
4811 &helpers::child_path(path, "Cd"),
4812 config,
4813 collector,
4814 );
4815 }
4816 if let Some(ref val) = self.prtry {
4817 helpers::validate_length(
4818 val,
4819 "Prtry",
4820 Some(1),
4821 Some(35),
4822 &helpers::child_path(path, "Prtry"),
4823 config,
4824 collector,
4825 );
4826 }
4827 }
4828}
4829
4830#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4832pub struct TaxAuthorisation1 {
4833 #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
4834 pub titl: Option<String>,
4835 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4836 pub nm: Option<String>,
4837}
4838
4839impl Validate for TaxAuthorisation1 {
4840 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4841 if let Some(ref val) = self.titl {
4842 helpers::validate_length(
4843 val,
4844 "Titl",
4845 Some(1),
4846 Some(35),
4847 &helpers::child_path(path, "Titl"),
4848 config,
4849 collector,
4850 );
4851 }
4852 if let Some(ref val) = self.nm {
4853 helpers::validate_length(
4854 val,
4855 "Nm",
4856 Some(1),
4857 Some(140),
4858 &helpers::child_path(path, "Nm"),
4859 config,
4860 collector,
4861 );
4862 }
4863 }
4864}
4865
4866#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4868pub struct TaxInformation7 {
4869 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
4870 pub cdtr: Option<TaxParty1>,
4871 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
4872 pub dbtr: Option<TaxParty2>,
4873 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
4874 pub ultmt_dbtr: Option<TaxParty2>,
4875 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
4876 pub admstn_zone: Option<String>,
4877 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4878 pub ref_nb: Option<String>,
4879 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
4880 pub mtd: Option<String>,
4881 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
4882 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4883 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
4884 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4885 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4886 pub dt: Option<String>,
4887 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
4888 pub seq_nb: Option<f64>,
4889 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
4890 pub rcrd: Option<Vec<TaxRecord2>>,
4891}
4892
4893impl Validate for TaxInformation7 {
4894 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4895 if let Some(ref val) = self.cdtr
4896 && config.validate_optional_fields
4897 {
4898 val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
4899 }
4900 if let Some(ref val) = self.dbtr
4901 && config.validate_optional_fields
4902 {
4903 val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
4904 }
4905 if let Some(ref val) = self.ultmt_dbtr
4906 && config.validate_optional_fields
4907 {
4908 val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
4909 }
4910 if let Some(ref val) = self.admstn_zone {
4911 helpers::validate_length(
4912 val,
4913 "AdmstnZone",
4914 Some(1),
4915 Some(35),
4916 &helpers::child_path(path, "AdmstnZone"),
4917 config,
4918 collector,
4919 );
4920 }
4921 if let Some(ref val) = self.ref_nb {
4922 helpers::validate_length(
4923 val,
4924 "RefNb",
4925 Some(1),
4926 Some(140),
4927 &helpers::child_path(path, "RefNb"),
4928 config,
4929 collector,
4930 );
4931 }
4932 if let Some(ref val) = self.mtd {
4933 helpers::validate_length(
4934 val,
4935 "Mtd",
4936 Some(1),
4937 Some(35),
4938 &helpers::child_path(path, "Mtd"),
4939 config,
4940 collector,
4941 );
4942 }
4943 if let Some(ref val) = self.ttl_taxbl_base_amt
4944 && config.validate_optional_fields
4945 {
4946 val.validate(
4947 &helpers::child_path(path, "TtlTaxblBaseAmt"),
4948 config,
4949 collector,
4950 );
4951 }
4952 if let Some(ref val) = self.ttl_tax_amt
4953 && config.validate_optional_fields
4954 {
4955 val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
4956 }
4957 if let Some(ref vec) = self.rcrd
4958 && config.validate_optional_fields
4959 {
4960 for item in vec {
4961 item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
4962 }
4963 }
4964 }
4965}
4966
4967#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4969pub struct TaxInformation8 {
4970 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
4971 pub cdtr: Option<TaxParty1>,
4972 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
4973 pub dbtr: Option<TaxParty2>,
4974 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
4975 pub admstn_zone: Option<String>,
4976 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4977 pub ref_nb: Option<String>,
4978 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
4979 pub mtd: Option<String>,
4980 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
4981 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4982 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
4983 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4984 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4985 pub dt: Option<String>,
4986 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
4987 pub seq_nb: Option<f64>,
4988 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
4989 pub rcrd: Option<Vec<TaxRecord2>>,
4990}
4991
4992impl Validate for TaxInformation8 {
4993 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4994 if let Some(ref val) = self.cdtr
4995 && config.validate_optional_fields
4996 {
4997 val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
4998 }
4999 if let Some(ref val) = self.dbtr
5000 && config.validate_optional_fields
5001 {
5002 val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
5003 }
5004 if let Some(ref val) = self.admstn_zone {
5005 helpers::validate_length(
5006 val,
5007 "AdmstnZone",
5008 Some(1),
5009 Some(35),
5010 &helpers::child_path(path, "AdmstnZone"),
5011 config,
5012 collector,
5013 );
5014 }
5015 if let Some(ref val) = self.ref_nb {
5016 helpers::validate_length(
5017 val,
5018 "RefNb",
5019 Some(1),
5020 Some(140),
5021 &helpers::child_path(path, "RefNb"),
5022 config,
5023 collector,
5024 );
5025 }
5026 if let Some(ref val) = self.mtd {
5027 helpers::validate_length(
5028 val,
5029 "Mtd",
5030 Some(1),
5031 Some(35),
5032 &helpers::child_path(path, "Mtd"),
5033 config,
5034 collector,
5035 );
5036 }
5037 if let Some(ref val) = self.ttl_taxbl_base_amt
5038 && config.validate_optional_fields
5039 {
5040 val.validate(
5041 &helpers::child_path(path, "TtlTaxblBaseAmt"),
5042 config,
5043 collector,
5044 );
5045 }
5046 if let Some(ref val) = self.ttl_tax_amt
5047 && config.validate_optional_fields
5048 {
5049 val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
5050 }
5051 if let Some(ref vec) = self.rcrd
5052 && config.validate_optional_fields
5053 {
5054 for item in vec {
5055 item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
5056 }
5057 }
5058 }
5059}
5060
5061#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5063pub struct TaxParty1 {
5064 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
5065 pub tax_id: Option<String>,
5066 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
5067 pub regn_id: Option<String>,
5068 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
5069 pub tax_tp: Option<String>,
5070}
5071
5072impl Validate for TaxParty1 {
5073 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5074 if let Some(ref val) = self.tax_id {
5075 helpers::validate_length(
5076 val,
5077 "TaxId",
5078 Some(1),
5079 Some(35),
5080 &helpers::child_path(path, "TaxId"),
5081 config,
5082 collector,
5083 );
5084 }
5085 if let Some(ref val) = self.regn_id {
5086 helpers::validate_length(
5087 val,
5088 "RegnId",
5089 Some(1),
5090 Some(35),
5091 &helpers::child_path(path, "RegnId"),
5092 config,
5093 collector,
5094 );
5095 }
5096 if let Some(ref val) = self.tax_tp {
5097 helpers::validate_length(
5098 val,
5099 "TaxTp",
5100 Some(1),
5101 Some(35),
5102 &helpers::child_path(path, "TaxTp"),
5103 config,
5104 collector,
5105 );
5106 }
5107 }
5108}
5109
5110#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5112pub struct TaxParty2 {
5113 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
5114 pub tax_id: Option<String>,
5115 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
5116 pub regn_id: Option<String>,
5117 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
5118 pub tax_tp: Option<String>,
5119 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
5120 pub authstn: Option<TaxAuthorisation1>,
5121}
5122
5123impl Validate for TaxParty2 {
5124 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5125 if let Some(ref val) = self.tax_id {
5126 helpers::validate_length(
5127 val,
5128 "TaxId",
5129 Some(1),
5130 Some(35),
5131 &helpers::child_path(path, "TaxId"),
5132 config,
5133 collector,
5134 );
5135 }
5136 if let Some(ref val) = self.regn_id {
5137 helpers::validate_length(
5138 val,
5139 "RegnId",
5140 Some(1),
5141 Some(35),
5142 &helpers::child_path(path, "RegnId"),
5143 config,
5144 collector,
5145 );
5146 }
5147 if let Some(ref val) = self.tax_tp {
5148 helpers::validate_length(
5149 val,
5150 "TaxTp",
5151 Some(1),
5152 Some(35),
5153 &helpers::child_path(path, "TaxTp"),
5154 config,
5155 collector,
5156 );
5157 }
5158 if let Some(ref val) = self.authstn
5159 && config.validate_optional_fields
5160 {
5161 val.validate(&helpers::child_path(path, "Authstn"), config, collector);
5162 }
5163 }
5164}
5165
5166#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5168pub struct TaxPeriod2 {
5169 #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
5170 pub yr: Option<String>,
5171 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5172 pub tp: Option<TaxRecordPeriod1Code>,
5173 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5174 pub fr_to_dt: Option<DatePeriod2>,
5175}
5176
5177impl Validate for TaxPeriod2 {
5178 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5179 if let Some(ref val) = self.tp
5180 && config.validate_optional_fields
5181 {
5182 val.validate(&helpers::child_path(path, "Tp"), config, collector);
5183 }
5184 if let Some(ref val) = self.fr_to_dt
5185 && config.validate_optional_fields
5186 {
5187 val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
5188 }
5189 }
5190}
5191
5192#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5194pub struct TaxRecord2 {
5195 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5196 pub tp: Option<String>,
5197 #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
5198 pub ctgy: Option<String>,
5199 #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
5200 pub ctgy_dtls: Option<String>,
5201 #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
5202 pub dbtr_sts: Option<String>,
5203 #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
5204 pub cert_id: Option<String>,
5205 #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
5206 pub frms_cd: Option<String>,
5207 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
5208 pub prd: Option<TaxPeriod2>,
5209 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
5210 pub tax_amt: Option<TaxAmount2>,
5211 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
5212 pub addtl_inf: Option<String>,
5213}
5214
5215impl Validate for TaxRecord2 {
5216 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5217 if let Some(ref val) = self.tp {
5218 helpers::validate_length(
5219 val,
5220 "Tp",
5221 Some(1),
5222 Some(35),
5223 &helpers::child_path(path, "Tp"),
5224 config,
5225 collector,
5226 );
5227 }
5228 if let Some(ref val) = self.ctgy {
5229 helpers::validate_length(
5230 val,
5231 "Ctgy",
5232 Some(1),
5233 Some(35),
5234 &helpers::child_path(path, "Ctgy"),
5235 config,
5236 collector,
5237 );
5238 }
5239 if let Some(ref val) = self.ctgy_dtls {
5240 helpers::validate_length(
5241 val,
5242 "CtgyDtls",
5243 Some(1),
5244 Some(35),
5245 &helpers::child_path(path, "CtgyDtls"),
5246 config,
5247 collector,
5248 );
5249 }
5250 if let Some(ref val) = self.dbtr_sts {
5251 helpers::validate_length(
5252 val,
5253 "DbtrSts",
5254 Some(1),
5255 Some(35),
5256 &helpers::child_path(path, "DbtrSts"),
5257 config,
5258 collector,
5259 );
5260 }
5261 if let Some(ref val) = self.cert_id {
5262 helpers::validate_length(
5263 val,
5264 "CertId",
5265 Some(1),
5266 Some(35),
5267 &helpers::child_path(path, "CertId"),
5268 config,
5269 collector,
5270 );
5271 }
5272 if let Some(ref val) = self.frms_cd {
5273 helpers::validate_length(
5274 val,
5275 "FrmsCd",
5276 Some(1),
5277 Some(35),
5278 &helpers::child_path(path, "FrmsCd"),
5279 config,
5280 collector,
5281 );
5282 }
5283 if let Some(ref val) = self.prd
5284 && config.validate_optional_fields
5285 {
5286 val.validate(&helpers::child_path(path, "Prd"), config, collector);
5287 }
5288 if let Some(ref val) = self.tax_amt
5289 && config.validate_optional_fields
5290 {
5291 val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
5292 }
5293 if let Some(ref val) = self.addtl_inf {
5294 helpers::validate_length(
5295 val,
5296 "AddtlInf",
5297 Some(1),
5298 Some(140),
5299 &helpers::child_path(path, "AddtlInf"),
5300 config,
5301 collector,
5302 );
5303 }
5304 }
5305}
5306
5307#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5309pub struct TaxRecordDetails2 {
5310 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
5311 pub prd: Option<TaxPeriod2>,
5312 #[serde(rename = "Amt")]
5313 pub amt: ActiveOrHistoricCurrencyAndAmount,
5314}
5315
5316impl Validate for TaxRecordDetails2 {
5317 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5318 if let Some(ref val) = self.prd
5319 && config.validate_optional_fields
5320 {
5321 val.validate(&helpers::child_path(path, "Prd"), config, collector);
5322 }
5323 self.amt
5324 .validate(&helpers::child_path(path, "Amt"), config, collector);
5325 }
5326}
5327
5328#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5330pub enum TaxRecordPeriod1Code {
5331 #[default]
5332 #[serde(rename = "MM01")]
5333 CodeMM01,
5334 #[serde(rename = "MM02")]
5335 CodeMM02,
5336 #[serde(rename = "MM03")]
5337 CodeMM03,
5338 #[serde(rename = "MM04")]
5339 CodeMM04,
5340 #[serde(rename = "MM05")]
5341 CodeMM05,
5342 #[serde(rename = "MM06")]
5343 CodeMM06,
5344 #[serde(rename = "MM07")]
5345 CodeMM07,
5346 #[serde(rename = "MM08")]
5347 CodeMM08,
5348 #[serde(rename = "MM09")]
5349 CodeMM09,
5350 #[serde(rename = "MM10")]
5351 CodeMM10,
5352 #[serde(rename = "MM11")]
5353 CodeMM11,
5354 #[serde(rename = "MM12")]
5355 CodeMM12,
5356 #[serde(rename = "QTR1")]
5357 CodeQTR1,
5358 #[serde(rename = "QTR2")]
5359 CodeQTR2,
5360 #[serde(rename = "QTR3")]
5361 CodeQTR3,
5362 #[serde(rename = "QTR4")]
5363 CodeQTR4,
5364 #[serde(rename = "HLF1")]
5365 CodeHLF1,
5366 #[serde(rename = "HLF2")]
5367 CodeHLF2,
5368}
5369
5370impl Validate for TaxRecordPeriod1Code {
5371 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5372 }
5374}