mx_message/document/
camt_029_001_09.rs

1// Plasmatic MX Message Parsing Library
2// https://github.com/GoPlasmatic/MXMessage
3//
4// Copyright (c) 2025 Plasmatic
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9//     http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// You may obtain a copy of this library at
18// https://github.com/GoPlasmatic/MXMessage
19use crate::parse_result::{ErrorCollector, ParserConfig};
20use crate::validation::{Validate, helpers};
21use serde::{Deserialize, Serialize};
22
23// BranchAndFinancialInstitutionIdentification61: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
24#[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// BranchAndFinancialInstitutionIdentification62: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
38#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
39pub struct BranchAndFinancialInstitutionIdentification62 {
40    #[serde(rename = "FinInstnId")]
41    pub fin_instn_id: FinancialInstitutionIdentification182,
42}
43
44impl Validate for BranchAndFinancialInstitutionIdentification62 {
45    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
46        self.fin_instn_id
47            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
48    }
49}
50
51// CBPR_CancellationStatus: A final response rejecting the request to cancel. In this case, an additional reason is required.
52#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
53pub enum CBPRCancellationStatus {
54    #[default]
55    #[serde(rename = "CNCL")]
56    CodeCNCL,
57    #[serde(rename = "PDCR")]
58    CodePDCR,
59    #[serde(rename = "RJCR")]
60    CodeRJCR,
61}
62
63impl Validate for CBPRCancellationStatus {
64    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
65        // Enum validation is typically empty
66    }
67}
68
69// CBPR_CancellationStatusReasonCode: Reason is provided as narrative information in the additional reason information.
70#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
71pub enum CBPRCancellationStatusReasonCode {
72    #[default]
73    #[serde(rename = "NOOR")]
74    CodeNOOR,
75    #[serde(rename = "NOAS")]
76    CodeNOAS,
77    #[serde(rename = "ARDT")]
78    CodeARDT,
79    #[serde(rename = "CUST")]
80    CodeCUST,
81    #[serde(rename = "AGNT")]
82    CodeAGNT,
83    #[serde(rename = "LEGL")]
84    CodeLEGL,
85    #[serde(rename = "AC04")]
86    CodeAC04,
87    #[serde(rename = "AM04")]
88    CodeAM04,
89    #[serde(rename = "PTNA")]
90    CodePTNA,
91    #[serde(rename = "RQDA")]
92    CodeRQDA,
93    #[serde(rename = "INDM")]
94    CodeINDM,
95    #[serde(rename = "NARR")]
96    CodeNARR,
97}
98
99impl Validate for CBPRCancellationStatusReasonCode {
100    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
101        // Enum validation is typically empty
102    }
103}
104
105// CancellationStatusReason3Choice1: Reason for the cancellation status, in a coded form.
106#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
107pub struct CancellationStatusReason3Choice1 {
108    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
109    pub cd: Option<CBPRCancellationStatusReasonCode>,
110}
111
112impl Validate for CancellationStatusReason3Choice1 {
113    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
114        if let Some(ref val) = self.cd
115            && config.validate_optional_fields
116        {
117            val.validate(&helpers::child_path(path, "Cd"), config, collector);
118        }
119    }
120}
121
122// CancellationStatusReason41: Further details on the cancellation status reason.
123#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
124pub struct CancellationStatusReason41 {
125    #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
126    pub orgtr: Option<PartyIdentification1352>,
127    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
128    pub rsn: Option<CancellationStatusReason3Choice1>,
129    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
130    pub addtl_inf: Option<Vec<String>>,
131}
132
133impl Validate for CancellationStatusReason41 {
134    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
135        if let Some(ref val) = self.orgtr
136            && config.validate_optional_fields
137        {
138            val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
139        }
140        if let Some(ref val) = self.rsn
141            && config.validate_optional_fields
142        {
143            val.validate(&helpers::child_path(path, "Rsn"), config, collector);
144        }
145        if let Some(ref vec) = self.addtl_inf {
146            for item in vec {
147                helpers::validate_length(
148                    item,
149                    "AddtlInf",
150                    Some(1),
151                    Some(105),
152                    &helpers::child_path(path, "AddtlInf"),
153                    config,
154                    collector,
155                );
156            }
157        }
158        if let Some(ref vec) = self.addtl_inf {
159            for item in vec {
160                helpers::validate_pattern(
161                    item,
162                    "AddtlInf",
163                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
164                    &helpers::child_path(path, "AddtlInf"),
165                    config,
166                    collector,
167                );
168            }
169        }
170    }
171}
172
173// Case51: Party that created the investigation case.
174#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
175pub struct Case51 {
176    #[serde(rename = "Id")]
177    pub id: String,
178    #[serde(rename = "Cretr")]
179    pub cretr: Party40Choice2,
180}
181
182impl Validate for Case51 {
183    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
184        helpers::validate_length(
185            &self.id,
186            "Id",
187            Some(1),
188            Some(16),
189            &helpers::child_path(path, "Id"),
190            config,
191            collector,
192        );
193        helpers::validate_pattern(
194            &self.id,
195            "Id",
196            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
197            &helpers::child_path(path, "Id"),
198            config,
199            collector,
200        );
201        self.cretr
202            .validate(&helpers::child_path(path, "Cretr"), config, collector);
203    }
204}
205
206// CaseAssignment51: Date and time at which the assignment was created.
207#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
208pub struct CaseAssignment51 {
209    #[serde(rename = "Id")]
210    pub id: String,
211    #[serde(rename = "Assgnr")]
212    pub assgnr: Party40Choice1,
213    #[serde(rename = "Assgne")]
214    pub assgne: Party40Choice1,
215    #[serde(rename = "CreDtTm")]
216    pub cre_dt_tm: String,
217}
218
219impl Validate for CaseAssignment51 {
220    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
221        helpers::validate_length(
222            &self.id,
223            "Id",
224            Some(1),
225            Some(35),
226            &helpers::child_path(path, "Id"),
227            config,
228            collector,
229        );
230        helpers::validate_pattern(
231            &self.id,
232            "Id",
233            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
234            &helpers::child_path(path, "Id"),
235            config,
236            collector,
237        );
238        self.assgnr
239            .validate(&helpers::child_path(path, "Assgnr"), config, collector);
240        self.assgne
241            .validate(&helpers::child_path(path, "Assgne"), config, collector);
242        helpers::validate_pattern(
243            &self.cre_dt_tm,
244            "CreDtTm",
245            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
246            &helpers::child_path(path, "CreDtTm"),
247            config,
248            collector,
249        );
250    }
251}
252
253// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
254#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
255pub struct ClearingSystemIdentification2Choice1 {
256    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
257    pub cd: Option<String>,
258}
259
260impl Validate for ClearingSystemIdentification2Choice1 {
261    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
262        if let Some(ref val) = self.cd {
263            helpers::validate_length(
264                val,
265                "Cd",
266                Some(1),
267                Some(5),
268                &helpers::child_path(path, "Cd"),
269                config,
270                collector,
271            );
272        }
273    }
274}
275
276// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
277#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
278pub struct ClearingSystemMemberIdentification21 {
279    #[serde(rename = "ClrSysId")]
280    pub clr_sys_id: ClearingSystemIdentification2Choice1,
281    #[serde(rename = "MmbId")]
282    pub mmb_id: String,
283}
284
285impl Validate for ClearingSystemMemberIdentification21 {
286    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
287        self.clr_sys_id
288            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
289        helpers::validate_length(
290            &self.mmb_id,
291            "MmbId",
292            Some(1),
293            Some(28),
294            &helpers::child_path(path, "MmbId"),
295            config,
296            collector,
297        );
298        helpers::validate_pattern(
299            &self.mmb_id,
300            "MmbId",
301            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
302            &helpers::child_path(path, "MmbId"),
303            config,
304            collector,
305        );
306    }
307}
308
309// DateAndPlaceOfBirth11: Country where a person was born.
310#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
311pub struct DateAndPlaceOfBirth11 {
312    #[serde(rename = "BirthDt")]
313    pub birth_dt: String,
314    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
315    pub prvc_of_birth: Option<String>,
316    #[serde(rename = "CityOfBirth")]
317    pub city_of_birth: String,
318    #[serde(rename = "CtryOfBirth")]
319    pub ctry_of_birth: String,
320}
321
322impl Validate for DateAndPlaceOfBirth11 {
323    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
324        if let Some(ref val) = self.prvc_of_birth {
325            helpers::validate_length(
326                val,
327                "PrvcOfBirth",
328                Some(1),
329                Some(35),
330                &helpers::child_path(path, "PrvcOfBirth"),
331                config,
332                collector,
333            );
334        }
335        if let Some(ref val) = self.prvc_of_birth {
336            helpers::validate_pattern(
337                val,
338                "PrvcOfBirth",
339                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
340                &helpers::child_path(path, "PrvcOfBirth"),
341                config,
342                collector,
343            );
344        }
345        helpers::validate_length(
346            &self.city_of_birth,
347            "CityOfBirth",
348            Some(1),
349            Some(35),
350            &helpers::child_path(path, "CityOfBirth"),
351            config,
352            collector,
353        );
354        helpers::validate_pattern(
355            &self.city_of_birth,
356            "CityOfBirth",
357            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
358            &helpers::child_path(path, "CityOfBirth"),
359            config,
360            collector,
361        );
362        helpers::validate_pattern(
363            &self.ctry_of_birth,
364            "CtryOfBirth",
365            "[A-Z]{2,2}",
366            &helpers::child_path(path, "CtryOfBirth"),
367            config,
368            collector,
369        );
370    }
371}
372
373// DateAndPlaceOfBirth12: Country where a person was born.
374#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
375pub struct DateAndPlaceOfBirth12 {
376    #[serde(rename = "BirthDt")]
377    pub birth_dt: String,
378    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
379    pub prvc_of_birth: Option<String>,
380    #[serde(rename = "CityOfBirth")]
381    pub city_of_birth: String,
382    #[serde(rename = "CtryOfBirth")]
383    pub ctry_of_birth: String,
384}
385
386impl Validate for DateAndPlaceOfBirth12 {
387    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
388        if let Some(ref val) = self.prvc_of_birth {
389            helpers::validate_length(
390                val,
391                "PrvcOfBirth",
392                Some(1),
393                Some(35),
394                &helpers::child_path(path, "PrvcOfBirth"),
395                config,
396                collector,
397            );
398        }
399        if let Some(ref val) = self.prvc_of_birth {
400            helpers::validate_pattern(
401                val,
402                "PrvcOfBirth",
403                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
404                &helpers::child_path(path, "PrvcOfBirth"),
405                config,
406                collector,
407            );
408        }
409        helpers::validate_length(
410            &self.city_of_birth,
411            "CityOfBirth",
412            Some(1),
413            Some(35),
414            &helpers::child_path(path, "CityOfBirth"),
415            config,
416            collector,
417        );
418        helpers::validate_pattern(
419            &self.city_of_birth,
420            "CityOfBirth",
421            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
422            &helpers::child_path(path, "CityOfBirth"),
423            config,
424            collector,
425        );
426        helpers::validate_pattern(
427            &self.ctry_of_birth,
428            "CtryOfBirth",
429            "[A-Z]{2,2}",
430            &helpers::child_path(path, "CtryOfBirth"),
431            config,
432            collector,
433        );
434    }
435}
436
437// FinancialInstitutionIdentification181: Legal entity identifier of the financial institution.
438#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
439pub struct FinancialInstitutionIdentification181 {
440    #[serde(rename = "BICFI")]
441    pub bicfi: String,
442    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
443    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
444    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
445    pub lei: Option<String>,
446}
447
448impl Validate for FinancialInstitutionIdentification181 {
449    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
450        helpers::validate_pattern(
451            &self.bicfi,
452            "BICFI",
453            "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
454            &helpers::child_path(path, "BICFI"),
455            config,
456            collector,
457        );
458        if let Some(ref val) = self.clr_sys_mmb_id
459            && config.validate_optional_fields
460        {
461            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
462        }
463        if let Some(ref val) = self.lei {
464            helpers::validate_pattern(
465                val,
466                "LEI",
467                "[A-Z0-9]{18,18}[0-9]{2,2}",
468                &helpers::child_path(path, "LEI"),
469                config,
470                collector,
471            );
472        }
473    }
474}
475
476// FinancialInstitutionIdentification182: Information that locates and identifies a specific address, as defined by postal services.
477#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
478pub struct FinancialInstitutionIdentification182 {
479    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
480    pub bicfi: Option<String>,
481    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
482    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
483    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
484    pub lei: Option<String>,
485    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
486    pub nm: Option<String>,
487    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
488    pub pstl_adr: Option<PostalAddress241>,
489}
490
491impl Validate for FinancialInstitutionIdentification182 {
492    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
493        if let Some(ref val) = self.bicfi {
494            helpers::validate_pattern(
495                val,
496                "BICFI",
497                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
498                &helpers::child_path(path, "BICFI"),
499                config,
500                collector,
501            );
502        }
503        if let Some(ref val) = self.clr_sys_mmb_id
504            && config.validate_optional_fields
505        {
506            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
507        }
508        if let Some(ref val) = self.lei {
509            helpers::validate_pattern(
510                val,
511                "LEI",
512                "[A-Z0-9]{18,18}[0-9]{2,2}",
513                &helpers::child_path(path, "LEI"),
514                config,
515                collector,
516            );
517        }
518        if let Some(ref val) = self.nm {
519            helpers::validate_length(
520                val,
521                "Nm",
522                Some(1),
523                Some(140),
524                &helpers::child_path(path, "Nm"),
525                config,
526                collector,
527            );
528        }
529        if let Some(ref val) = self.nm {
530            helpers::validate_pattern(
531                val,
532                "Nm",
533                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
534                &helpers::child_path(path, "Nm"),
535                config,
536                collector,
537            );
538        }
539        if let Some(ref val) = self.pstl_adr
540            && config.validate_optional_fields
541        {
542            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
543        }
544    }
545}
546
547// GenericOrganisationIdentification11: Entity that assigns the identification.
548#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
549pub struct GenericOrganisationIdentification11 {
550    #[serde(rename = "Id")]
551    pub id: String,
552    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
553    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
554    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
555    pub issr: Option<String>,
556}
557
558impl Validate for GenericOrganisationIdentification11 {
559    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
560        helpers::validate_length(
561            &self.id,
562            "Id",
563            Some(1),
564            Some(35),
565            &helpers::child_path(path, "Id"),
566            config,
567            collector,
568        );
569        helpers::validate_pattern(
570            &self.id,
571            "Id",
572            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
573            &helpers::child_path(path, "Id"),
574            config,
575            collector,
576        );
577        if let Some(ref val) = self.schme_nm
578            && config.validate_optional_fields
579        {
580            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
581        }
582        if let Some(ref val) = self.issr {
583            helpers::validate_length(
584                val,
585                "Issr",
586                Some(1),
587                Some(35),
588                &helpers::child_path(path, "Issr"),
589                config,
590                collector,
591            );
592        }
593        if let Some(ref val) = self.issr {
594            helpers::validate_pattern(
595                val,
596                "Issr",
597                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
598                &helpers::child_path(path, "Issr"),
599                config,
600                collector,
601            );
602        }
603    }
604}
605
606// GenericPersonIdentification11: Entity that assigns the identification.
607#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
608pub struct GenericPersonIdentification11 {
609    #[serde(rename = "Id")]
610    pub id: String,
611    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
612    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
613    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
614    pub issr: Option<String>,
615}
616
617impl Validate for GenericPersonIdentification11 {
618    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
619        helpers::validate_length(
620            &self.id,
621            "Id",
622            Some(1),
623            Some(35),
624            &helpers::child_path(path, "Id"),
625            config,
626            collector,
627        );
628        helpers::validate_pattern(
629            &self.id,
630            "Id",
631            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
632            &helpers::child_path(path, "Id"),
633            config,
634            collector,
635        );
636        if let Some(ref val) = self.schme_nm
637            && config.validate_optional_fields
638        {
639            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
640        }
641        if let Some(ref val) = self.issr {
642            helpers::validate_length(
643                val,
644                "Issr",
645                Some(1),
646                Some(35),
647                &helpers::child_path(path, "Issr"),
648                config,
649                collector,
650            );
651        }
652        if let Some(ref val) = self.issr {
653            helpers::validate_pattern(
654                val,
655                "Issr",
656                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
657                &helpers::child_path(path, "Issr"),
658                config,
659                collector,
660            );
661        }
662    }
663}
664
665// InvestigationStatus5Choice1: Specifies the status of the investigation, in a coded form.
666#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
667pub struct InvestigationStatus5Choice1 {
668    #[serde(rename = "Conf", skip_serializing_if = "Option::is_none")]
669    pub conf: Option<CBPRCancellationStatus>,
670}
671
672impl Validate for InvestigationStatus5Choice1 {
673    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
674        if let Some(ref val) = self.conf
675            && config.validate_optional_fields
676        {
677            val.validate(&helpers::child_path(path, "Conf"), config, collector);
678        }
679    }
680}
681
682// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
683#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
684pub struct OrganisationIdentification291 {
685    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
686    pub any_bic: Option<String>,
687    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
688    pub lei: Option<String>,
689    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
690    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
691}
692
693impl Validate for OrganisationIdentification291 {
694    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
695        if let Some(ref val) = self.any_bic {
696            helpers::validate_pattern(
697                val,
698                "AnyBIC",
699                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
700                &helpers::child_path(path, "AnyBIC"),
701                config,
702                collector,
703            );
704        }
705        if let Some(ref val) = self.lei {
706            helpers::validate_pattern(
707                val,
708                "LEI",
709                "[A-Z0-9]{18,18}[0-9]{2,2}",
710                &helpers::child_path(path, "LEI"),
711                config,
712                collector,
713            );
714        }
715        if let Some(ref vec) = self.othr
716            && config.validate_optional_fields
717        {
718            for item in vec {
719                item.validate(&helpers::child_path(path, "Othr"), config, collector);
720            }
721        }
722    }
723}
724
725// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
726#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
727pub struct OrganisationIdentificationSchemeName1Choice1 {
728    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
729    pub cd: Option<String>,
730    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
731    pub prtry: Option<String>,
732}
733
734impl Validate for OrganisationIdentificationSchemeName1Choice1 {
735    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
736        if let Some(ref val) = self.cd {
737            helpers::validate_length(
738                val,
739                "Cd",
740                Some(1),
741                Some(4),
742                &helpers::child_path(path, "Cd"),
743                config,
744                collector,
745            );
746        }
747        if let Some(ref val) = self.prtry {
748            helpers::validate_length(
749                val,
750                "Prtry",
751                Some(1),
752                Some(35),
753                &helpers::child_path(path, "Prtry"),
754                config,
755                collector,
756            );
757        }
758        if let Some(ref val) = self.prtry {
759            helpers::validate_pattern(
760                val,
761                "Prtry",
762                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
763                &helpers::child_path(path, "Prtry"),
764                config,
765                collector,
766            );
767        }
768    }
769}
770
771// OriginalGroupInformation291: Original date and time at which the message was created.
772#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
773pub struct OriginalGroupInformation291 {
774    #[serde(rename = "OrgnlMsgId")]
775    pub orgnl_msg_id: String,
776    #[serde(rename = "OrgnlMsgNmId")]
777    pub orgnl_msg_nm_id: String,
778    #[serde(rename = "OrgnlCreDtTm", skip_serializing_if = "Option::is_none")]
779    pub orgnl_cre_dt_tm: Option<String>,
780}
781
782impl Validate for OriginalGroupInformation291 {
783    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
784        helpers::validate_length(
785            &self.orgnl_msg_id,
786            "OrgnlMsgId",
787            Some(1),
788            Some(35),
789            &helpers::child_path(path, "OrgnlMsgId"),
790            config,
791            collector,
792        );
793        helpers::validate_pattern(
794            &self.orgnl_msg_id,
795            "OrgnlMsgId",
796            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
797            &helpers::child_path(path, "OrgnlMsgId"),
798            config,
799            collector,
800        );
801        helpers::validate_length(
802            &self.orgnl_msg_nm_id,
803            "OrgnlMsgNmId",
804            Some(1),
805            Some(35),
806            &helpers::child_path(path, "OrgnlMsgNmId"),
807            config,
808            collector,
809        );
810        helpers::validate_pattern(
811            &self.orgnl_msg_nm_id,
812            "OrgnlMsgNmId",
813            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
814            &helpers::child_path(path, "OrgnlMsgNmId"),
815            config,
816            collector,
817        );
818        if let Some(ref val) = self.orgnl_cre_dt_tm {
819            helpers::validate_pattern(
820                val,
821                "OrgnlCreDtTm",
822                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
823                &helpers::child_path(path, "OrgnlCreDtTm"),
824                config,
825                collector,
826            );
827        }
828    }
829}
830
831// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
832#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
833pub struct Party38Choice1 {
834    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
835    pub org_id: Option<OrganisationIdentification291>,
836    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
837    pub prvt_id: Option<PersonIdentification131>,
838}
839
840impl Validate for Party38Choice1 {
841    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
842        if let Some(ref val) = self.org_id
843            && config.validate_optional_fields
844        {
845            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
846        }
847        if let Some(ref val) = self.prvt_id
848            && config.validate_optional_fields
849        {
850            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
851        }
852    }
853}
854
855// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
856#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
857pub struct Party38Choice2 {
858    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
859    pub org_id: Option<OrganisationIdentification291>,
860    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
861    pub prvt_id: Option<PersonIdentification132>,
862}
863
864impl Validate for Party38Choice2 {
865    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
866        if let Some(ref val) = self.org_id
867            && config.validate_optional_fields
868        {
869            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
870        }
871        if let Some(ref val) = self.prvt_id
872            && config.validate_optional_fields
873        {
874            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
875        }
876    }
877}
878
879// Party40Choice1: Identification of a financial institution.
880#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
881pub struct Party40Choice1 {
882    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
883    pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
884}
885
886impl Validate for Party40Choice1 {
887    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
888        if let Some(ref val) = self.agt
889            && config.validate_optional_fields
890        {
891            val.validate(&helpers::child_path(path, "Agt"), config, collector);
892        }
893    }
894}
895
896// Party40Choice2: Identification of a financial institution.
897#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
898pub struct Party40Choice2 {
899    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
900    pub pty: Option<PartyIdentification1351>,
901    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
902    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
903}
904
905impl Validate for Party40Choice2 {
906    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
907        if let Some(ref val) = self.pty
908            && config.validate_optional_fields
909        {
910            val.validate(&helpers::child_path(path, "Pty"), config, collector);
911        }
912        if let Some(ref val) = self.agt
913            && config.validate_optional_fields
914        {
915            val.validate(&helpers::child_path(path, "Agt"), config, collector);
916        }
917    }
918}
919
920// PartyIdentification1351: Country in which a person resides (the place of a person's home). In the case of a company, it is the country from which the affairs of that company are directed.
921#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
922pub struct PartyIdentification1351 {
923    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
924    pub nm: Option<String>,
925    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
926    pub pstl_adr: Option<PostalAddress241>,
927    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
928    pub id: Option<Party38Choice1>,
929    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
930    pub ctry_of_res: Option<String>,
931}
932
933impl Validate for PartyIdentification1351 {
934    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
935        if let Some(ref val) = self.nm {
936            helpers::validate_length(
937                val,
938                "Nm",
939                Some(1),
940                Some(140),
941                &helpers::child_path(path, "Nm"),
942                config,
943                collector,
944            );
945        }
946        if let Some(ref val) = self.nm {
947            helpers::validate_pattern(
948                val,
949                "Nm",
950                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
951                &helpers::child_path(path, "Nm"),
952                config,
953                collector,
954            );
955        }
956        if let Some(ref val) = self.pstl_adr
957            && config.validate_optional_fields
958        {
959            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
960        }
961        if let Some(ref val) = self.id
962            && config.validate_optional_fields
963        {
964            val.validate(&helpers::child_path(path, "Id"), config, collector);
965        }
966        if let Some(ref val) = self.ctry_of_res {
967            helpers::validate_pattern(
968                val,
969                "CtryOfRes",
970                "[A-Z]{2,2}",
971                &helpers::child_path(path, "CtryOfRes"),
972                config,
973                collector,
974            );
975        }
976    }
977}
978
979// PartyIdentification1352: Country in which a person resides (the place of a person's home). In the case of a company, it is the country from which the affairs of that company are directed.
980#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
981pub struct PartyIdentification1352 {
982    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
983    pub nm: Option<String>,
984    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
985    pub pstl_adr: Option<PostalAddress241>,
986    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
987    pub id: Option<Party38Choice2>,
988    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
989    pub ctry_of_res: Option<String>,
990}
991
992impl Validate for PartyIdentification1352 {
993    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
994        if let Some(ref val) = self.nm {
995            helpers::validate_length(
996                val,
997                "Nm",
998                Some(1),
999                Some(140),
1000                &helpers::child_path(path, "Nm"),
1001                config,
1002                collector,
1003            );
1004        }
1005        if let Some(ref val) = self.nm {
1006            helpers::validate_pattern(
1007                val,
1008                "Nm",
1009                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1010                &helpers::child_path(path, "Nm"),
1011                config,
1012                collector,
1013            );
1014        }
1015        if let Some(ref val) = self.pstl_adr
1016            && config.validate_optional_fields
1017        {
1018            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1019        }
1020        if let Some(ref val) = self.id
1021            && config.validate_optional_fields
1022        {
1023            val.validate(&helpers::child_path(path, "Id"), config, collector);
1024        }
1025        if let Some(ref val) = self.ctry_of_res {
1026            helpers::validate_pattern(
1027                val,
1028                "CtryOfRes",
1029                "[A-Z]{2,2}",
1030                &helpers::child_path(path, "CtryOfRes"),
1031                config,
1032                collector,
1033            );
1034        }
1035    }
1036}
1037
1038// PaymentTransaction1021: Provides detailed information on the cancellation status reason.
1039#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1040pub struct PaymentTransaction1021 {
1041    #[serde(rename = "CxlStsId")]
1042    pub cxl_sts_id: String,
1043    #[serde(rename = "RslvdCase")]
1044    pub rslvd_case: Case51,
1045    #[serde(rename = "OrgnlGrpInf")]
1046    pub orgnl_grp_inf: OriginalGroupInformation291,
1047    #[serde(rename = "OrgnlInstrId", skip_serializing_if = "Option::is_none")]
1048    pub orgnl_instr_id: Option<String>,
1049    #[serde(rename = "OrgnlEndToEndId", skip_serializing_if = "Option::is_none")]
1050    pub orgnl_end_to_end_id: Option<String>,
1051    #[serde(rename = "OrgnlTxId", skip_serializing_if = "Option::is_none")]
1052    pub orgnl_tx_id: Option<String>,
1053    #[serde(rename = "OrgnlClrSysRef", skip_serializing_if = "Option::is_none")]
1054    pub orgnl_clr_sys_ref: Option<String>,
1055    #[serde(rename = "OrgnlUETR")]
1056    pub orgnl_uetr: String,
1057    #[serde(rename = "CxlStsRsnInf", skip_serializing_if = "Option::is_none")]
1058    pub cxl_sts_rsn_inf: Option<CancellationStatusReason41>,
1059}
1060
1061impl Validate for PaymentTransaction1021 {
1062    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1063        helpers::validate_length(
1064            &self.cxl_sts_id,
1065            "CxlStsId",
1066            Some(1),
1067            Some(16),
1068            &helpers::child_path(path, "CxlStsId"),
1069            config,
1070            collector,
1071        );
1072        helpers::validate_pattern(
1073            &self.cxl_sts_id,
1074            "CxlStsId",
1075            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1076            &helpers::child_path(path, "CxlStsId"),
1077            config,
1078            collector,
1079        );
1080        self.rslvd_case
1081            .validate(&helpers::child_path(path, "RslvdCase"), config, collector);
1082        self.orgnl_grp_inf
1083            .validate(&helpers::child_path(path, "OrgnlGrpInf"), config, collector);
1084        if let Some(ref val) = self.orgnl_instr_id {
1085            helpers::validate_length(
1086                val,
1087                "OrgnlInstrId",
1088                Some(1),
1089                Some(16),
1090                &helpers::child_path(path, "OrgnlInstrId"),
1091                config,
1092                collector,
1093            );
1094        }
1095        if let Some(ref val) = self.orgnl_instr_id {
1096            helpers::validate_pattern(
1097                val,
1098                "OrgnlInstrId",
1099                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1100                &helpers::child_path(path, "OrgnlInstrId"),
1101                config,
1102                collector,
1103            );
1104        }
1105        if let Some(ref val) = self.orgnl_end_to_end_id {
1106            helpers::validate_length(
1107                val,
1108                "OrgnlEndToEndId",
1109                Some(1),
1110                Some(35),
1111                &helpers::child_path(path, "OrgnlEndToEndId"),
1112                config,
1113                collector,
1114            );
1115        }
1116        if let Some(ref val) = self.orgnl_end_to_end_id {
1117            helpers::validate_pattern(
1118                val,
1119                "OrgnlEndToEndId",
1120                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1121                &helpers::child_path(path, "OrgnlEndToEndId"),
1122                config,
1123                collector,
1124            );
1125        }
1126        if let Some(ref val) = self.orgnl_tx_id {
1127            helpers::validate_length(
1128                val,
1129                "OrgnlTxId",
1130                Some(1),
1131                Some(35),
1132                &helpers::child_path(path, "OrgnlTxId"),
1133                config,
1134                collector,
1135            );
1136        }
1137        if let Some(ref val) = self.orgnl_tx_id {
1138            helpers::validate_pattern(
1139                val,
1140                "OrgnlTxId",
1141                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1142                &helpers::child_path(path, "OrgnlTxId"),
1143                config,
1144                collector,
1145            );
1146        }
1147        if let Some(ref val) = self.orgnl_clr_sys_ref {
1148            helpers::validate_length(
1149                val,
1150                "OrgnlClrSysRef",
1151                Some(1),
1152                Some(35),
1153                &helpers::child_path(path, "OrgnlClrSysRef"),
1154                config,
1155                collector,
1156            );
1157        }
1158        if let Some(ref val) = self.orgnl_clr_sys_ref {
1159            helpers::validate_pattern(
1160                val,
1161                "OrgnlClrSysRef",
1162                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1163                &helpers::child_path(path, "OrgnlClrSysRef"),
1164                config,
1165                collector,
1166            );
1167        }
1168        helpers::validate_pattern(
1169            &self.orgnl_uetr,
1170            "OrgnlUETR",
1171            "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
1172            &helpers::child_path(path, "OrgnlUETR"),
1173            config,
1174            collector,
1175        );
1176        if let Some(ref val) = self.cxl_sts_rsn_inf
1177            && config.validate_optional_fields
1178        {
1179            val.validate(
1180                &helpers::child_path(path, "CxlStsRsnInf"),
1181                config,
1182                collector,
1183            );
1184        }
1185    }
1186}
1187
1188// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
1189#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1190pub struct PersonIdentification131 {
1191    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1192    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
1193    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1194    pub othr: Option<Vec<GenericPersonIdentification11>>,
1195}
1196
1197impl Validate for PersonIdentification131 {
1198    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1199        if let Some(ref val) = self.dt_and_plc_of_birth
1200            && config.validate_optional_fields
1201        {
1202            val.validate(
1203                &helpers::child_path(path, "DtAndPlcOfBirth"),
1204                config,
1205                collector,
1206            );
1207        }
1208        if let Some(ref vec) = self.othr
1209            && config.validate_optional_fields
1210        {
1211            for item in vec {
1212                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1213            }
1214        }
1215    }
1216}
1217
1218// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
1219#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1220pub struct PersonIdentification132 {
1221    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1222    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth12>,
1223    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1224    pub othr: Option<Vec<GenericPersonIdentification11>>,
1225}
1226
1227impl Validate for PersonIdentification132 {
1228    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1229        if let Some(ref val) = self.dt_and_plc_of_birth
1230            && config.validate_optional_fields
1231        {
1232            val.validate(
1233                &helpers::child_path(path, "DtAndPlcOfBirth"),
1234                config,
1235                collector,
1236            );
1237        }
1238        if let Some(ref vec) = self.othr
1239            && config.validate_optional_fields
1240        {
1241            for item in vec {
1242                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1243            }
1244        }
1245    }
1246}
1247
1248// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
1249#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1250pub struct PersonIdentificationSchemeName1Choice1 {
1251    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1252    pub cd: Option<String>,
1253    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1254    pub prtry: Option<String>,
1255}
1256
1257impl Validate for PersonIdentificationSchemeName1Choice1 {
1258    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1259        if let Some(ref val) = self.cd {
1260            helpers::validate_length(
1261                val,
1262                "Cd",
1263                Some(1),
1264                Some(4),
1265                &helpers::child_path(path, "Cd"),
1266                config,
1267                collector,
1268            );
1269        }
1270        if let Some(ref val) = self.prtry {
1271            helpers::validate_length(
1272                val,
1273                "Prtry",
1274                Some(1),
1275                Some(35),
1276                &helpers::child_path(path, "Prtry"),
1277                config,
1278                collector,
1279            );
1280        }
1281        if let Some(ref val) = self.prtry {
1282            helpers::validate_pattern(
1283                val,
1284                "Prtry",
1285                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1286                &helpers::child_path(path, "Prtry"),
1287                config,
1288                collector,
1289            );
1290        }
1291    }
1292}
1293
1294// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
1295#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1296pub struct PostalAddress241 {
1297    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
1298    pub dept: Option<String>,
1299    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
1300    pub sub_dept: Option<String>,
1301    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
1302    pub strt_nm: Option<String>,
1303    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
1304    pub bldg_nb: Option<String>,
1305    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
1306    pub bldg_nm: Option<String>,
1307    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
1308    pub flr: Option<String>,
1309    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
1310    pub pst_bx: Option<String>,
1311    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
1312    pub room: Option<String>,
1313    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
1314    pub pst_cd: Option<String>,
1315    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
1316    pub twn_nm: Option<String>,
1317    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1318    pub twn_lctn_nm: Option<String>,
1319    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1320    pub dstrct_nm: Option<String>,
1321    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1322    pub ctry_sub_dvsn: Option<String>,
1323    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
1324    pub ctry: Option<String>,
1325    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1326    pub adr_line: Option<Vec<String>>,
1327}
1328
1329impl Validate for PostalAddress241 {
1330    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1331        if let Some(ref val) = self.dept {
1332            helpers::validate_length(
1333                val,
1334                "Dept",
1335                Some(1),
1336                Some(70),
1337                &helpers::child_path(path, "Dept"),
1338                config,
1339                collector,
1340            );
1341        }
1342        if let Some(ref val) = self.dept {
1343            helpers::validate_pattern(
1344                val,
1345                "Dept",
1346                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1347                &helpers::child_path(path, "Dept"),
1348                config,
1349                collector,
1350            );
1351        }
1352        if let Some(ref val) = self.sub_dept {
1353            helpers::validate_length(
1354                val,
1355                "SubDept",
1356                Some(1),
1357                Some(70),
1358                &helpers::child_path(path, "SubDept"),
1359                config,
1360                collector,
1361            );
1362        }
1363        if let Some(ref val) = self.sub_dept {
1364            helpers::validate_pattern(
1365                val,
1366                "SubDept",
1367                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1368                &helpers::child_path(path, "SubDept"),
1369                config,
1370                collector,
1371            );
1372        }
1373        if let Some(ref val) = self.strt_nm {
1374            helpers::validate_length(
1375                val,
1376                "StrtNm",
1377                Some(1),
1378                Some(70),
1379                &helpers::child_path(path, "StrtNm"),
1380                config,
1381                collector,
1382            );
1383        }
1384        if let Some(ref val) = self.strt_nm {
1385            helpers::validate_pattern(
1386                val,
1387                "StrtNm",
1388                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1389                &helpers::child_path(path, "StrtNm"),
1390                config,
1391                collector,
1392            );
1393        }
1394        if let Some(ref val) = self.bldg_nb {
1395            helpers::validate_length(
1396                val,
1397                "BldgNb",
1398                Some(1),
1399                Some(16),
1400                &helpers::child_path(path, "BldgNb"),
1401                config,
1402                collector,
1403            );
1404        }
1405        if let Some(ref val) = self.bldg_nb {
1406            helpers::validate_pattern(
1407                val,
1408                "BldgNb",
1409                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1410                &helpers::child_path(path, "BldgNb"),
1411                config,
1412                collector,
1413            );
1414        }
1415        if let Some(ref val) = self.bldg_nm {
1416            helpers::validate_length(
1417                val,
1418                "BldgNm",
1419                Some(1),
1420                Some(35),
1421                &helpers::child_path(path, "BldgNm"),
1422                config,
1423                collector,
1424            );
1425        }
1426        if let Some(ref val) = self.bldg_nm {
1427            helpers::validate_pattern(
1428                val,
1429                "BldgNm",
1430                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1431                &helpers::child_path(path, "BldgNm"),
1432                config,
1433                collector,
1434            );
1435        }
1436        if let Some(ref val) = self.flr {
1437            helpers::validate_length(
1438                val,
1439                "Flr",
1440                Some(1),
1441                Some(70),
1442                &helpers::child_path(path, "Flr"),
1443                config,
1444                collector,
1445            );
1446        }
1447        if let Some(ref val) = self.flr {
1448            helpers::validate_pattern(
1449                val,
1450                "Flr",
1451                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1452                &helpers::child_path(path, "Flr"),
1453                config,
1454                collector,
1455            );
1456        }
1457        if let Some(ref val) = self.pst_bx {
1458            helpers::validate_length(
1459                val,
1460                "PstBx",
1461                Some(1),
1462                Some(16),
1463                &helpers::child_path(path, "PstBx"),
1464                config,
1465                collector,
1466            );
1467        }
1468        if let Some(ref val) = self.pst_bx {
1469            helpers::validate_pattern(
1470                val,
1471                "PstBx",
1472                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1473                &helpers::child_path(path, "PstBx"),
1474                config,
1475                collector,
1476            );
1477        }
1478        if let Some(ref val) = self.room {
1479            helpers::validate_length(
1480                val,
1481                "Room",
1482                Some(1),
1483                Some(70),
1484                &helpers::child_path(path, "Room"),
1485                config,
1486                collector,
1487            );
1488        }
1489        if let Some(ref val) = self.room {
1490            helpers::validate_pattern(
1491                val,
1492                "Room",
1493                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1494                &helpers::child_path(path, "Room"),
1495                config,
1496                collector,
1497            );
1498        }
1499        if let Some(ref val) = self.pst_cd {
1500            helpers::validate_length(
1501                val,
1502                "PstCd",
1503                Some(1),
1504                Some(16),
1505                &helpers::child_path(path, "PstCd"),
1506                config,
1507                collector,
1508            );
1509        }
1510        if let Some(ref val) = self.pst_cd {
1511            helpers::validate_pattern(
1512                val,
1513                "PstCd",
1514                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1515                &helpers::child_path(path, "PstCd"),
1516                config,
1517                collector,
1518            );
1519        }
1520        if let Some(ref val) = self.twn_nm {
1521            helpers::validate_length(
1522                val,
1523                "TwnNm",
1524                Some(1),
1525                Some(35),
1526                &helpers::child_path(path, "TwnNm"),
1527                config,
1528                collector,
1529            );
1530        }
1531        if let Some(ref val) = self.twn_nm {
1532            helpers::validate_pattern(
1533                val,
1534                "TwnNm",
1535                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1536                &helpers::child_path(path, "TwnNm"),
1537                config,
1538                collector,
1539            );
1540        }
1541        if let Some(ref val) = self.twn_lctn_nm {
1542            helpers::validate_length(
1543                val,
1544                "TwnLctnNm",
1545                Some(1),
1546                Some(35),
1547                &helpers::child_path(path, "TwnLctnNm"),
1548                config,
1549                collector,
1550            );
1551        }
1552        if let Some(ref val) = self.twn_lctn_nm {
1553            helpers::validate_pattern(
1554                val,
1555                "TwnLctnNm",
1556                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1557                &helpers::child_path(path, "TwnLctnNm"),
1558                config,
1559                collector,
1560            );
1561        }
1562        if let Some(ref val) = self.dstrct_nm {
1563            helpers::validate_length(
1564                val,
1565                "DstrctNm",
1566                Some(1),
1567                Some(35),
1568                &helpers::child_path(path, "DstrctNm"),
1569                config,
1570                collector,
1571            );
1572        }
1573        if let Some(ref val) = self.dstrct_nm {
1574            helpers::validate_pattern(
1575                val,
1576                "DstrctNm",
1577                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1578                &helpers::child_path(path, "DstrctNm"),
1579                config,
1580                collector,
1581            );
1582        }
1583        if let Some(ref val) = self.ctry_sub_dvsn {
1584            helpers::validate_length(
1585                val,
1586                "CtrySubDvsn",
1587                Some(1),
1588                Some(35),
1589                &helpers::child_path(path, "CtrySubDvsn"),
1590                config,
1591                collector,
1592            );
1593        }
1594        if let Some(ref val) = self.ctry_sub_dvsn {
1595            helpers::validate_pattern(
1596                val,
1597                "CtrySubDvsn",
1598                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1599                &helpers::child_path(path, "CtrySubDvsn"),
1600                config,
1601                collector,
1602            );
1603        }
1604        if let Some(ref val) = self.ctry {
1605            helpers::validate_pattern(
1606                val,
1607                "Ctry",
1608                "[A-Z]{2,2}",
1609                &helpers::child_path(path, "Ctry"),
1610                config,
1611                collector,
1612            );
1613        }
1614        if let Some(ref vec) = self.adr_line {
1615            for item in vec {
1616                helpers::validate_length(
1617                    item,
1618                    "AdrLine",
1619                    Some(1),
1620                    Some(70),
1621                    &helpers::child_path(path, "AdrLine"),
1622                    config,
1623                    collector,
1624                );
1625            }
1626        }
1627        if let Some(ref vec) = self.adr_line {
1628            for item in vec {
1629                helpers::validate_pattern(
1630                    item,
1631                    "AdrLine",
1632                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1633                    &helpers::child_path(path, "AdrLine"),
1634                    config,
1635                    collector,
1636                );
1637            }
1638        }
1639    }
1640}
1641
1642// ResolutionOfInvestigationV09: Specifies the details of the underlying transactions being cancelled.
1643#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1644pub struct ResolutionOfInvestigationV09 {
1645    #[serde(rename = "Assgnmt")]
1646    pub assgnmt: CaseAssignment51,
1647    #[serde(rename = "Sts")]
1648    pub sts: InvestigationStatus5Choice1,
1649    #[serde(rename = "CxlDtls")]
1650    pub cxl_dtls: UnderlyingTransaction221,
1651}
1652
1653impl Validate for ResolutionOfInvestigationV09 {
1654    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1655        self.assgnmt
1656            .validate(&helpers::child_path(path, "Assgnmt"), config, collector);
1657        self.sts
1658            .validate(&helpers::child_path(path, "Sts"), config, collector);
1659        self.cxl_dtls
1660            .validate(&helpers::child_path(path, "CxlDtls"), config, collector);
1661    }
1662}
1663
1664// UnderlyingTransaction221: Provides details on the original transactions to which the cancellation request message refers.
1665#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1666pub struct UnderlyingTransaction221 {
1667    #[serde(rename = "TxInfAndSts")]
1668    pub tx_inf_and_sts: PaymentTransaction1021,
1669}
1670
1671impl Validate for UnderlyingTransaction221 {
1672    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1673        self.tx_inf_and_sts
1674            .validate(&helpers::child_path(path, "TxInfAndSts"), config, collector);
1675    }
1676}