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 AccountIdentification4Choice1 {
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<GenericAccountIdentification11>,
30}
31
32impl Validate for AccountIdentification4Choice1 {
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 AccountSchemeName1Choice1 {
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 AccountSchemeName1Choice1 {
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 if let Some(ref val) = self.prtry {
86 helpers::validate_pattern(
87 val,
88 "Prtry",
89 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
90 &helpers::child_path(path, "Prtry"),
91 config,
92 collector,
93 );
94 }
95 }
96}
97
98#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
100pub struct BranchAndFinancialInstitutionIdentification61 {
101 #[serde(rename = "FinInstnId")]
102 pub fin_instn_id: FinancialInstitutionIdentification181,
103}
104
105impl Validate for BranchAndFinancialInstitutionIdentification61 {
106 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
107 self.fin_instn_id
108 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
109 }
110}
111
112#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
114pub struct CBPRAmount {
115 #[serde(rename = "@Ccy")]
116 pub ccy: String,
117 #[serde(rename = "$value")]
118 pub value: f64,
119}
120
121impl Validate for CBPRAmount {
122 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
123}
124
125#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
127pub struct CashAccount401 {
128 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
129 pub id: Option<AccountIdentification4Choice1>,
130 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
131 pub tp: Option<CashAccountType2Choice1>,
132 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
133 pub ccy: Option<String>,
134 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
135 pub nm: Option<String>,
136 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
137 pub prxy: Option<ProxyAccountIdentification11>,
138}
139
140impl Validate for CashAccount401 {
141 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
142 if let Some(ref val) = self.id
143 && config.validate_optional_fields
144 {
145 val.validate(&helpers::child_path(path, "Id"), config, collector);
146 }
147 if let Some(ref val) = self.tp
148 && config.validate_optional_fields
149 {
150 val.validate(&helpers::child_path(path, "Tp"), config, collector);
151 }
152 if let Some(ref val) = self.ccy {
153 helpers::validate_pattern(
154 val,
155 "Ccy",
156 "[A-Z]{3,3}",
157 &helpers::child_path(path, "Ccy"),
158 config,
159 collector,
160 );
161 }
162 if let Some(ref val) = self.nm {
163 helpers::validate_length(
164 val,
165 "Nm",
166 Some(1),
167 Some(70),
168 &helpers::child_path(path, "Nm"),
169 config,
170 collector,
171 );
172 }
173 if let Some(ref val) = self.nm {
174 helpers::validate_pattern(
175 val,
176 "Nm",
177 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
178 &helpers::child_path(path, "Nm"),
179 config,
180 collector,
181 );
182 }
183 if let Some(ref val) = self.prxy
184 && config.validate_optional_fields
185 {
186 val.validate(&helpers::child_path(path, "Prxy"), config, collector);
187 }
188 }
189}
190
191#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
193pub struct CashAccountType2Choice1 {
194 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
195 pub cd: Option<String>,
196 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
197 pub prtry: Option<String>,
198}
199
200impl Validate for CashAccountType2Choice1 {
201 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
202 if let Some(ref val) = self.cd {
203 helpers::validate_length(
204 val,
205 "Cd",
206 Some(1),
207 Some(4),
208 &helpers::child_path(path, "Cd"),
209 config,
210 collector,
211 );
212 }
213 if let Some(ref val) = self.prtry {
214 helpers::validate_length(
215 val,
216 "Prtry",
217 Some(1),
218 Some(35),
219 &helpers::child_path(path, "Prtry"),
220 config,
221 collector,
222 );
223 }
224 if let Some(ref val) = self.prtry {
225 helpers::validate_pattern(
226 val,
227 "Prtry",
228 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
229 &helpers::child_path(path, "Prtry"),
230 config,
231 collector,
232 );
233 }
234 }
235}
236
237#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
239pub struct Cheque131 {
240 #[serde(rename = "InstrId")]
241 pub instr_id: String,
242 #[serde(rename = "ChqNb")]
243 pub chq_nb: String,
244 #[serde(rename = "IsseDt")]
245 pub isse_dt: String,
246 #[serde(rename = "StlDt", skip_serializing_if = "Option::is_none")]
247 pub stl_dt: Option<String>,
248 #[serde(rename = "Amt")]
249 pub amt: CBPRAmount,
250 #[serde(rename = "ValDt", skip_serializing_if = "Option::is_none")]
251 pub val_dt: Option<DateAndDateTime2Choice1>,
252 #[serde(rename = "Pyer")]
253 pub pyer: PartyIdentification1351,
254 #[serde(rename = "PyerAcct", skip_serializing_if = "Option::is_none")]
255 pub pyer_acct: Option<CashAccount401>,
256 #[serde(rename = "DrwrAgt", skip_serializing_if = "Option::is_none")]
257 pub drwr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
258 #[serde(rename = "DrwrAgtAcct", skip_serializing_if = "Option::is_none")]
259 pub drwr_agt_acct: Option<CashAccount401>,
260 #[serde(rename = "Pyee")]
261 pub pyee: PartyIdentification1352,
262}
263
264impl Validate for Cheque131 {
265 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
266 helpers::validate_length(
267 &self.instr_id,
268 "InstrId",
269 Some(1),
270 Some(35),
271 &helpers::child_path(path, "InstrId"),
272 config,
273 collector,
274 );
275 helpers::validate_pattern(
276 &self.instr_id,
277 "InstrId",
278 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
279 &helpers::child_path(path, "InstrId"),
280 config,
281 collector,
282 );
283 helpers::validate_length(
284 &self.chq_nb,
285 "ChqNb",
286 Some(1),
287 Some(16),
288 &helpers::child_path(path, "ChqNb"),
289 config,
290 collector,
291 );
292 helpers::validate_pattern(
293 &self.chq_nb,
294 "ChqNb",
295 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
296 &helpers::child_path(path, "ChqNb"),
297 config,
298 collector,
299 );
300 self.amt
301 .validate(&helpers::child_path(path, "Amt"), config, collector);
302 if let Some(ref val) = self.val_dt
303 && config.validate_optional_fields
304 {
305 val.validate(&helpers::child_path(path, "ValDt"), config, collector);
306 }
307 self.pyer
308 .validate(&helpers::child_path(path, "Pyer"), config, collector);
309 if let Some(ref val) = self.pyer_acct
310 && config.validate_optional_fields
311 {
312 val.validate(&helpers::child_path(path, "PyerAcct"), config, collector);
313 }
314 if let Some(ref val) = self.drwr_agt
315 && config.validate_optional_fields
316 {
317 val.validate(&helpers::child_path(path, "DrwrAgt"), config, collector);
318 }
319 if let Some(ref val) = self.drwr_agt_acct
320 && config.validate_optional_fields
321 {
322 val.validate(&helpers::child_path(path, "DrwrAgtAcct"), config, collector);
323 }
324 self.pyee
325 .validate(&helpers::child_path(path, "Pyee"), config, collector);
326 }
327}
328
329#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
331pub struct ChequePresentmentNotificationV01 {
332 #[serde(rename = "GrpHdr")]
333 pub grp_hdr: GroupHeader1031,
334 #[serde(rename = "Chq")]
335 pub chq: Cheque131,
336}
337
338impl Validate for ChequePresentmentNotificationV01 {
339 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
340 self.grp_hdr
341 .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
342 self.chq
343 .validate(&helpers::child_path(path, "Chq"), config, collector);
344 }
345}
346
347#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
349pub struct ClearingSystemIdentification2Choice1 {
350 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
351 pub cd: Option<String>,
352}
353
354impl Validate for ClearingSystemIdentification2Choice1 {
355 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
356 if let Some(ref val) = self.cd {
357 helpers::validate_length(
358 val,
359 "Cd",
360 Some(1),
361 Some(5),
362 &helpers::child_path(path, "Cd"),
363 config,
364 collector,
365 );
366 }
367 }
368}
369
370#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
372pub struct ClearingSystemMemberIdentification21 {
373 #[serde(rename = "ClrSysId")]
374 pub clr_sys_id: ClearingSystemIdentification2Choice1,
375 #[serde(rename = "MmbId")]
376 pub mmb_id: String,
377}
378
379impl Validate for ClearingSystemMemberIdentification21 {
380 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
381 self.clr_sys_id
382 .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
383 helpers::validate_length(
384 &self.mmb_id,
385 "MmbId",
386 Some(1),
387 Some(28),
388 &helpers::child_path(path, "MmbId"),
389 config,
390 collector,
391 );
392 helpers::validate_pattern(
393 &self.mmb_id,
394 "MmbId",
395 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
396 &helpers::child_path(path, "MmbId"),
397 config,
398 collector,
399 );
400 }
401}
402
403#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
405pub struct DateAndDateTime2Choice1 {
406 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
407 pub dt: Option<String>,
408}
409
410impl Validate for DateAndDateTime2Choice1 {
411 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
412}
413
414#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
416pub struct DateAndPlaceOfBirth11 {
417 #[serde(rename = "BirthDt")]
418 pub birth_dt: String,
419 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
420 pub prvc_of_birth: Option<String>,
421 #[serde(rename = "CityOfBirth")]
422 pub city_of_birth: String,
423 #[serde(rename = "CtryOfBirth")]
424 pub ctry_of_birth: String,
425}
426
427impl Validate for DateAndPlaceOfBirth11 {
428 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
429 if let Some(ref val) = self.prvc_of_birth {
430 helpers::validate_length(
431 val,
432 "PrvcOfBirth",
433 Some(1),
434 Some(35),
435 &helpers::child_path(path, "PrvcOfBirth"),
436 config,
437 collector,
438 );
439 }
440 if let Some(ref val) = self.prvc_of_birth {
441 helpers::validate_pattern(
442 val,
443 "PrvcOfBirth",
444 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
445 &helpers::child_path(path, "PrvcOfBirth"),
446 config,
447 collector,
448 );
449 }
450 helpers::validate_length(
451 &self.city_of_birth,
452 "CityOfBirth",
453 Some(1),
454 Some(35),
455 &helpers::child_path(path, "CityOfBirth"),
456 config,
457 collector,
458 );
459 helpers::validate_pattern(
460 &self.city_of_birth,
461 "CityOfBirth",
462 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
463 &helpers::child_path(path, "CityOfBirth"),
464 config,
465 collector,
466 );
467 helpers::validate_pattern(
468 &self.ctry_of_birth,
469 "CtryOfBirth",
470 "[A-Z]{2,2}",
471 &helpers::child_path(path, "CtryOfBirth"),
472 config,
473 collector,
474 );
475 }
476}
477
478#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
480pub struct FinancialInstitutionIdentification181 {
481 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
482 pub bicfi: Option<String>,
483 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
484 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
485 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
486 pub lei: Option<String>,
487 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
488 pub nm: Option<String>,
489 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
490 pub pstl_adr: Option<PostalAddress241>,
491}
492
493impl Validate for FinancialInstitutionIdentification181 {
494 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
495 if let Some(ref val) = self.bicfi {
496 helpers::validate_pattern(
497 val,
498 "BICFI",
499 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
500 &helpers::child_path(path, "BICFI"),
501 config,
502 collector,
503 );
504 }
505 if let Some(ref val) = self.clr_sys_mmb_id
506 && config.validate_optional_fields
507 {
508 val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
509 }
510 if let Some(ref val) = self.lei {
511 helpers::validate_pattern(
512 val,
513 "LEI",
514 "[A-Z0-9]{18,18}[0-9]{2,2}",
515 &helpers::child_path(path, "LEI"),
516 config,
517 collector,
518 );
519 }
520 if let Some(ref val) = self.nm {
521 helpers::validate_length(
522 val,
523 "Nm",
524 Some(1),
525 Some(140),
526 &helpers::child_path(path, "Nm"),
527 config,
528 collector,
529 );
530 }
531 if let Some(ref val) = self.nm {
532 helpers::validate_pattern(
533 val,
534 "Nm",
535 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
536 &helpers::child_path(path, "Nm"),
537 config,
538 collector,
539 );
540 }
541 if let Some(ref val) = self.pstl_adr
542 && config.validate_optional_fields
543 {
544 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
545 }
546 }
547}
548
549#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
551pub struct GenericAccountIdentification11 {
552 #[serde(rename = "Id")]
553 pub id: String,
554 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
555 pub schme_nm: Option<AccountSchemeName1Choice1>,
556 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
557 pub issr: Option<String>,
558}
559
560impl Validate for GenericAccountIdentification11 {
561 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
562 helpers::validate_length(
563 &self.id,
564 "Id",
565 Some(1),
566 Some(34),
567 &helpers::child_path(path, "Id"),
568 config,
569 collector,
570 );
571 helpers::validate_pattern(
572 &self.id,
573 "Id",
574 "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
575 &helpers::child_path(path, "Id"),
576 config,
577 collector,
578 );
579 if let Some(ref val) = self.schme_nm
580 && config.validate_optional_fields
581 {
582 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
583 }
584 if let Some(ref val) = self.issr {
585 helpers::validate_length(
586 val,
587 "Issr",
588 Some(1),
589 Some(35),
590 &helpers::child_path(path, "Issr"),
591 config,
592 collector,
593 );
594 }
595 if let Some(ref val) = self.issr {
596 helpers::validate_pattern(
597 val,
598 "Issr",
599 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
600 &helpers::child_path(path, "Issr"),
601 config,
602 collector,
603 );
604 }
605 }
606}
607
608#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
610pub struct GenericOrganisationIdentification11 {
611 #[serde(rename = "Id")]
612 pub id: String,
613 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
614 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
615 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
616 pub issr: Option<String>,
617}
618
619impl Validate for GenericOrganisationIdentification11 {
620 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
621 helpers::validate_length(
622 &self.id,
623 "Id",
624 Some(1),
625 Some(35),
626 &helpers::child_path(path, "Id"),
627 config,
628 collector,
629 );
630 helpers::validate_pattern(
631 &self.id,
632 "Id",
633 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
634 &helpers::child_path(path, "Id"),
635 config,
636 collector,
637 );
638 if let Some(ref val) = self.schme_nm
639 && config.validate_optional_fields
640 {
641 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
642 }
643 if let Some(ref val) = self.issr {
644 helpers::validate_length(
645 val,
646 "Issr",
647 Some(1),
648 Some(35),
649 &helpers::child_path(path, "Issr"),
650 config,
651 collector,
652 );
653 }
654 if let Some(ref val) = self.issr {
655 helpers::validate_pattern(
656 val,
657 "Issr",
658 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
659 &helpers::child_path(path, "Issr"),
660 config,
661 collector,
662 );
663 }
664 }
665}
666
667#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
669pub struct GenericPersonIdentification11 {
670 #[serde(rename = "Id")]
671 pub id: String,
672 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
673 pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
674 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
675 pub issr: Option<String>,
676}
677
678impl Validate for GenericPersonIdentification11 {
679 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
680 helpers::validate_length(
681 &self.id,
682 "Id",
683 Some(1),
684 Some(35),
685 &helpers::child_path(path, "Id"),
686 config,
687 collector,
688 );
689 helpers::validate_pattern(
690 &self.id,
691 "Id",
692 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
693 &helpers::child_path(path, "Id"),
694 config,
695 collector,
696 );
697 if let Some(ref val) = self.schme_nm
698 && config.validate_optional_fields
699 {
700 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
701 }
702 if let Some(ref val) = self.issr {
703 helpers::validate_length(
704 val,
705 "Issr",
706 Some(1),
707 Some(35),
708 &helpers::child_path(path, "Issr"),
709 config,
710 collector,
711 );
712 }
713 if let Some(ref val) = self.issr {
714 helpers::validate_pattern(
715 val,
716 "Issr",
717 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
718 &helpers::child_path(path, "Issr"),
719 config,
720 collector,
721 );
722 }
723 }
724}
725
726#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
728pub struct GroupHeader1031 {
729 #[serde(rename = "MsgId")]
730 pub msg_id: String,
731 #[serde(rename = "CreDtTm")]
732 pub cre_dt_tm: String,
733 #[serde(rename = "NbOfChqs")]
734 pub nb_of_chqs: Max15NumericTextfixed,
735}
736
737impl Validate for GroupHeader1031 {
738 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
739 helpers::validate_length(
740 &self.msg_id,
741 "MsgId",
742 Some(1),
743 Some(16),
744 &helpers::child_path(path, "MsgId"),
745 config,
746 collector,
747 );
748 helpers::validate_pattern(
749 &self.msg_id,
750 "MsgId",
751 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
752 &helpers::child_path(path, "MsgId"),
753 config,
754 collector,
755 );
756 helpers::validate_pattern(
757 &self.cre_dt_tm,
758 "CreDtTm",
759 ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
760 &helpers::child_path(path, "CreDtTm"),
761 config,
762 collector,
763 );
764 self.nb_of_chqs
765 .validate(&helpers::child_path(path, "NbOfChqs"), config, collector);
766 }
767}
768
769#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
771pub enum Max15NumericTextfixed {
772 #[default]
773 #[serde(rename = "1")]
774 Code1,
775}
776
777impl Validate for Max15NumericTextfixed {
778 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
779 }
781}
782
783#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
785pub struct OrganisationIdentification291 {
786 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
787 pub any_bic: Option<String>,
788 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
789 pub lei: Option<String>,
790 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
791 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
792}
793
794impl Validate for OrganisationIdentification291 {
795 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
796 if let Some(ref val) = self.any_bic {
797 helpers::validate_pattern(
798 val,
799 "AnyBIC",
800 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
801 &helpers::child_path(path, "AnyBIC"),
802 config,
803 collector,
804 );
805 }
806 if let Some(ref val) = self.lei {
807 helpers::validate_pattern(
808 val,
809 "LEI",
810 "[A-Z0-9]{18,18}[0-9]{2,2}",
811 &helpers::child_path(path, "LEI"),
812 config,
813 collector,
814 );
815 }
816 if let Some(ref vec) = self.othr
817 && config.validate_optional_fields
818 {
819 for item in vec {
820 item.validate(&helpers::child_path(path, "Othr"), config, collector);
821 }
822 }
823 }
824}
825
826#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
828pub struct OrganisationIdentificationSchemeName1Choice1 {
829 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
830 pub cd: Option<String>,
831 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
832 pub prtry: Option<String>,
833}
834
835impl Validate for OrganisationIdentificationSchemeName1Choice1 {
836 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
837 if let Some(ref val) = self.cd {
838 helpers::validate_length(
839 val,
840 "Cd",
841 Some(1),
842 Some(4),
843 &helpers::child_path(path, "Cd"),
844 config,
845 collector,
846 );
847 }
848 if let Some(ref val) = self.prtry {
849 helpers::validate_length(
850 val,
851 "Prtry",
852 Some(1),
853 Some(35),
854 &helpers::child_path(path, "Prtry"),
855 config,
856 collector,
857 );
858 }
859 if let Some(ref val) = self.prtry {
860 helpers::validate_pattern(
861 val,
862 "Prtry",
863 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
864 &helpers::child_path(path, "Prtry"),
865 config,
866 collector,
867 );
868 }
869 }
870}
871
872#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
874pub struct Party38Choice1 {
875 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
876 pub org_id: Option<OrganisationIdentification291>,
877 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
878 pub prvt_id: Option<PersonIdentification131>,
879}
880
881impl Validate for Party38Choice1 {
882 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
883 if let Some(ref val) = self.org_id
884 && config.validate_optional_fields
885 {
886 val.validate(&helpers::child_path(path, "OrgId"), config, collector);
887 }
888 if let Some(ref val) = self.prvt_id
889 && config.validate_optional_fields
890 {
891 val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
892 }
893 }
894}
895
896#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
898pub struct PartyIdentification1351 {
899 #[serde(rename = "Nm")]
900 pub nm: String,
901 #[serde(rename = "PstlAdr")]
902 pub pstl_adr: PostalAddress241,
903 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
904 pub id: Option<Party38Choice1>,
905 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
906 pub ctry_of_res: Option<String>,
907}
908
909impl Validate for PartyIdentification1351 {
910 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
911 helpers::validate_length(
912 &self.nm,
913 "Nm",
914 Some(1),
915 Some(140),
916 &helpers::child_path(path, "Nm"),
917 config,
918 collector,
919 );
920 helpers::validate_pattern(
921 &self.nm,
922 "Nm",
923 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
924 &helpers::child_path(path, "Nm"),
925 config,
926 collector,
927 );
928 self.pstl_adr
929 .validate(&helpers::child_path(path, "PstlAdr"), config, collector);
930 if let Some(ref val) = self.id
931 && config.validate_optional_fields
932 {
933 val.validate(&helpers::child_path(path, "Id"), config, collector);
934 }
935 if let Some(ref val) = self.ctry_of_res {
936 helpers::validate_pattern(
937 val,
938 "CtryOfRes",
939 "[A-Z]{2,2}",
940 &helpers::child_path(path, "CtryOfRes"),
941 config,
942 collector,
943 );
944 }
945 }
946}
947
948#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
950pub struct PartyIdentification1352 {
951 #[serde(rename = "Nm")]
952 pub nm: String,
953 #[serde(rename = "PstlAdr")]
954 pub pstl_adr: PostalAddress242,
955 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
956 pub id: Option<Party38Choice1>,
957 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
958 pub ctry_of_res: Option<String>,
959}
960
961impl Validate for PartyIdentification1352 {
962 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
963 helpers::validate_length(
964 &self.nm,
965 "Nm",
966 Some(1),
967 Some(140),
968 &helpers::child_path(path, "Nm"),
969 config,
970 collector,
971 );
972 helpers::validate_pattern(
973 &self.nm,
974 "Nm",
975 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
976 &helpers::child_path(path, "Nm"),
977 config,
978 collector,
979 );
980 self.pstl_adr
981 .validate(&helpers::child_path(path, "PstlAdr"), config, collector);
982 if let Some(ref val) = self.id
983 && config.validate_optional_fields
984 {
985 val.validate(&helpers::child_path(path, "Id"), config, collector);
986 }
987 if let Some(ref val) = self.ctry_of_res {
988 helpers::validate_pattern(
989 val,
990 "CtryOfRes",
991 "[A-Z]{2,2}",
992 &helpers::child_path(path, "CtryOfRes"),
993 config,
994 collector,
995 );
996 }
997 }
998}
999
1000#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1002pub struct PersonIdentification131 {
1003 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1004 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
1005 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1006 pub othr: Option<Vec<GenericPersonIdentification11>>,
1007}
1008
1009impl Validate for PersonIdentification131 {
1010 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1011 if let Some(ref val) = self.dt_and_plc_of_birth
1012 && config.validate_optional_fields
1013 {
1014 val.validate(
1015 &helpers::child_path(path, "DtAndPlcOfBirth"),
1016 config,
1017 collector,
1018 );
1019 }
1020 if let Some(ref vec) = self.othr
1021 && config.validate_optional_fields
1022 {
1023 for item in vec {
1024 item.validate(&helpers::child_path(path, "Othr"), config, collector);
1025 }
1026 }
1027 }
1028}
1029
1030#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1032pub struct PersonIdentificationSchemeName1Choice1 {
1033 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1034 pub cd: Option<String>,
1035 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1036 pub prtry: Option<String>,
1037}
1038
1039impl Validate for PersonIdentificationSchemeName1Choice1 {
1040 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1041 if let Some(ref val) = self.cd {
1042 helpers::validate_length(
1043 val,
1044 "Cd",
1045 Some(1),
1046 Some(4),
1047 &helpers::child_path(path, "Cd"),
1048 config,
1049 collector,
1050 );
1051 }
1052 if let Some(ref val) = self.prtry {
1053 helpers::validate_length(
1054 val,
1055 "Prtry",
1056 Some(1),
1057 Some(35),
1058 &helpers::child_path(path, "Prtry"),
1059 config,
1060 collector,
1061 );
1062 }
1063 if let Some(ref val) = self.prtry {
1064 helpers::validate_pattern(
1065 val,
1066 "Prtry",
1067 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1068 &helpers::child_path(path, "Prtry"),
1069 config,
1070 collector,
1071 );
1072 }
1073 }
1074}
1075
1076#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1078pub struct PostalAddress241 {
1079 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
1080 pub dept: Option<String>,
1081 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
1082 pub sub_dept: Option<String>,
1083 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
1084 pub strt_nm: Option<String>,
1085 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
1086 pub bldg_nb: Option<String>,
1087 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
1088 pub bldg_nm: Option<String>,
1089 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
1090 pub flr: Option<String>,
1091 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
1092 pub pst_bx: Option<String>,
1093 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
1094 pub room: Option<String>,
1095 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
1096 pub pst_cd: Option<String>,
1097 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
1098 pub twn_nm: Option<String>,
1099 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1100 pub twn_lctn_nm: Option<String>,
1101 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1102 pub dstrct_nm: Option<String>,
1103 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1104 pub ctry_sub_dvsn: Option<String>,
1105 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
1106 pub ctry: Option<String>,
1107 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1108 pub adr_line: Option<Vec<String>>,
1109}
1110
1111impl Validate for PostalAddress241 {
1112 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1113 if let Some(ref val) = self.dept {
1114 helpers::validate_length(
1115 val,
1116 "Dept",
1117 Some(1),
1118 Some(70),
1119 &helpers::child_path(path, "Dept"),
1120 config,
1121 collector,
1122 );
1123 }
1124 if let Some(ref val) = self.dept {
1125 helpers::validate_pattern(
1126 val,
1127 "Dept",
1128 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1129 &helpers::child_path(path, "Dept"),
1130 config,
1131 collector,
1132 );
1133 }
1134 if let Some(ref val) = self.sub_dept {
1135 helpers::validate_length(
1136 val,
1137 "SubDept",
1138 Some(1),
1139 Some(70),
1140 &helpers::child_path(path, "SubDept"),
1141 config,
1142 collector,
1143 );
1144 }
1145 if let Some(ref val) = self.sub_dept {
1146 helpers::validate_pattern(
1147 val,
1148 "SubDept",
1149 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1150 &helpers::child_path(path, "SubDept"),
1151 config,
1152 collector,
1153 );
1154 }
1155 if let Some(ref val) = self.strt_nm {
1156 helpers::validate_length(
1157 val,
1158 "StrtNm",
1159 Some(1),
1160 Some(70),
1161 &helpers::child_path(path, "StrtNm"),
1162 config,
1163 collector,
1164 );
1165 }
1166 if let Some(ref val) = self.strt_nm {
1167 helpers::validate_pattern(
1168 val,
1169 "StrtNm",
1170 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1171 &helpers::child_path(path, "StrtNm"),
1172 config,
1173 collector,
1174 );
1175 }
1176 if let Some(ref val) = self.bldg_nb {
1177 helpers::validate_length(
1178 val,
1179 "BldgNb",
1180 Some(1),
1181 Some(16),
1182 &helpers::child_path(path, "BldgNb"),
1183 config,
1184 collector,
1185 );
1186 }
1187 if let Some(ref val) = self.bldg_nb {
1188 helpers::validate_pattern(
1189 val,
1190 "BldgNb",
1191 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1192 &helpers::child_path(path, "BldgNb"),
1193 config,
1194 collector,
1195 );
1196 }
1197 if let Some(ref val) = self.bldg_nm {
1198 helpers::validate_length(
1199 val,
1200 "BldgNm",
1201 Some(1),
1202 Some(35),
1203 &helpers::child_path(path, "BldgNm"),
1204 config,
1205 collector,
1206 );
1207 }
1208 if let Some(ref val) = self.bldg_nm {
1209 helpers::validate_pattern(
1210 val,
1211 "BldgNm",
1212 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1213 &helpers::child_path(path, "BldgNm"),
1214 config,
1215 collector,
1216 );
1217 }
1218 if let Some(ref val) = self.flr {
1219 helpers::validate_length(
1220 val,
1221 "Flr",
1222 Some(1),
1223 Some(70),
1224 &helpers::child_path(path, "Flr"),
1225 config,
1226 collector,
1227 );
1228 }
1229 if let Some(ref val) = self.flr {
1230 helpers::validate_pattern(
1231 val,
1232 "Flr",
1233 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1234 &helpers::child_path(path, "Flr"),
1235 config,
1236 collector,
1237 );
1238 }
1239 if let Some(ref val) = self.pst_bx {
1240 helpers::validate_length(
1241 val,
1242 "PstBx",
1243 Some(1),
1244 Some(16),
1245 &helpers::child_path(path, "PstBx"),
1246 config,
1247 collector,
1248 );
1249 }
1250 if let Some(ref val) = self.pst_bx {
1251 helpers::validate_pattern(
1252 val,
1253 "PstBx",
1254 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1255 &helpers::child_path(path, "PstBx"),
1256 config,
1257 collector,
1258 );
1259 }
1260 if let Some(ref val) = self.room {
1261 helpers::validate_length(
1262 val,
1263 "Room",
1264 Some(1),
1265 Some(70),
1266 &helpers::child_path(path, "Room"),
1267 config,
1268 collector,
1269 );
1270 }
1271 if let Some(ref val) = self.room {
1272 helpers::validate_pattern(
1273 val,
1274 "Room",
1275 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1276 &helpers::child_path(path, "Room"),
1277 config,
1278 collector,
1279 );
1280 }
1281 if let Some(ref val) = self.pst_cd {
1282 helpers::validate_length(
1283 val,
1284 "PstCd",
1285 Some(1),
1286 Some(16),
1287 &helpers::child_path(path, "PstCd"),
1288 config,
1289 collector,
1290 );
1291 }
1292 if let Some(ref val) = self.pst_cd {
1293 helpers::validate_pattern(
1294 val,
1295 "PstCd",
1296 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1297 &helpers::child_path(path, "PstCd"),
1298 config,
1299 collector,
1300 );
1301 }
1302 if let Some(ref val) = self.twn_nm {
1303 helpers::validate_length(
1304 val,
1305 "TwnNm",
1306 Some(1),
1307 Some(35),
1308 &helpers::child_path(path, "TwnNm"),
1309 config,
1310 collector,
1311 );
1312 }
1313 if let Some(ref val) = self.twn_nm {
1314 helpers::validate_pattern(
1315 val,
1316 "TwnNm",
1317 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1318 &helpers::child_path(path, "TwnNm"),
1319 config,
1320 collector,
1321 );
1322 }
1323 if let Some(ref val) = self.twn_lctn_nm {
1324 helpers::validate_length(
1325 val,
1326 "TwnLctnNm",
1327 Some(1),
1328 Some(35),
1329 &helpers::child_path(path, "TwnLctnNm"),
1330 config,
1331 collector,
1332 );
1333 }
1334 if let Some(ref val) = self.twn_lctn_nm {
1335 helpers::validate_pattern(
1336 val,
1337 "TwnLctnNm",
1338 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1339 &helpers::child_path(path, "TwnLctnNm"),
1340 config,
1341 collector,
1342 );
1343 }
1344 if let Some(ref val) = self.dstrct_nm {
1345 helpers::validate_length(
1346 val,
1347 "DstrctNm",
1348 Some(1),
1349 Some(35),
1350 &helpers::child_path(path, "DstrctNm"),
1351 config,
1352 collector,
1353 );
1354 }
1355 if let Some(ref val) = self.dstrct_nm {
1356 helpers::validate_pattern(
1357 val,
1358 "DstrctNm",
1359 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1360 &helpers::child_path(path, "DstrctNm"),
1361 config,
1362 collector,
1363 );
1364 }
1365 if let Some(ref val) = self.ctry_sub_dvsn {
1366 helpers::validate_length(
1367 val,
1368 "CtrySubDvsn",
1369 Some(1),
1370 Some(35),
1371 &helpers::child_path(path, "CtrySubDvsn"),
1372 config,
1373 collector,
1374 );
1375 }
1376 if let Some(ref val) = self.ctry_sub_dvsn {
1377 helpers::validate_pattern(
1378 val,
1379 "CtrySubDvsn",
1380 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1381 &helpers::child_path(path, "CtrySubDvsn"),
1382 config,
1383 collector,
1384 );
1385 }
1386 if let Some(ref val) = self.ctry {
1387 helpers::validate_pattern(
1388 val,
1389 "Ctry",
1390 "[A-Z]{2,2}",
1391 &helpers::child_path(path, "Ctry"),
1392 config,
1393 collector,
1394 );
1395 }
1396 if let Some(ref vec) = self.adr_line {
1397 for item in vec {
1398 helpers::validate_length(
1399 item,
1400 "AdrLine",
1401 Some(1),
1402 Some(70),
1403 &helpers::child_path(path, "AdrLine"),
1404 config,
1405 collector,
1406 );
1407 }
1408 }
1409 if let Some(ref vec) = self.adr_line {
1410 for item in vec {
1411 helpers::validate_pattern(
1412 item,
1413 "AdrLine",
1414 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1415 &helpers::child_path(path, "AdrLine"),
1416 config,
1417 collector,
1418 );
1419 }
1420 }
1421 }
1422}
1423
1424#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1426pub struct PostalAddress242 {
1427 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
1428 pub dept: Option<String>,
1429 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
1430 pub sub_dept: Option<String>,
1431 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
1432 pub strt_nm: Option<String>,
1433 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
1434 pub bldg_nb: Option<String>,
1435 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
1436 pub bldg_nm: Option<String>,
1437 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
1438 pub flr: Option<String>,
1439 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
1440 pub pst_bx: Option<String>,
1441 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
1442 pub room: Option<String>,
1443 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
1444 pub pst_cd: Option<String>,
1445 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
1446 pub twn_nm: Option<String>,
1447 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1448 pub twn_lctn_nm: Option<String>,
1449 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1450 pub dstrct_nm: Option<String>,
1451 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1452 pub ctry_sub_dvsn: Option<String>,
1453 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
1454 pub ctry: Option<String>,
1455 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1456 pub adr_line: Option<Vec<String>>,
1457}
1458
1459impl Validate for PostalAddress242 {
1460 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1461 if let Some(ref val) = self.dept {
1462 helpers::validate_length(
1463 val,
1464 "Dept",
1465 Some(1),
1466 Some(70),
1467 &helpers::child_path(path, "Dept"),
1468 config,
1469 collector,
1470 );
1471 }
1472 if let Some(ref val) = self.dept {
1473 helpers::validate_pattern(
1474 val,
1475 "Dept",
1476 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1477 &helpers::child_path(path, "Dept"),
1478 config,
1479 collector,
1480 );
1481 }
1482 if let Some(ref val) = self.sub_dept {
1483 helpers::validate_length(
1484 val,
1485 "SubDept",
1486 Some(1),
1487 Some(70),
1488 &helpers::child_path(path, "SubDept"),
1489 config,
1490 collector,
1491 );
1492 }
1493 if let Some(ref val) = self.sub_dept {
1494 helpers::validate_pattern(
1495 val,
1496 "SubDept",
1497 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1498 &helpers::child_path(path, "SubDept"),
1499 config,
1500 collector,
1501 );
1502 }
1503 if let Some(ref val) = self.strt_nm {
1504 helpers::validate_length(
1505 val,
1506 "StrtNm",
1507 Some(1),
1508 Some(70),
1509 &helpers::child_path(path, "StrtNm"),
1510 config,
1511 collector,
1512 );
1513 }
1514 if let Some(ref val) = self.strt_nm {
1515 helpers::validate_pattern(
1516 val,
1517 "StrtNm",
1518 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1519 &helpers::child_path(path, "StrtNm"),
1520 config,
1521 collector,
1522 );
1523 }
1524 if let Some(ref val) = self.bldg_nb {
1525 helpers::validate_length(
1526 val,
1527 "BldgNb",
1528 Some(1),
1529 Some(16),
1530 &helpers::child_path(path, "BldgNb"),
1531 config,
1532 collector,
1533 );
1534 }
1535 if let Some(ref val) = self.bldg_nb {
1536 helpers::validate_pattern(
1537 val,
1538 "BldgNb",
1539 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1540 &helpers::child_path(path, "BldgNb"),
1541 config,
1542 collector,
1543 );
1544 }
1545 if let Some(ref val) = self.bldg_nm {
1546 helpers::validate_length(
1547 val,
1548 "BldgNm",
1549 Some(1),
1550 Some(35),
1551 &helpers::child_path(path, "BldgNm"),
1552 config,
1553 collector,
1554 );
1555 }
1556 if let Some(ref val) = self.bldg_nm {
1557 helpers::validate_pattern(
1558 val,
1559 "BldgNm",
1560 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1561 &helpers::child_path(path, "BldgNm"),
1562 config,
1563 collector,
1564 );
1565 }
1566 if let Some(ref val) = self.flr {
1567 helpers::validate_length(
1568 val,
1569 "Flr",
1570 Some(1),
1571 Some(70),
1572 &helpers::child_path(path, "Flr"),
1573 config,
1574 collector,
1575 );
1576 }
1577 if let Some(ref val) = self.flr {
1578 helpers::validate_pattern(
1579 val,
1580 "Flr",
1581 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1582 &helpers::child_path(path, "Flr"),
1583 config,
1584 collector,
1585 );
1586 }
1587 if let Some(ref val) = self.pst_bx {
1588 helpers::validate_length(
1589 val,
1590 "PstBx",
1591 Some(1),
1592 Some(16),
1593 &helpers::child_path(path, "PstBx"),
1594 config,
1595 collector,
1596 );
1597 }
1598 if let Some(ref val) = self.pst_bx {
1599 helpers::validate_pattern(
1600 val,
1601 "PstBx",
1602 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1603 &helpers::child_path(path, "PstBx"),
1604 config,
1605 collector,
1606 );
1607 }
1608 if let Some(ref val) = self.room {
1609 helpers::validate_length(
1610 val,
1611 "Room",
1612 Some(1),
1613 Some(70),
1614 &helpers::child_path(path, "Room"),
1615 config,
1616 collector,
1617 );
1618 }
1619 if let Some(ref val) = self.room {
1620 helpers::validate_pattern(
1621 val,
1622 "Room",
1623 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1624 &helpers::child_path(path, "Room"),
1625 config,
1626 collector,
1627 );
1628 }
1629 if let Some(ref val) = self.pst_cd {
1630 helpers::validate_length(
1631 val,
1632 "PstCd",
1633 Some(1),
1634 Some(16),
1635 &helpers::child_path(path, "PstCd"),
1636 config,
1637 collector,
1638 );
1639 }
1640 if let Some(ref val) = self.pst_cd {
1641 helpers::validate_pattern(
1642 val,
1643 "PstCd",
1644 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1645 &helpers::child_path(path, "PstCd"),
1646 config,
1647 collector,
1648 );
1649 }
1650 if let Some(ref val) = self.twn_nm {
1651 helpers::validate_length(
1652 val,
1653 "TwnNm",
1654 Some(1),
1655 Some(35),
1656 &helpers::child_path(path, "TwnNm"),
1657 config,
1658 collector,
1659 );
1660 }
1661 if let Some(ref val) = self.twn_lctn_nm {
1662 helpers::validate_length(
1663 val,
1664 "TwnLctnNm",
1665 Some(1),
1666 Some(35),
1667 &helpers::child_path(path, "TwnLctnNm"),
1668 config,
1669 collector,
1670 );
1671 }
1672 if let Some(ref val) = self.twn_lctn_nm {
1673 helpers::validate_pattern(
1674 val,
1675 "TwnLctnNm",
1676 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1677 &helpers::child_path(path, "TwnLctnNm"),
1678 config,
1679 collector,
1680 );
1681 }
1682 if let Some(ref val) = self.dstrct_nm {
1683 helpers::validate_length(
1684 val,
1685 "DstrctNm",
1686 Some(1),
1687 Some(35),
1688 &helpers::child_path(path, "DstrctNm"),
1689 config,
1690 collector,
1691 );
1692 }
1693 if let Some(ref val) = self.dstrct_nm {
1694 helpers::validate_pattern(
1695 val,
1696 "DstrctNm",
1697 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1698 &helpers::child_path(path, "DstrctNm"),
1699 config,
1700 collector,
1701 );
1702 }
1703 if let Some(ref val) = self.ctry_sub_dvsn {
1704 helpers::validate_length(
1705 val,
1706 "CtrySubDvsn",
1707 Some(1),
1708 Some(35),
1709 &helpers::child_path(path, "CtrySubDvsn"),
1710 config,
1711 collector,
1712 );
1713 }
1714 if let Some(ref val) = self.ctry_sub_dvsn {
1715 helpers::validate_pattern(
1716 val,
1717 "CtrySubDvsn",
1718 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1719 &helpers::child_path(path, "CtrySubDvsn"),
1720 config,
1721 collector,
1722 );
1723 }
1724 if let Some(ref val) = self.ctry {
1725 helpers::validate_pattern(
1726 val,
1727 "Ctry",
1728 "[A-Z]{2,2}",
1729 &helpers::child_path(path, "Ctry"),
1730 config,
1731 collector,
1732 );
1733 }
1734 if let Some(ref vec) = self.adr_line {
1735 for item in vec {
1736 helpers::validate_length(
1737 item,
1738 "AdrLine",
1739 Some(1),
1740 Some(70),
1741 &helpers::child_path(path, "AdrLine"),
1742 config,
1743 collector,
1744 );
1745 }
1746 }
1747 if let Some(ref vec) = self.adr_line {
1748 for item in vec {
1749 helpers::validate_pattern(
1750 item,
1751 "AdrLine",
1752 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1753 &helpers::child_path(path, "AdrLine"),
1754 config,
1755 collector,
1756 );
1757 }
1758 }
1759 }
1760}
1761
1762#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1764pub struct ProxyAccountIdentification11 {
1765 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1766 pub tp: Option<ProxyAccountType1Choice1>,
1767 #[serde(rename = "Id")]
1768 pub id: String,
1769}
1770
1771impl Validate for ProxyAccountIdentification11 {
1772 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1773 if let Some(ref val) = self.tp
1774 && config.validate_optional_fields
1775 {
1776 val.validate(&helpers::child_path(path, "Tp"), config, collector);
1777 }
1778 helpers::validate_length(
1779 &self.id,
1780 "Id",
1781 Some(1),
1782 Some(320),
1783 &helpers::child_path(path, "Id"),
1784 config,
1785 collector,
1786 );
1787 helpers::validate_pattern(
1788 &self.id,
1789 "Id",
1790 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1791 &helpers::child_path(path, "Id"),
1792 config,
1793 collector,
1794 );
1795 }
1796}
1797
1798#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1800pub struct ProxyAccountType1Choice1 {
1801 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1802 pub cd: Option<String>,
1803 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1804 pub prtry: Option<String>,
1805}
1806
1807impl Validate for ProxyAccountType1Choice1 {
1808 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1809 if let Some(ref val) = self.cd {
1810 helpers::validate_length(
1811 val,
1812 "Cd",
1813 Some(1),
1814 Some(4),
1815 &helpers::child_path(path, "Cd"),
1816 config,
1817 collector,
1818 );
1819 }
1820 if let Some(ref val) = self.prtry {
1821 helpers::validate_length(
1822 val,
1823 "Prtry",
1824 Some(1),
1825 Some(35),
1826 &helpers::child_path(path, "Prtry"),
1827 config,
1828 collector,
1829 );
1830 }
1831 if let Some(ref val) = self.prtry {
1832 helpers::validate_pattern(
1833 val,
1834 "Prtry",
1835 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1836 &helpers::child_path(path, "Prtry"),
1837 config,
1838 collector,
1839 );
1840 }
1841 }
1842}