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