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 BranchAndFinancialInstitutionIdentification61 {
26 #[serde(rename = "FinInstnId")]
27 pub fin_instn_id: FinancialInstitutionIdentification181,
28}
29
30impl Validate for BranchAndFinancialInstitutionIdentification61 {
31 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
32 self.fin_instn_id
33 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
34 }
35}
36
37#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
39pub struct CBPRAmount {
40 #[serde(rename = "@Ccy")]
41 pub ccy: String,
42 #[serde(rename = "$value")]
43 pub value: f64,
44}
45
46impl Validate for CBPRAmount {
47 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
48}
49
50#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
52pub enum CBPRNotificationToReceiveCancellationReason1Code {
53 #[default]
54 #[serde(rename = "DUPL")]
55 CodeDUPL,
56 #[serde(rename = "NARR")]
57 CodeNARR,
58 #[serde(rename = "NOLE")]
59 CodeNOLE,
60}
61
62impl Validate for CBPRNotificationToReceiveCancellationReason1Code {
63 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
64 }
66}
67
68#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
70pub struct ClearingSystemIdentification2Choice1 {
71 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
72 pub cd: Option<String>,
73}
74
75impl Validate for ClearingSystemIdentification2Choice1 {
76 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
77 if let Some(ref val) = self.cd {
78 helpers::validate_length(
79 val,
80 "Cd",
81 Some(1),
82 Some(5),
83 &helpers::child_path(path, "Cd"),
84 config,
85 collector,
86 );
87 }
88 }
89}
90
91#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
93pub struct ClearingSystemMemberIdentification21 {
94 #[serde(rename = "ClrSysId")]
95 pub clr_sys_id: ClearingSystemIdentification2Choice1,
96 #[serde(rename = "MmbId")]
97 pub mmb_id: String,
98}
99
100impl Validate for ClearingSystemMemberIdentification21 {
101 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
102 self.clr_sys_id
103 .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
104 helpers::validate_length(
105 &self.mmb_id,
106 "MmbId",
107 Some(1),
108 Some(28),
109 &helpers::child_path(path, "MmbId"),
110 config,
111 collector,
112 );
113 helpers::validate_pattern(
114 &self.mmb_id,
115 "MmbId",
116 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
117 &helpers::child_path(path, "MmbId"),
118 config,
119 collector,
120 );
121 }
122}
123
124#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
126pub struct DateAndPlaceOfBirth11 {
127 #[serde(rename = "BirthDt")]
128 pub birth_dt: String,
129 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
130 pub prvc_of_birth: Option<String>,
131 #[serde(rename = "CityOfBirth")]
132 pub city_of_birth: String,
133 #[serde(rename = "CtryOfBirth")]
134 pub ctry_of_birth: String,
135}
136
137impl Validate for DateAndPlaceOfBirth11 {
138 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
139 if let Some(ref val) = self.prvc_of_birth {
140 helpers::validate_length(
141 val,
142 "PrvcOfBirth",
143 Some(1),
144 Some(35),
145 &helpers::child_path(path, "PrvcOfBirth"),
146 config,
147 collector,
148 );
149 }
150 if let Some(ref val) = self.prvc_of_birth {
151 helpers::validate_pattern(
152 val,
153 "PrvcOfBirth",
154 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
155 &helpers::child_path(path, "PrvcOfBirth"),
156 config,
157 collector,
158 );
159 }
160 helpers::validate_length(
161 &self.city_of_birth,
162 "CityOfBirth",
163 Some(1),
164 Some(35),
165 &helpers::child_path(path, "CityOfBirth"),
166 config,
167 collector,
168 );
169 helpers::validate_pattern(
170 &self.city_of_birth,
171 "CityOfBirth",
172 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
173 &helpers::child_path(path, "CityOfBirth"),
174 config,
175 collector,
176 );
177 helpers::validate_pattern(
178 &self.ctry_of_birth,
179 "CtryOfBirth",
180 "[A-Z]{2,2}",
181 &helpers::child_path(path, "CtryOfBirth"),
182 config,
183 collector,
184 );
185 }
186}
187
188#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
190pub struct FinancialInstitutionIdentification181 {
191 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
192 pub bicfi: Option<String>,
193 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
194 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
195 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
196 pub lei: Option<String>,
197 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
198 pub nm: Option<String>,
199 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
200 pub pstl_adr: Option<PostalAddress241>,
201}
202
203impl Validate for FinancialInstitutionIdentification181 {
204 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
205 if let Some(ref val) = self.bicfi {
206 helpers::validate_pattern(
207 val,
208 "BICFI",
209 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
210 &helpers::child_path(path, "BICFI"),
211 config,
212 collector,
213 );
214 }
215 if let Some(ref val) = self.clr_sys_mmb_id
216 && config.validate_optional_fields
217 {
218 val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
219 }
220 if let Some(ref val) = self.lei {
221 helpers::validate_pattern(
222 val,
223 "LEI",
224 "[A-Z0-9]{18,18}[0-9]{2,2}",
225 &helpers::child_path(path, "LEI"),
226 config,
227 collector,
228 );
229 }
230 if let Some(ref val) = self.nm {
231 helpers::validate_length(
232 val,
233 "Nm",
234 Some(1),
235 Some(140),
236 &helpers::child_path(path, "Nm"),
237 config,
238 collector,
239 );
240 }
241 if let Some(ref val) = self.nm {
242 helpers::validate_pattern(
243 val,
244 "Nm",
245 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
246 &helpers::child_path(path, "Nm"),
247 config,
248 collector,
249 );
250 }
251 if let Some(ref val) = self.pstl_adr
252 && config.validate_optional_fields
253 {
254 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
255 }
256 }
257}
258
259#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
261pub struct GenericOrganisationIdentification11 {
262 #[serde(rename = "Id")]
263 pub id: String,
264 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
265 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
266 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
267 pub issr: Option<String>,
268}
269
270impl Validate for GenericOrganisationIdentification11 {
271 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
272 helpers::validate_length(
273 &self.id,
274 "Id",
275 Some(1),
276 Some(35),
277 &helpers::child_path(path, "Id"),
278 config,
279 collector,
280 );
281 helpers::validate_pattern(
282 &self.id,
283 "Id",
284 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
285 &helpers::child_path(path, "Id"),
286 config,
287 collector,
288 );
289 if let Some(ref val) = self.schme_nm
290 && config.validate_optional_fields
291 {
292 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
293 }
294 if let Some(ref val) = self.issr {
295 helpers::validate_length(
296 val,
297 "Issr",
298 Some(1),
299 Some(35),
300 &helpers::child_path(path, "Issr"),
301 config,
302 collector,
303 );
304 }
305 if let Some(ref val) = self.issr {
306 helpers::validate_pattern(
307 val,
308 "Issr",
309 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
310 &helpers::child_path(path, "Issr"),
311 config,
312 collector,
313 );
314 }
315 }
316}
317
318#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
320pub struct GenericPersonIdentification11 {
321 #[serde(rename = "Id")]
322 pub id: String,
323 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
324 pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
325 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
326 pub issr: Option<String>,
327}
328
329impl Validate for GenericPersonIdentification11 {
330 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
331 helpers::validate_length(
332 &self.id,
333 "Id",
334 Some(1),
335 Some(35),
336 &helpers::child_path(path, "Id"),
337 config,
338 collector,
339 );
340 helpers::validate_pattern(
341 &self.id,
342 "Id",
343 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
344 &helpers::child_path(path, "Id"),
345 config,
346 collector,
347 );
348 if let Some(ref val) = self.schme_nm
349 && config.validate_optional_fields
350 {
351 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
352 }
353 if let Some(ref val) = self.issr {
354 helpers::validate_length(
355 val,
356 "Issr",
357 Some(1),
358 Some(35),
359 &helpers::child_path(path, "Issr"),
360 config,
361 collector,
362 );
363 }
364 if let Some(ref val) = self.issr {
365 helpers::validate_pattern(
366 val,
367 "Issr",
368 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
369 &helpers::child_path(path, "Issr"),
370 config,
371 collector,
372 );
373 }
374 }
375}
376
377#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
379pub struct GroupHeader771 {
380 #[serde(rename = "MsgId")]
381 pub msg_id: String,
382 #[serde(rename = "CreDtTm")]
383 pub cre_dt_tm: String,
384 #[serde(rename = "MsgSndr", skip_serializing_if = "Option::is_none")]
385 pub msg_sndr: Option<Party40Choice1>,
386}
387
388impl Validate for GroupHeader771 {
389 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
390 helpers::validate_length(
391 &self.msg_id,
392 "MsgId",
393 Some(1),
394 Some(16),
395 &helpers::child_path(path, "MsgId"),
396 config,
397 collector,
398 );
399 helpers::validate_pattern(
400 &self.msg_id,
401 "MsgId",
402 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
403 &helpers::child_path(path, "MsgId"),
404 config,
405 collector,
406 );
407 helpers::validate_pattern(
408 &self.cre_dt_tm,
409 "CreDtTm",
410 ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
411 &helpers::child_path(path, "CreDtTm"),
412 config,
413 collector,
414 );
415 if let Some(ref val) = self.msg_sndr
416 && config.validate_optional_fields
417 {
418 val.validate(&helpers::child_path(path, "MsgSndr"), config, collector);
419 }
420 }
421}
422
423#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
425pub struct NotificationCancellationReason1Choice1 {
426 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
427 pub cd: Option<CBPRNotificationToReceiveCancellationReason1Code>,
428}
429
430impl Validate for NotificationCancellationReason1Choice1 {
431 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
432 if let Some(ref val) = self.cd
433 && config.validate_optional_fields
434 {
435 val.validate(&helpers::child_path(path, "Cd"), config, collector);
436 }
437 }
438}
439
440#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
442pub struct NotificationCancellationReason11 {
443 #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
444 pub orgtr: Option<PartyIdentification1351>,
445 #[serde(rename = "Rsn")]
446 pub rsn: NotificationCancellationReason1Choice1,
447 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
448 pub addtl_inf: Option<Vec<String>>,
449}
450
451impl Validate for NotificationCancellationReason11 {
452 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
453 if let Some(ref val) = self.orgtr
454 && config.validate_optional_fields
455 {
456 val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
457 }
458 self.rsn
459 .validate(&helpers::child_path(path, "Rsn"), config, collector);
460 if let Some(ref vec) = self.addtl_inf {
461 for item in vec {
462 helpers::validate_length(
463 item,
464 "AddtlInf",
465 Some(1),
466 Some(105),
467 &helpers::child_path(path, "AddtlInf"),
468 config,
469 collector,
470 );
471 }
472 }
473 if let Some(ref vec) = self.addtl_inf {
474 for item in vec {
475 helpers::validate_pattern(
476 item,
477 "AddtlInf",
478 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
479 &helpers::child_path(path, "AddtlInf"),
480 config,
481 collector,
482 );
483 }
484 }
485 }
486}
487
488#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
490pub struct NotificationToReceiveCancellationAdviceV08 {
491 #[serde(rename = "GrpHdr")]
492 pub grp_hdr: GroupHeader771,
493 #[serde(rename = "OrgnlNtfctn")]
494 pub orgnl_ntfctn: OriginalNotification141,
495 #[serde(rename = "CxlRsn")]
496 pub cxl_rsn: NotificationCancellationReason11,
497}
498
499impl Validate for NotificationToReceiveCancellationAdviceV08 {
500 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
501 self.grp_hdr
502 .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
503 self.orgnl_ntfctn
504 .validate(&helpers::child_path(path, "OrgnlNtfctn"), config, collector);
505 self.cxl_rsn
506 .validate(&helpers::child_path(path, "CxlRsn"), config, collector);
507 }
508}
509
510#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
512pub struct OrganisationIdentification291 {
513 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
514 pub any_bic: Option<String>,
515 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
516 pub lei: Option<String>,
517 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
518 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
519}
520
521impl Validate for OrganisationIdentification291 {
522 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
523 if let Some(ref val) = self.any_bic {
524 helpers::validate_pattern(
525 val,
526 "AnyBIC",
527 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
528 &helpers::child_path(path, "AnyBIC"),
529 config,
530 collector,
531 );
532 }
533 if let Some(ref val) = self.lei {
534 helpers::validate_pattern(
535 val,
536 "LEI",
537 "[A-Z0-9]{18,18}[0-9]{2,2}",
538 &helpers::child_path(path, "LEI"),
539 config,
540 collector,
541 );
542 }
543 if let Some(ref vec) = self.othr
544 && config.validate_optional_fields
545 {
546 for item in vec {
547 item.validate(&helpers::child_path(path, "Othr"), config, collector);
548 }
549 }
550 }
551}
552
553#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
555pub struct OrganisationIdentificationSchemeName1Choice1 {
556 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
557 pub cd: Option<String>,
558 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
559 pub prtry: Option<String>,
560}
561
562impl Validate for OrganisationIdentificationSchemeName1Choice1 {
563 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
564 if let Some(ref val) = self.cd {
565 helpers::validate_length(
566 val,
567 "Cd",
568 Some(1),
569 Some(4),
570 &helpers::child_path(path, "Cd"),
571 config,
572 collector,
573 );
574 }
575 if let Some(ref val) = self.prtry {
576 helpers::validate_length(
577 val,
578 "Prtry",
579 Some(1),
580 Some(35),
581 &helpers::child_path(path, "Prtry"),
582 config,
583 collector,
584 );
585 }
586 if let Some(ref val) = self.prtry {
587 helpers::validate_pattern(
588 val,
589 "Prtry",
590 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
591 &helpers::child_path(path, "Prtry"),
592 config,
593 collector,
594 );
595 }
596 }
597}
598
599#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
601pub struct OriginalItem71 {
602 #[serde(rename = "OrgnlItmId")]
603 pub orgnl_itm_id: String,
604 #[serde(rename = "OrgnlEndToEndId", skip_serializing_if = "Option::is_none")]
605 pub orgnl_end_to_end_id: Option<String>,
606 #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
607 pub uetr: Option<String>,
608 #[serde(rename = "Amt")]
609 pub amt: CBPRAmount,
610 #[serde(rename = "XpctdValDt", skip_serializing_if = "Option::is_none")]
611 pub xpctd_val_dt: Option<String>,
612 #[serde(rename = "OrgnlItmRef", skip_serializing_if = "Option::is_none")]
613 pub orgnl_itm_ref: Option<OriginalItemReference61>,
614}
615
616impl Validate for OriginalItem71 {
617 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
618 helpers::validate_length(
619 &self.orgnl_itm_id,
620 "OrgnlItmId",
621 Some(1),
622 Some(16),
623 &helpers::child_path(path, "OrgnlItmId"),
624 config,
625 collector,
626 );
627 helpers::validate_pattern(
628 &self.orgnl_itm_id,
629 "OrgnlItmId",
630 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
631 &helpers::child_path(path, "OrgnlItmId"),
632 config,
633 collector,
634 );
635 if let Some(ref val) = self.orgnl_end_to_end_id {
636 helpers::validate_length(
637 val,
638 "OrgnlEndToEndId",
639 Some(1),
640 Some(35),
641 &helpers::child_path(path, "OrgnlEndToEndId"),
642 config,
643 collector,
644 );
645 }
646 if let Some(ref val) = self.orgnl_end_to_end_id {
647 helpers::validate_pattern(
648 val,
649 "OrgnlEndToEndId",
650 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
651 &helpers::child_path(path, "OrgnlEndToEndId"),
652 config,
653 collector,
654 );
655 }
656 if let Some(ref val) = self.uetr {
657 helpers::validate_pattern(
658 val,
659 "UETR",
660 "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
661 &helpers::child_path(path, "UETR"),
662 config,
663 collector,
664 );
665 }
666 self.amt
667 .validate(&helpers::child_path(path, "Amt"), config, collector);
668 if let Some(ref val) = self.orgnl_itm_ref
669 && config.validate_optional_fields
670 {
671 val.validate(&helpers::child_path(path, "OrgnlItmRef"), config, collector);
672 }
673 }
674}
675
676#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
678pub struct OriginalItemReference61 {
679 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
680 pub dbtr: Option<Party40Choice1>,
681 #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
682 pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
683}
684
685impl Validate for OriginalItemReference61 {
686 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
687 if let Some(ref val) = self.dbtr
688 && config.validate_optional_fields
689 {
690 val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
691 }
692 if let Some(ref val) = self.dbtr_agt
693 && config.validate_optional_fields
694 {
695 val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
696 }
697 }
698}
699
700#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
702pub struct OriginalNotification141 {
703 #[serde(rename = "OrgnlMsgId")]
704 pub orgnl_msg_id: String,
705 #[serde(rename = "OrgnlCreDtTm", skip_serializing_if = "Option::is_none")]
706 pub orgnl_cre_dt_tm: Option<String>,
707 #[serde(rename = "OrgnlNtfctnId")]
708 pub orgnl_ntfctn_id: String,
709 #[serde(rename = "OrgnlNtfctnRef")]
710 pub orgnl_ntfctn_ref: OriginalNotificationReference121,
711}
712
713impl Validate for OriginalNotification141 {
714 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
715 helpers::validate_length(
716 &self.orgnl_msg_id,
717 "OrgnlMsgId",
718 Some(1),
719 Some(35),
720 &helpers::child_path(path, "OrgnlMsgId"),
721 config,
722 collector,
723 );
724 helpers::validate_pattern(
725 &self.orgnl_msg_id,
726 "OrgnlMsgId",
727 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
728 &helpers::child_path(path, "OrgnlMsgId"),
729 config,
730 collector,
731 );
732 if let Some(ref val) = self.orgnl_cre_dt_tm {
733 helpers::validate_pattern(
734 val,
735 "OrgnlCreDtTm",
736 ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
737 &helpers::child_path(path, "OrgnlCreDtTm"),
738 config,
739 collector,
740 );
741 }
742 helpers::validate_length(
743 &self.orgnl_ntfctn_id,
744 "OrgnlNtfctnId",
745 Some(1),
746 Some(35),
747 &helpers::child_path(path, "OrgnlNtfctnId"),
748 config,
749 collector,
750 );
751 helpers::validate_pattern(
752 &self.orgnl_ntfctn_id,
753 "OrgnlNtfctnId",
754 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
755 &helpers::child_path(path, "OrgnlNtfctnId"),
756 config,
757 collector,
758 );
759 self.orgnl_ntfctn_ref.validate(
760 &helpers::child_path(path, "OrgnlNtfctnRef"),
761 config,
762 collector,
763 );
764 }
765}
766
767#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
769pub struct OriginalNotificationReference121 {
770 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
771 pub dbtr: Option<Party40Choice1>,
772 #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
773 pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
774 #[serde(rename = "OrgnlItm")]
775 pub orgnl_itm: Vec<OriginalItem71>,
776}
777
778impl Validate for OriginalNotificationReference121 {
779 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
780 if let Some(ref val) = self.dbtr
781 && config.validate_optional_fields
782 {
783 val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
784 }
785 if let Some(ref val) = self.dbtr_agt
786 && config.validate_optional_fields
787 {
788 val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
789 }
790 for item in &self.orgnl_itm {
791 item.validate(&helpers::child_path(path, "OrgnlItm"), config, collector);
792 }
793 }
794}
795
796#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
798pub struct Party38Choice1 {
799 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
800 pub org_id: Option<OrganisationIdentification291>,
801 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
802 pub prvt_id: Option<PersonIdentification131>,
803}
804
805impl Validate for Party38Choice1 {
806 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
807 if let Some(ref val) = self.org_id
808 && config.validate_optional_fields
809 {
810 val.validate(&helpers::child_path(path, "OrgId"), config, collector);
811 }
812 if let Some(ref val) = self.prvt_id
813 && config.validate_optional_fields
814 {
815 val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
816 }
817 }
818}
819
820#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
822pub struct Party40Choice1 {
823 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
824 pub pty: Option<PartyIdentification1351>,
825 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
826 pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
827}
828
829impl Validate for Party40Choice1 {
830 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
831 if let Some(ref val) = self.pty
832 && config.validate_optional_fields
833 {
834 val.validate(&helpers::child_path(path, "Pty"), config, collector);
835 }
836 if let Some(ref val) = self.agt
837 && config.validate_optional_fields
838 {
839 val.validate(&helpers::child_path(path, "Agt"), config, collector);
840 }
841 }
842}
843
844#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
846pub struct PartyIdentification1351 {
847 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
848 pub nm: Option<String>,
849 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
850 pub pstl_adr: Option<PostalAddress241>,
851 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
852 pub id: Option<Party38Choice1>,
853 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
854 pub ctry_of_res: Option<String>,
855}
856
857impl Validate for PartyIdentification1351 {
858 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
859 if let Some(ref val) = self.nm {
860 helpers::validate_length(
861 val,
862 "Nm",
863 Some(1),
864 Some(140),
865 &helpers::child_path(path, "Nm"),
866 config,
867 collector,
868 );
869 }
870 if let Some(ref val) = self.nm {
871 helpers::validate_pattern(
872 val,
873 "Nm",
874 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
875 &helpers::child_path(path, "Nm"),
876 config,
877 collector,
878 );
879 }
880 if let Some(ref val) = self.pstl_adr
881 && config.validate_optional_fields
882 {
883 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
884 }
885 if let Some(ref val) = self.id
886 && config.validate_optional_fields
887 {
888 val.validate(&helpers::child_path(path, "Id"), config, collector);
889 }
890 if let Some(ref val) = self.ctry_of_res {
891 helpers::validate_pattern(
892 val,
893 "CtryOfRes",
894 "[A-Z]{2,2}",
895 &helpers::child_path(path, "CtryOfRes"),
896 config,
897 collector,
898 );
899 }
900 }
901}
902
903#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
905pub struct PersonIdentification131 {
906 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
907 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
908 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
909 pub othr: Option<Vec<GenericPersonIdentification11>>,
910}
911
912impl Validate for PersonIdentification131 {
913 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
914 if let Some(ref val) = self.dt_and_plc_of_birth
915 && config.validate_optional_fields
916 {
917 val.validate(
918 &helpers::child_path(path, "DtAndPlcOfBirth"),
919 config,
920 collector,
921 );
922 }
923 if let Some(ref vec) = self.othr
924 && config.validate_optional_fields
925 {
926 for item in vec {
927 item.validate(&helpers::child_path(path, "Othr"), config, collector);
928 }
929 }
930 }
931}
932
933#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
935pub struct PersonIdentificationSchemeName1Choice1 {
936 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
937 pub cd: Option<String>,
938 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
939 pub prtry: Option<String>,
940}
941
942impl Validate for PersonIdentificationSchemeName1Choice1 {
943 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
944 if let Some(ref val) = self.cd {
945 helpers::validate_length(
946 val,
947 "Cd",
948 Some(1),
949 Some(4),
950 &helpers::child_path(path, "Cd"),
951 config,
952 collector,
953 );
954 }
955 if let Some(ref val) = self.prtry {
956 helpers::validate_length(
957 val,
958 "Prtry",
959 Some(1),
960 Some(35),
961 &helpers::child_path(path, "Prtry"),
962 config,
963 collector,
964 );
965 }
966 if let Some(ref val) = self.prtry {
967 helpers::validate_pattern(
968 val,
969 "Prtry",
970 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
971 &helpers::child_path(path, "Prtry"),
972 config,
973 collector,
974 );
975 }
976 }
977}
978
979#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
981pub struct PostalAddress241 {
982 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
983 pub dept: Option<String>,
984 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
985 pub sub_dept: Option<String>,
986 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
987 pub strt_nm: Option<String>,
988 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
989 pub bldg_nb: Option<String>,
990 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
991 pub bldg_nm: Option<String>,
992 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
993 pub flr: Option<String>,
994 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
995 pub pst_bx: Option<String>,
996 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
997 pub room: Option<String>,
998 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
999 pub pst_cd: Option<String>,
1000 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
1001 pub twn_nm: Option<String>,
1002 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1003 pub twn_lctn_nm: Option<String>,
1004 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1005 pub dstrct_nm: Option<String>,
1006 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1007 pub ctry_sub_dvsn: Option<String>,
1008 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
1009 pub ctry: Option<String>,
1010 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1011 pub adr_line: Option<Vec<String>>,
1012}
1013
1014impl Validate for PostalAddress241 {
1015 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1016 if let Some(ref val) = self.dept {
1017 helpers::validate_length(
1018 val,
1019 "Dept",
1020 Some(1),
1021 Some(70),
1022 &helpers::child_path(path, "Dept"),
1023 config,
1024 collector,
1025 );
1026 }
1027 if let Some(ref val) = self.dept {
1028 helpers::validate_pattern(
1029 val,
1030 "Dept",
1031 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1032 &helpers::child_path(path, "Dept"),
1033 config,
1034 collector,
1035 );
1036 }
1037 if let Some(ref val) = self.sub_dept {
1038 helpers::validate_length(
1039 val,
1040 "SubDept",
1041 Some(1),
1042 Some(70),
1043 &helpers::child_path(path, "SubDept"),
1044 config,
1045 collector,
1046 );
1047 }
1048 if let Some(ref val) = self.sub_dept {
1049 helpers::validate_pattern(
1050 val,
1051 "SubDept",
1052 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1053 &helpers::child_path(path, "SubDept"),
1054 config,
1055 collector,
1056 );
1057 }
1058 if let Some(ref val) = self.strt_nm {
1059 helpers::validate_length(
1060 val,
1061 "StrtNm",
1062 Some(1),
1063 Some(70),
1064 &helpers::child_path(path, "StrtNm"),
1065 config,
1066 collector,
1067 );
1068 }
1069 if let Some(ref val) = self.strt_nm {
1070 helpers::validate_pattern(
1071 val,
1072 "StrtNm",
1073 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1074 &helpers::child_path(path, "StrtNm"),
1075 config,
1076 collector,
1077 );
1078 }
1079 if let Some(ref val) = self.bldg_nb {
1080 helpers::validate_length(
1081 val,
1082 "BldgNb",
1083 Some(1),
1084 Some(16),
1085 &helpers::child_path(path, "BldgNb"),
1086 config,
1087 collector,
1088 );
1089 }
1090 if let Some(ref val) = self.bldg_nb {
1091 helpers::validate_pattern(
1092 val,
1093 "BldgNb",
1094 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1095 &helpers::child_path(path, "BldgNb"),
1096 config,
1097 collector,
1098 );
1099 }
1100 if let Some(ref val) = self.bldg_nm {
1101 helpers::validate_length(
1102 val,
1103 "BldgNm",
1104 Some(1),
1105 Some(35),
1106 &helpers::child_path(path, "BldgNm"),
1107 config,
1108 collector,
1109 );
1110 }
1111 if let Some(ref val) = self.bldg_nm {
1112 helpers::validate_pattern(
1113 val,
1114 "BldgNm",
1115 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1116 &helpers::child_path(path, "BldgNm"),
1117 config,
1118 collector,
1119 );
1120 }
1121 if let Some(ref val) = self.flr {
1122 helpers::validate_length(
1123 val,
1124 "Flr",
1125 Some(1),
1126 Some(70),
1127 &helpers::child_path(path, "Flr"),
1128 config,
1129 collector,
1130 );
1131 }
1132 if let Some(ref val) = self.flr {
1133 helpers::validate_pattern(
1134 val,
1135 "Flr",
1136 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1137 &helpers::child_path(path, "Flr"),
1138 config,
1139 collector,
1140 );
1141 }
1142 if let Some(ref val) = self.pst_bx {
1143 helpers::validate_length(
1144 val,
1145 "PstBx",
1146 Some(1),
1147 Some(16),
1148 &helpers::child_path(path, "PstBx"),
1149 config,
1150 collector,
1151 );
1152 }
1153 if let Some(ref val) = self.pst_bx {
1154 helpers::validate_pattern(
1155 val,
1156 "PstBx",
1157 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1158 &helpers::child_path(path, "PstBx"),
1159 config,
1160 collector,
1161 );
1162 }
1163 if let Some(ref val) = self.room {
1164 helpers::validate_length(
1165 val,
1166 "Room",
1167 Some(1),
1168 Some(70),
1169 &helpers::child_path(path, "Room"),
1170 config,
1171 collector,
1172 );
1173 }
1174 if let Some(ref val) = self.room {
1175 helpers::validate_pattern(
1176 val,
1177 "Room",
1178 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1179 &helpers::child_path(path, "Room"),
1180 config,
1181 collector,
1182 );
1183 }
1184 if let Some(ref val) = self.pst_cd {
1185 helpers::validate_length(
1186 val,
1187 "PstCd",
1188 Some(1),
1189 Some(16),
1190 &helpers::child_path(path, "PstCd"),
1191 config,
1192 collector,
1193 );
1194 }
1195 if let Some(ref val) = self.pst_cd {
1196 helpers::validate_pattern(
1197 val,
1198 "PstCd",
1199 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1200 &helpers::child_path(path, "PstCd"),
1201 config,
1202 collector,
1203 );
1204 }
1205 if let Some(ref val) = self.twn_nm {
1206 helpers::validate_length(
1207 val,
1208 "TwnNm",
1209 Some(1),
1210 Some(35),
1211 &helpers::child_path(path, "TwnNm"),
1212 config,
1213 collector,
1214 );
1215 }
1216 if let Some(ref val) = self.twn_nm {
1217 helpers::validate_pattern(
1218 val,
1219 "TwnNm",
1220 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1221 &helpers::child_path(path, "TwnNm"),
1222 config,
1223 collector,
1224 );
1225 }
1226 if let Some(ref val) = self.twn_lctn_nm {
1227 helpers::validate_length(
1228 val,
1229 "TwnLctnNm",
1230 Some(1),
1231 Some(35),
1232 &helpers::child_path(path, "TwnLctnNm"),
1233 config,
1234 collector,
1235 );
1236 }
1237 if let Some(ref val) = self.twn_lctn_nm {
1238 helpers::validate_pattern(
1239 val,
1240 "TwnLctnNm",
1241 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1242 &helpers::child_path(path, "TwnLctnNm"),
1243 config,
1244 collector,
1245 );
1246 }
1247 if let Some(ref val) = self.dstrct_nm {
1248 helpers::validate_length(
1249 val,
1250 "DstrctNm",
1251 Some(1),
1252 Some(35),
1253 &helpers::child_path(path, "DstrctNm"),
1254 config,
1255 collector,
1256 );
1257 }
1258 if let Some(ref val) = self.dstrct_nm {
1259 helpers::validate_pattern(
1260 val,
1261 "DstrctNm",
1262 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1263 &helpers::child_path(path, "DstrctNm"),
1264 config,
1265 collector,
1266 );
1267 }
1268 if let Some(ref val) = self.ctry_sub_dvsn {
1269 helpers::validate_length(
1270 val,
1271 "CtrySubDvsn",
1272 Some(1),
1273 Some(35),
1274 &helpers::child_path(path, "CtrySubDvsn"),
1275 config,
1276 collector,
1277 );
1278 }
1279 if let Some(ref val) = self.ctry_sub_dvsn {
1280 helpers::validate_pattern(
1281 val,
1282 "CtrySubDvsn",
1283 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1284 &helpers::child_path(path, "CtrySubDvsn"),
1285 config,
1286 collector,
1287 );
1288 }
1289 if let Some(ref val) = self.ctry {
1290 helpers::validate_pattern(
1291 val,
1292 "Ctry",
1293 "[A-Z]{2,2}",
1294 &helpers::child_path(path, "Ctry"),
1295 config,
1296 collector,
1297 );
1298 }
1299 if let Some(ref vec) = self.adr_line {
1300 for item in vec {
1301 helpers::validate_length(
1302 item,
1303 "AdrLine",
1304 Some(1),
1305 Some(70),
1306 &helpers::child_path(path, "AdrLine"),
1307 config,
1308 collector,
1309 );
1310 }
1311 }
1312 if let Some(ref vec) = self.adr_line {
1313 for item in vec {
1314 helpers::validate_pattern(
1315 item,
1316 "AdrLine",
1317 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1318 &helpers::child_path(path, "AdrLine"),
1319 config,
1320 collector,
1321 );
1322 }
1323 }
1324 }
1325}