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