mx_message/document/
camt_057_001_06.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// AccountNotification161: Provides details of the expected amount on the account serviced by the account servicer.
53#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
54pub struct AccountNotification161 {
55    #[serde(rename = "Id")]
56    pub id: String,
57    #[serde(rename = "Acct", skip_serializing_if = "Option::is_none")]
58    pub acct: Option<CashAccount381>,
59    #[serde(rename = "AcctOwnr", skip_serializing_if = "Option::is_none")]
60    pub acct_ownr: Option<Party40Choice2>,
61    #[serde(rename = "AcctSvcr", skip_serializing_if = "Option::is_none")]
62    pub acct_svcr: Option<BranchAndFinancialInstitutionIdentification61>,
63    #[serde(rename = "RltdAcct", skip_serializing_if = "Option::is_none")]
64    pub rltd_acct: Option<CashAccount381>,
65    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
66    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
67    #[serde(rename = "XpctdValDt", skip_serializing_if = "Option::is_none")]
68    pub xpctd_val_dt: Option<String>,
69    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
70    pub dbtr: Option<Party40Choice2>,
71    #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
72    pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
73    #[serde(rename = "IntrmyAgt", skip_serializing_if = "Option::is_none")]
74    pub intrmy_agt: Option<BranchAndFinancialInstitutionIdentification61>,
75    #[serde(rename = "Itm")]
76    pub itm: Vec<NotificationItem71>,
77}
78
79impl Validate for AccountNotification161 {
80    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
81        helpers::validate_length(
82            &self.id,
83            "Id",
84            Some(1),
85            Some(35),
86            &helpers::child_path(path, "Id"),
87            config,
88            collector,
89        );
90        helpers::validate_pattern(
91            &self.id,
92            "Id",
93            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
94            &helpers::child_path(path, "Id"),
95            config,
96            collector,
97        );
98        if let Some(ref val) = self.acct
99            && config.validate_optional_fields
100        {
101            val.validate(&helpers::child_path(path, "Acct"), config, collector);
102        }
103        if let Some(ref val) = self.acct_ownr
104            && config.validate_optional_fields
105        {
106            val.validate(&helpers::child_path(path, "AcctOwnr"), config, collector);
107        }
108        if let Some(ref val) = self.acct_svcr
109            && config.validate_optional_fields
110        {
111            val.validate(&helpers::child_path(path, "AcctSvcr"), config, collector);
112        }
113        if let Some(ref val) = self.rltd_acct
114            && config.validate_optional_fields
115        {
116            val.validate(&helpers::child_path(path, "RltdAcct"), config, collector);
117        }
118        if let Some(ref val) = self.ttl_amt
119            && config.validate_optional_fields
120        {
121            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
122        }
123        if let Some(ref val) = self.dbtr
124            && config.validate_optional_fields
125        {
126            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
127        }
128        if let Some(ref val) = self.dbtr_agt
129            && config.validate_optional_fields
130        {
131            val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
132        }
133        if let Some(ref val) = self.intrmy_agt
134            && config.validate_optional_fields
135        {
136            val.validate(&helpers::child_path(path, "IntrmyAgt"), config, collector);
137        }
138        for item in &self.itm {
139            item.validate(&helpers::child_path(path, "Itm"), config, collector);
140        }
141    }
142}
143
144// AccountSchemeName1Choice1: Name of the identification scheme, in a free text form.
145#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
146pub struct AccountSchemeName1Choice1 {
147    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
148    pub cd: Option<String>,
149    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
150    pub prtry: Option<String>,
151}
152
153impl Validate for AccountSchemeName1Choice1 {
154    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
155        if let Some(ref val) = self.cd {
156            helpers::validate_length(
157                val,
158                "Cd",
159                Some(1),
160                Some(4),
161                &helpers::child_path(path, "Cd"),
162                config,
163                collector,
164            );
165        }
166        if let Some(ref val) = self.prtry {
167            helpers::validate_length(
168                val,
169                "Prtry",
170                Some(1),
171                Some(35),
172                &helpers::child_path(path, "Prtry"),
173                config,
174                collector,
175            );
176        }
177        if let Some(ref val) = self.prtry {
178            helpers::validate_pattern(
179                val,
180                "Prtry",
181                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
182                &helpers::child_path(path, "Prtry"),
183                config,
184                collector,
185            );
186        }
187    }
188}
189
190// ActiveOrHistoricCurrencyAndAmount: A number of monetary units specified in an active or a historic currency where the unit of currency is explicit and compliant with ISO 4217.
191#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
192pub struct ActiveOrHistoricCurrencyAndAmount {
193    #[serde(rename = "@Ccy")]
194    pub ccy: String,
195    #[serde(rename = "$value")]
196    pub value: f64,
197}
198
199impl Validate for ActiveOrHistoricCurrencyAndAmount {
200    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
201}
202
203// BranchAndFinancialInstitutionIdentification61: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
204#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
205pub struct BranchAndFinancialInstitutionIdentification61 {
206    #[serde(rename = "FinInstnId")]
207    pub fin_instn_id: FinancialInstitutionIdentification181,
208}
209
210impl Validate for BranchAndFinancialInstitutionIdentification61 {
211    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
212        self.fin_instn_id
213            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
214    }
215}
216
217// CashAccount381: Specifies an alternate assumed name for the identification of the account.
218#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
219pub struct CashAccount381 {
220    #[serde(rename = "Id")]
221    pub id: AccountIdentification4Choice1,
222    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
223    pub tp: Option<CashAccountType2Choice1>,
224    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
225    pub ccy: Option<String>,
226    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
227    pub nm: Option<String>,
228    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
229    pub prxy: Option<ProxyAccountIdentification11>,
230}
231
232impl Validate for CashAccount381 {
233    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
234        self.id
235            .validate(&helpers::child_path(path, "Id"), config, collector);
236        if let Some(ref val) = self.tp
237            && config.validate_optional_fields
238        {
239            val.validate(&helpers::child_path(path, "Tp"), config, collector);
240        }
241        if let Some(ref val) = self.ccy {
242            helpers::validate_pattern(
243                val,
244                "Ccy",
245                "[A-Z]{3,3}",
246                &helpers::child_path(path, "Ccy"),
247                config,
248                collector,
249            );
250        }
251        if let Some(ref val) = self.nm {
252            helpers::validate_length(
253                val,
254                "Nm",
255                Some(1),
256                Some(70),
257                &helpers::child_path(path, "Nm"),
258                config,
259                collector,
260            );
261        }
262        if let Some(ref val) = self.nm {
263            helpers::validate_pattern(
264                val,
265                "Nm",
266                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
267                &helpers::child_path(path, "Nm"),
268                config,
269                collector,
270            );
271        }
272        if let Some(ref val) = self.prxy
273            && config.validate_optional_fields
274        {
275            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
276        }
277    }
278}
279
280// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
281#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
282pub struct CashAccountType2Choice1 {
283    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
284    pub cd: Option<String>,
285    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
286    pub prtry: Option<String>,
287}
288
289impl Validate for CashAccountType2Choice1 {
290    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
291        if let Some(ref val) = self.cd {
292            helpers::validate_length(
293                val,
294                "Cd",
295                Some(1),
296                Some(4),
297                &helpers::child_path(path, "Cd"),
298                config,
299                collector,
300            );
301        }
302        if let Some(ref val) = self.prtry {
303            helpers::validate_length(
304                val,
305                "Prtry",
306                Some(1),
307                Some(35),
308                &helpers::child_path(path, "Prtry"),
309                config,
310                collector,
311            );
312        }
313        if let Some(ref val) = self.prtry {
314            helpers::validate_pattern(
315                val,
316                "Prtry",
317                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
318                &helpers::child_path(path, "Prtry"),
319                config,
320                collector,
321            );
322        }
323    }
324}
325
326// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
327#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
328pub struct ClearingSystemIdentification2Choice1 {
329    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
330    pub cd: Option<String>,
331}
332
333impl Validate for ClearingSystemIdentification2Choice1 {
334    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
335        if let Some(ref val) = self.cd {
336            helpers::validate_length(
337                val,
338                "Cd",
339                Some(1),
340                Some(5),
341                &helpers::child_path(path, "Cd"),
342                config,
343                collector,
344            );
345        }
346    }
347}
348
349// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
350#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
351pub struct ClearingSystemMemberIdentification21 {
352    #[serde(rename = "ClrSysId")]
353    pub clr_sys_id: ClearingSystemIdentification2Choice1,
354    #[serde(rename = "MmbId")]
355    pub mmb_id: String,
356}
357
358impl Validate for ClearingSystemMemberIdentification21 {
359    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
360        self.clr_sys_id
361            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
362        helpers::validate_length(
363            &self.mmb_id,
364            "MmbId",
365            Some(1),
366            Some(28),
367            &helpers::child_path(path, "MmbId"),
368            config,
369            collector,
370        );
371        helpers::validate_pattern(
372            &self.mmb_id,
373            "MmbId",
374            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
375            &helpers::child_path(path, "MmbId"),
376            config,
377            collector,
378        );
379    }
380}
381
382// DateAndPlaceOfBirth1: Country where a person was born.
383#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
384pub struct DateAndPlaceOfBirth1 {
385    #[serde(rename = "BirthDt")]
386    pub birth_dt: String,
387    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
388    pub prvc_of_birth: Option<String>,
389    #[serde(rename = "CityOfBirth")]
390    pub city_of_birth: String,
391    #[serde(rename = "CtryOfBirth")]
392    pub ctry_of_birth: String,
393}
394
395impl Validate for DateAndPlaceOfBirth1 {
396    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
397        if let Some(ref val) = self.prvc_of_birth {
398            helpers::validate_length(
399                val,
400                "PrvcOfBirth",
401                Some(1),
402                Some(35),
403                &helpers::child_path(path, "PrvcOfBirth"),
404                config,
405                collector,
406            );
407        }
408        helpers::validate_length(
409            &self.city_of_birth,
410            "CityOfBirth",
411            Some(1),
412            Some(35),
413            &helpers::child_path(path, "CityOfBirth"),
414            config,
415            collector,
416        );
417        helpers::validate_pattern(
418            &self.ctry_of_birth,
419            "CtryOfBirth",
420            "[A-Z]{2,2}",
421            &helpers::child_path(path, "CtryOfBirth"),
422            config,
423            collector,
424        );
425    }
426}
427
428// DateAndPlaceOfBirth11: Country where a person was born.
429#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
430pub struct DateAndPlaceOfBirth11 {
431    #[serde(rename = "BirthDt")]
432    pub birth_dt: String,
433    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
434    pub prvc_of_birth: Option<String>,
435    #[serde(rename = "CityOfBirth")]
436    pub city_of_birth: String,
437    #[serde(rename = "CtryOfBirth")]
438    pub ctry_of_birth: String,
439}
440
441impl Validate for DateAndPlaceOfBirth11 {
442    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
443        if let Some(ref val) = self.prvc_of_birth {
444            helpers::validate_length(
445                val,
446                "PrvcOfBirth",
447                Some(1),
448                Some(35),
449                &helpers::child_path(path, "PrvcOfBirth"),
450                config,
451                collector,
452            );
453        }
454        if let Some(ref val) = self.prvc_of_birth {
455            helpers::validate_pattern(
456                val,
457                "PrvcOfBirth",
458                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
459                &helpers::child_path(path, "PrvcOfBirth"),
460                config,
461                collector,
462            );
463        }
464        helpers::validate_length(
465            &self.city_of_birth,
466            "CityOfBirth",
467            Some(1),
468            Some(35),
469            &helpers::child_path(path, "CityOfBirth"),
470            config,
471            collector,
472        );
473        helpers::validate_pattern(
474            &self.city_of_birth,
475            "CityOfBirth",
476            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
477            &helpers::child_path(path, "CityOfBirth"),
478            config,
479            collector,
480        );
481        helpers::validate_pattern(
482            &self.ctry_of_birth,
483            "CtryOfBirth",
484            "[A-Z]{2,2}",
485            &helpers::child_path(path, "CtryOfBirth"),
486            config,
487            collector,
488        );
489    }
490}
491
492// FinancialInstitutionIdentification181: Information that locates and identifies a specific address, as defined by postal services.
493#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
494pub struct FinancialInstitutionIdentification181 {
495    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
496    pub bicfi: Option<String>,
497    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
498    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
499    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
500    pub lei: Option<String>,
501    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
502    pub nm: Option<String>,
503    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
504    pub pstl_adr: Option<PostalAddress241>,
505}
506
507impl Validate for FinancialInstitutionIdentification181 {
508    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
509        if let Some(ref val) = self.bicfi {
510            helpers::validate_pattern(
511                val,
512                "BICFI",
513                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
514                &helpers::child_path(path, "BICFI"),
515                config,
516                collector,
517            );
518        }
519        if let Some(ref val) = self.clr_sys_mmb_id
520            && config.validate_optional_fields
521        {
522            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
523        }
524        if let Some(ref val) = self.lei {
525            helpers::validate_pattern(
526                val,
527                "LEI",
528                "[A-Z0-9]{18,18}[0-9]{2,2}",
529                &helpers::child_path(path, "LEI"),
530                config,
531                collector,
532            );
533        }
534        if let Some(ref val) = self.nm {
535            helpers::validate_length(
536                val,
537                "Nm",
538                Some(1),
539                Some(140),
540                &helpers::child_path(path, "Nm"),
541                config,
542                collector,
543            );
544        }
545        if let Some(ref val) = self.nm {
546            helpers::validate_pattern(
547                val,
548                "Nm",
549                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
550                &helpers::child_path(path, "Nm"),
551                config,
552                collector,
553            );
554        }
555        if let Some(ref val) = self.pstl_adr
556            && config.validate_optional_fields
557        {
558            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
559        }
560    }
561}
562
563// GenericAccountIdentification11: Entity that assigns the identification.
564#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
565pub struct GenericAccountIdentification11 {
566    #[serde(rename = "Id")]
567    pub id: String,
568    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
569    pub schme_nm: Option<AccountSchemeName1Choice1>,
570    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
571    pub issr: Option<String>,
572}
573
574impl Validate for GenericAccountIdentification11 {
575    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
576        helpers::validate_length(
577            &self.id,
578            "Id",
579            Some(1),
580            Some(34),
581            &helpers::child_path(path, "Id"),
582            config,
583            collector,
584        );
585        helpers::validate_pattern(
586            &self.id,
587            "Id",
588            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
589            &helpers::child_path(path, "Id"),
590            config,
591            collector,
592        );
593        if let Some(ref val) = self.schme_nm
594            && config.validate_optional_fields
595        {
596            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
597        }
598        if let Some(ref val) = self.issr {
599            helpers::validate_length(
600                val,
601                "Issr",
602                Some(1),
603                Some(35),
604                &helpers::child_path(path, "Issr"),
605                config,
606                collector,
607            );
608        }
609        if let Some(ref val) = self.issr {
610            helpers::validate_pattern(
611                val,
612                "Issr",
613                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
614                &helpers::child_path(path, "Issr"),
615                config,
616                collector,
617            );
618        }
619    }
620}
621
622// GenericOrganisationIdentification11: Entity that assigns the identification.
623#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
624pub struct GenericOrganisationIdentification11 {
625    #[serde(rename = "Id")]
626    pub id: String,
627    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
628    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
629    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
630    pub issr: Option<String>,
631}
632
633impl Validate for GenericOrganisationIdentification11 {
634    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
635        helpers::validate_length(
636            &self.id,
637            "Id",
638            Some(1),
639            Some(35),
640            &helpers::child_path(path, "Id"),
641            config,
642            collector,
643        );
644        helpers::validate_pattern(
645            &self.id,
646            "Id",
647            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
648            &helpers::child_path(path, "Id"),
649            config,
650            collector,
651        );
652        if let Some(ref val) = self.schme_nm
653            && config.validate_optional_fields
654        {
655            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
656        }
657        if let Some(ref val) = self.issr {
658            helpers::validate_length(
659                val,
660                "Issr",
661                Some(1),
662                Some(35),
663                &helpers::child_path(path, "Issr"),
664                config,
665                collector,
666            );
667        }
668        if let Some(ref val) = self.issr {
669            helpers::validate_pattern(
670                val,
671                "Issr",
672                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
673                &helpers::child_path(path, "Issr"),
674                config,
675                collector,
676            );
677        }
678    }
679}
680
681// GenericOrganisationIdentification12: Entity that assigns the identification.
682#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
683pub struct GenericOrganisationIdentification12 {
684    #[serde(rename = "Id")]
685    pub id: String,
686    #[serde(rename = "SchmeNm")]
687    pub schme_nm: OrganisationIdentificationSchemeName1Choice2,
688    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
689    pub issr: Option<String>,
690}
691
692impl Validate for GenericOrganisationIdentification12 {
693    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
694        helpers::validate_length(
695            &self.id,
696            "Id",
697            Some(1),
698            Some(35),
699            &helpers::child_path(path, "Id"),
700            config,
701            collector,
702        );
703        helpers::validate_pattern(
704            &self.id,
705            "Id",
706            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
707            &helpers::child_path(path, "Id"),
708            config,
709            collector,
710        );
711        self.schme_nm
712            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
713        if let Some(ref val) = self.issr {
714            helpers::validate_length(
715                val,
716                "Issr",
717                Some(1),
718                Some(35),
719                &helpers::child_path(path, "Issr"),
720                config,
721                collector,
722            );
723        }
724        if let Some(ref val) = self.issr {
725            helpers::validate_pattern(
726                val,
727                "Issr",
728                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
729                &helpers::child_path(path, "Issr"),
730                config,
731                collector,
732            );
733        }
734    }
735}
736
737// GenericPersonIdentification11: Entity that assigns the identification.
738#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
739pub struct GenericPersonIdentification11 {
740    #[serde(rename = "Id")]
741    pub id: String,
742    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
743    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
744    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
745    pub issr: Option<String>,
746}
747
748impl Validate for GenericPersonIdentification11 {
749    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
750        helpers::validate_length(
751            &self.id,
752            "Id",
753            Some(1),
754            Some(35),
755            &helpers::child_path(path, "Id"),
756            config,
757            collector,
758        );
759        helpers::validate_pattern(
760            &self.id,
761            "Id",
762            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
763            &helpers::child_path(path, "Id"),
764            config,
765            collector,
766        );
767        if let Some(ref val) = self.schme_nm
768            && config.validate_optional_fields
769        {
770            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
771        }
772        if let Some(ref val) = self.issr {
773            helpers::validate_length(
774                val,
775                "Issr",
776                Some(1),
777                Some(35),
778                &helpers::child_path(path, "Issr"),
779                config,
780                collector,
781            );
782        }
783        if let Some(ref val) = self.issr {
784            helpers::validate_pattern(
785                val,
786                "Issr",
787                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
788                &helpers::child_path(path, "Issr"),
789                config,
790                collector,
791            );
792        }
793    }
794}
795
796// GenericPersonIdentification12: Entity that assigns the identification.
797#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
798pub struct GenericPersonIdentification12 {
799    #[serde(rename = "Id")]
800    pub id: String,
801    #[serde(rename = "SchmeNm")]
802    pub schme_nm: PersonIdentificationSchemeName1Choice2,
803    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
804    pub issr: Option<String>,
805}
806
807impl Validate for GenericPersonIdentification12 {
808    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
809        helpers::validate_length(
810            &self.id,
811            "Id",
812            Some(1),
813            Some(35),
814            &helpers::child_path(path, "Id"),
815            config,
816            collector,
817        );
818        helpers::validate_pattern(
819            &self.id,
820            "Id",
821            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
822            &helpers::child_path(path, "Id"),
823            config,
824            collector,
825        );
826        self.schme_nm
827            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
828        if let Some(ref val) = self.issr {
829            helpers::validate_length(
830                val,
831                "Issr",
832                Some(1),
833                Some(35),
834                &helpers::child_path(path, "Issr"),
835                config,
836                collector,
837            );
838        }
839        if let Some(ref val) = self.issr {
840            helpers::validate_pattern(
841                val,
842                "Issr",
843                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
844                &helpers::child_path(path, "Issr"),
845                config,
846                collector,
847            );
848        }
849    }
850}
851
852// GroupHeader771: Identification of the party that is sending the message, when different from the account owner.
853#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
854pub struct GroupHeader771 {
855    #[serde(rename = "MsgId")]
856    pub msg_id: String,
857    #[serde(rename = "CreDtTm")]
858    pub cre_dt_tm: String,
859    #[serde(rename = "MsgSndr", skip_serializing_if = "Option::is_none")]
860    pub msg_sndr: Option<Party40Choice1>,
861}
862
863impl Validate for GroupHeader771 {
864    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
865        helpers::validate_length(
866            &self.msg_id,
867            "MsgId",
868            Some(1),
869            Some(35),
870            &helpers::child_path(path, "MsgId"),
871            config,
872            collector,
873        );
874        helpers::validate_pattern(
875            &self.msg_id,
876            "MsgId",
877            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
878            &helpers::child_path(path, "MsgId"),
879            config,
880            collector,
881        );
882        helpers::validate_pattern(
883            &self.cre_dt_tm,
884            "CreDtTm",
885            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
886            &helpers::child_path(path, "CreDtTm"),
887            config,
888            collector,
889        );
890        if let Some(ref val) = self.msg_sndr
891            && config.validate_optional_fields
892        {
893            val.validate(&helpers::child_path(path, "MsgSndr"), config, collector);
894        }
895    }
896}
897
898// NotificationItem71: Underlying reason for the payment transaction.
899#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
900pub struct NotificationItem71 {
901    #[serde(rename = "Id")]
902    pub id: String,
903    #[serde(rename = "EndToEndId", skip_serializing_if = "Option::is_none")]
904    pub end_to_end_id: Option<String>,
905    #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
906    pub uetr: Option<String>,
907    #[serde(rename = "RltdAcct", skip_serializing_if = "Option::is_none")]
908    pub rltd_acct: Option<CashAccount381>,
909    #[serde(rename = "Amt")]
910    pub amt: ActiveOrHistoricCurrencyAndAmount,
911    #[serde(rename = "XpctdValDt", skip_serializing_if = "Option::is_none")]
912    pub xpctd_val_dt: Option<String>,
913    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
914    pub dbtr: Option<Party40Choice3>,
915    #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
916    pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
917    #[serde(rename = "IntrmyAgt", skip_serializing_if = "Option::is_none")]
918    pub intrmy_agt: Option<BranchAndFinancialInstitutionIdentification61>,
919    #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
920    pub purp: Option<Purpose2Choice1>,
921}
922
923impl Validate for NotificationItem71 {
924    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
925        helpers::validate_length(
926            &self.id,
927            "Id",
928            Some(1),
929            Some(35),
930            &helpers::child_path(path, "Id"),
931            config,
932            collector,
933        );
934        helpers::validate_pattern(
935            &self.id,
936            "Id",
937            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
938            &helpers::child_path(path, "Id"),
939            config,
940            collector,
941        );
942        if let Some(ref val) = self.end_to_end_id {
943            helpers::validate_length(
944                val,
945                "EndToEndId",
946                Some(1),
947                Some(35),
948                &helpers::child_path(path, "EndToEndId"),
949                config,
950                collector,
951            );
952        }
953        if let Some(ref val) = self.end_to_end_id {
954            helpers::validate_pattern(
955                val,
956                "EndToEndId",
957                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
958                &helpers::child_path(path, "EndToEndId"),
959                config,
960                collector,
961            );
962        }
963        if let Some(ref val) = self.uetr {
964            helpers::validate_pattern(
965                val,
966                "UETR",
967                "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
968                &helpers::child_path(path, "UETR"),
969                config,
970                collector,
971            );
972        }
973        if let Some(ref val) = self.rltd_acct
974            && config.validate_optional_fields
975        {
976            val.validate(&helpers::child_path(path, "RltdAcct"), config, collector);
977        }
978        self.amt
979            .validate(&helpers::child_path(path, "Amt"), config, collector);
980        if let Some(ref val) = self.dbtr
981            && config.validate_optional_fields
982        {
983            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
984        }
985        if let Some(ref val) = self.dbtr_agt
986            && config.validate_optional_fields
987        {
988            val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
989        }
990        if let Some(ref val) = self.intrmy_agt
991            && config.validate_optional_fields
992        {
993            val.validate(&helpers::child_path(path, "IntrmyAgt"), config, collector);
994        }
995        if let Some(ref val) = self.purp
996            && config.validate_optional_fields
997        {
998            val.validate(&helpers::child_path(path, "Purp"), config, collector);
999        }
1000    }
1001}
1002
1003// NotificationToReceiveV06: Set of elements used to provide further details on the account notification.
1004#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1005pub struct NotificationToReceiveV06 {
1006    #[serde(rename = "GrpHdr")]
1007    pub grp_hdr: GroupHeader771,
1008    #[serde(rename = "Ntfctn")]
1009    pub ntfctn: AccountNotification161,
1010}
1011
1012impl Validate for NotificationToReceiveV06 {
1013    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1014        self.grp_hdr
1015            .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
1016        self.ntfctn
1017            .validate(&helpers::child_path(path, "Ntfctn"), config, collector);
1018    }
1019}
1020
1021// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
1022#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1023pub struct OrganisationIdentification291 {
1024    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
1025    pub any_bic: Option<String>,
1026    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1027    pub lei: Option<String>,
1028    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1029    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
1030}
1031
1032impl Validate for OrganisationIdentification291 {
1033    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1034        if let Some(ref val) = self.any_bic {
1035            helpers::validate_pattern(
1036                val,
1037                "AnyBIC",
1038                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1039                &helpers::child_path(path, "AnyBIC"),
1040                config,
1041                collector,
1042            );
1043        }
1044        if let Some(ref val) = self.lei {
1045            helpers::validate_pattern(
1046                val,
1047                "LEI",
1048                "[A-Z0-9]{18,18}[0-9]{2,2}",
1049                &helpers::child_path(path, "LEI"),
1050                config,
1051                collector,
1052            );
1053        }
1054        if let Some(ref vec) = self.othr
1055            && config.validate_optional_fields
1056        {
1057            for item in vec {
1058                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1059            }
1060        }
1061    }
1062}
1063
1064// OrganisationIdentification292: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
1065#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1066pub struct OrganisationIdentification292 {
1067    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
1068    pub any_bic: Option<String>,
1069    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1070    pub lei: Option<String>,
1071    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1072    pub othr: Option<Vec<GenericOrganisationIdentification12>>,
1073}
1074
1075impl Validate for OrganisationIdentification292 {
1076    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1077        if let Some(ref val) = self.any_bic {
1078            helpers::validate_pattern(
1079                val,
1080                "AnyBIC",
1081                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1082                &helpers::child_path(path, "AnyBIC"),
1083                config,
1084                collector,
1085            );
1086        }
1087        if let Some(ref val) = self.lei {
1088            helpers::validate_pattern(
1089                val,
1090                "LEI",
1091                "[A-Z0-9]{18,18}[0-9]{2,2}",
1092                &helpers::child_path(path, "LEI"),
1093                config,
1094                collector,
1095            );
1096        }
1097        if let Some(ref vec) = self.othr
1098            && config.validate_optional_fields
1099        {
1100            for item in vec {
1101                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1102            }
1103        }
1104    }
1105}
1106
1107// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
1108#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1109pub struct OrganisationIdentificationSchemeName1Choice1 {
1110    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1111    pub cd: Option<String>,
1112    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1113    pub prtry: Option<String>,
1114}
1115
1116impl Validate for OrganisationIdentificationSchemeName1Choice1 {
1117    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1118        if let Some(ref val) = self.cd {
1119            helpers::validate_length(
1120                val,
1121                "Cd",
1122                Some(1),
1123                Some(4),
1124                &helpers::child_path(path, "Cd"),
1125                config,
1126                collector,
1127            );
1128        }
1129        if let Some(ref val) = self.prtry {
1130            helpers::validate_length(
1131                val,
1132                "Prtry",
1133                Some(1),
1134                Some(35),
1135                &helpers::child_path(path, "Prtry"),
1136                config,
1137                collector,
1138            );
1139        }
1140        if let Some(ref val) = self.prtry {
1141            helpers::validate_pattern(
1142                val,
1143                "Prtry",
1144                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1145                &helpers::child_path(path, "Prtry"),
1146                config,
1147                collector,
1148            );
1149        }
1150    }
1151}
1152
1153// OrganisationIdentificationSchemeName1Choice2: Name of the identification scheme, in a coded form as published in an external list.
1154#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1155pub struct OrganisationIdentificationSchemeName1Choice2 {
1156    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1157    pub cd: Option<String>,
1158}
1159
1160impl Validate for OrganisationIdentificationSchemeName1Choice2 {
1161    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1162        if let Some(ref val) = self.cd {
1163            helpers::validate_length(
1164                val,
1165                "Cd",
1166                Some(1),
1167                Some(4),
1168                &helpers::child_path(path, "Cd"),
1169                config,
1170                collector,
1171            );
1172        }
1173    }
1174}
1175
1176// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
1177#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1178pub struct Party38Choice1 {
1179    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
1180    pub org_id: Option<OrganisationIdentification291>,
1181    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
1182    pub prvt_id: Option<PersonIdentification131>,
1183}
1184
1185impl Validate for Party38Choice1 {
1186    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1187        if let Some(ref val) = self.org_id
1188            && config.validate_optional_fields
1189        {
1190            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
1191        }
1192        if let Some(ref val) = self.prvt_id
1193            && config.validate_optional_fields
1194        {
1195            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
1196        }
1197    }
1198}
1199
1200// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
1201#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1202pub struct Party38Choice2 {
1203    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
1204    pub org_id: Option<OrganisationIdentification291>,
1205    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
1206    pub prvt_id: Option<PersonIdentification132>,
1207}
1208
1209impl Validate for Party38Choice2 {
1210    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1211        if let Some(ref val) = self.org_id
1212            && config.validate_optional_fields
1213        {
1214            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
1215        }
1216        if let Some(ref val) = self.prvt_id
1217            && config.validate_optional_fields
1218        {
1219            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
1220        }
1221    }
1222}
1223
1224// Party38Choice3: Unique and unambiguous identification of a person, for example a passport.
1225#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1226pub struct Party38Choice3 {
1227    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
1228    pub org_id: Option<OrganisationIdentification292>,
1229    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
1230    pub prvt_id: Option<PersonIdentification133>,
1231}
1232
1233impl Validate for Party38Choice3 {
1234    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1235        if let Some(ref val) = self.org_id
1236            && config.validate_optional_fields
1237        {
1238            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
1239        }
1240        if let Some(ref val) = self.prvt_id
1241            && config.validate_optional_fields
1242        {
1243            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
1244        }
1245    }
1246}
1247
1248// Party40Choice1: Identification of a financial institution.
1249#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1250pub struct Party40Choice1 {
1251    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
1252    pub pty: Option<PartyIdentification1351>,
1253    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
1254    pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
1255}
1256
1257impl Validate for Party40Choice1 {
1258    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1259        if let Some(ref val) = self.pty
1260            && config.validate_optional_fields
1261        {
1262            val.validate(&helpers::child_path(path, "Pty"), config, collector);
1263        }
1264        if let Some(ref val) = self.agt
1265            && config.validate_optional_fields
1266        {
1267            val.validate(&helpers::child_path(path, "Agt"), config, collector);
1268        }
1269    }
1270}
1271
1272// Party40Choice2: Identification of a financial institution.
1273#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1274pub struct Party40Choice2 {
1275    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
1276    pub pty: Option<PartyIdentification1352>,
1277    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
1278    pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
1279}
1280
1281impl Validate for Party40Choice2 {
1282    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1283        if let Some(ref val) = self.pty
1284            && config.validate_optional_fields
1285        {
1286            val.validate(&helpers::child_path(path, "Pty"), config, collector);
1287        }
1288        if let Some(ref val) = self.agt
1289            && config.validate_optional_fields
1290        {
1291            val.validate(&helpers::child_path(path, "Agt"), config, collector);
1292        }
1293    }
1294}
1295
1296// Party40Choice3: Identification of a financial institution.
1297#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1298pub struct Party40Choice3 {
1299    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
1300    pub pty: Option<PartyIdentification1353>,
1301    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
1302    pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
1303}
1304
1305impl Validate for Party40Choice3 {
1306    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1307        if let Some(ref val) = self.pty
1308            && config.validate_optional_fields
1309        {
1310            val.validate(&helpers::child_path(path, "Pty"), config, collector);
1311        }
1312        if let Some(ref val) = self.agt
1313            && config.validate_optional_fields
1314        {
1315            val.validate(&helpers::child_path(path, "Agt"), config, collector);
1316        }
1317    }
1318}
1319
1320// 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.
1321#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1322pub struct PartyIdentification1351 {
1323    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1324    pub nm: Option<String>,
1325    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1326    pub pstl_adr: Option<PostalAddress241>,
1327    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1328    pub id: Option<Party38Choice1>,
1329    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
1330    pub ctry_of_res: Option<String>,
1331}
1332
1333impl Validate for PartyIdentification1351 {
1334    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1335        if let Some(ref val) = self.nm {
1336            helpers::validate_length(
1337                val,
1338                "Nm",
1339                Some(1),
1340                Some(140),
1341                &helpers::child_path(path, "Nm"),
1342                config,
1343                collector,
1344            );
1345        }
1346        if let Some(ref val) = self.nm {
1347            helpers::validate_pattern(
1348                val,
1349                "Nm",
1350                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1351                &helpers::child_path(path, "Nm"),
1352                config,
1353                collector,
1354            );
1355        }
1356        if let Some(ref val) = self.pstl_adr
1357            && config.validate_optional_fields
1358        {
1359            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1360        }
1361        if let Some(ref val) = self.id
1362            && config.validate_optional_fields
1363        {
1364            val.validate(&helpers::child_path(path, "Id"), config, collector);
1365        }
1366        if let Some(ref val) = self.ctry_of_res {
1367            helpers::validate_pattern(
1368                val,
1369                "CtryOfRes",
1370                "[A-Z]{2,2}",
1371                &helpers::child_path(path, "CtryOfRes"),
1372                config,
1373                collector,
1374            );
1375        }
1376    }
1377}
1378
1379// 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.
1380#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1381pub struct PartyIdentification1352 {
1382    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1383    pub nm: Option<String>,
1384    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1385    pub pstl_adr: Option<PostalAddress241>,
1386    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1387    pub id: Option<Party38Choice2>,
1388    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
1389    pub ctry_of_res: Option<String>,
1390}
1391
1392impl Validate for PartyIdentification1352 {
1393    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1394        if let Some(ref val) = self.nm {
1395            helpers::validate_length(
1396                val,
1397                "Nm",
1398                Some(1),
1399                Some(140),
1400                &helpers::child_path(path, "Nm"),
1401                config,
1402                collector,
1403            );
1404        }
1405        if let Some(ref val) = self.nm {
1406            helpers::validate_pattern(
1407                val,
1408                "Nm",
1409                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1410                &helpers::child_path(path, "Nm"),
1411                config,
1412                collector,
1413            );
1414        }
1415        if let Some(ref val) = self.pstl_adr
1416            && config.validate_optional_fields
1417        {
1418            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1419        }
1420        if let Some(ref val) = self.id
1421            && config.validate_optional_fields
1422        {
1423            val.validate(&helpers::child_path(path, "Id"), config, collector);
1424        }
1425        if let Some(ref val) = self.ctry_of_res {
1426            helpers::validate_pattern(
1427                val,
1428                "CtryOfRes",
1429                "[A-Z]{2,2}",
1430                &helpers::child_path(path, "CtryOfRes"),
1431                config,
1432                collector,
1433            );
1434        }
1435    }
1436}
1437
1438// PartyIdentification1353: 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.
1439#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1440pub struct PartyIdentification1353 {
1441    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1442    pub nm: Option<String>,
1443    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1444    pub pstl_adr: Option<PostalAddress241>,
1445    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1446    pub id: Option<Party38Choice3>,
1447    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
1448    pub ctry_of_res: Option<String>,
1449}
1450
1451impl Validate for PartyIdentification1353 {
1452    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1453        if let Some(ref val) = self.nm {
1454            helpers::validate_length(
1455                val,
1456                "Nm",
1457                Some(1),
1458                Some(140),
1459                &helpers::child_path(path, "Nm"),
1460                config,
1461                collector,
1462            );
1463        }
1464        if let Some(ref val) = self.nm {
1465            helpers::validate_pattern(
1466                val,
1467                "Nm",
1468                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1469                &helpers::child_path(path, "Nm"),
1470                config,
1471                collector,
1472            );
1473        }
1474        if let Some(ref val) = self.pstl_adr
1475            && config.validate_optional_fields
1476        {
1477            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1478        }
1479        if let Some(ref val) = self.id
1480            && config.validate_optional_fields
1481        {
1482            val.validate(&helpers::child_path(path, "Id"), config, collector);
1483        }
1484        if let Some(ref val) = self.ctry_of_res {
1485            helpers::validate_pattern(
1486                val,
1487                "CtryOfRes",
1488                "[A-Z]{2,2}",
1489                &helpers::child_path(path, "CtryOfRes"),
1490                config,
1491                collector,
1492            );
1493        }
1494    }
1495}
1496
1497// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
1498#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1499pub struct PersonIdentification131 {
1500    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1501    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
1502    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1503    pub othr: Option<Vec<GenericPersonIdentification11>>,
1504}
1505
1506impl Validate for PersonIdentification131 {
1507    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1508        if let Some(ref val) = self.dt_and_plc_of_birth
1509            && config.validate_optional_fields
1510        {
1511            val.validate(
1512                &helpers::child_path(path, "DtAndPlcOfBirth"),
1513                config,
1514                collector,
1515            );
1516        }
1517        if let Some(ref vec) = self.othr
1518            && config.validate_optional_fields
1519        {
1520            for item in vec {
1521                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1522            }
1523        }
1524    }
1525}
1526
1527// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
1528#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1529pub struct PersonIdentification132 {
1530    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1531    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
1532    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1533    pub othr: Option<Vec<GenericPersonIdentification11>>,
1534}
1535
1536impl Validate for PersonIdentification132 {
1537    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1538        if let Some(ref val) = self.dt_and_plc_of_birth
1539            && config.validate_optional_fields
1540        {
1541            val.validate(
1542                &helpers::child_path(path, "DtAndPlcOfBirth"),
1543                config,
1544                collector,
1545            );
1546        }
1547        if let Some(ref vec) = self.othr
1548            && config.validate_optional_fields
1549        {
1550            for item in vec {
1551                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1552            }
1553        }
1554    }
1555}
1556
1557// PersonIdentification133: Unique identification of a person, as assigned by an institution, using an identification scheme.
1558#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1559pub struct PersonIdentification133 {
1560    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1561    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
1562    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1563    pub othr: Option<Vec<GenericPersonIdentification12>>,
1564}
1565
1566impl Validate for PersonIdentification133 {
1567    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1568        if let Some(ref val) = self.dt_and_plc_of_birth
1569            && config.validate_optional_fields
1570        {
1571            val.validate(
1572                &helpers::child_path(path, "DtAndPlcOfBirth"),
1573                config,
1574                collector,
1575            );
1576        }
1577        if let Some(ref vec) = self.othr
1578            && config.validate_optional_fields
1579        {
1580            for item in vec {
1581                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1582            }
1583        }
1584    }
1585}
1586
1587// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
1588#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1589pub struct PersonIdentificationSchemeName1Choice1 {
1590    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1591    pub cd: Option<String>,
1592    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1593    pub prtry: Option<String>,
1594}
1595
1596impl Validate for PersonIdentificationSchemeName1Choice1 {
1597    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1598        if let Some(ref val) = self.cd {
1599            helpers::validate_length(
1600                val,
1601                "Cd",
1602                Some(1),
1603                Some(4),
1604                &helpers::child_path(path, "Cd"),
1605                config,
1606                collector,
1607            );
1608        }
1609        if let Some(ref val) = self.prtry {
1610            helpers::validate_length(
1611                val,
1612                "Prtry",
1613                Some(1),
1614                Some(35),
1615                &helpers::child_path(path, "Prtry"),
1616                config,
1617                collector,
1618            );
1619        }
1620        if let Some(ref val) = self.prtry {
1621            helpers::validate_pattern(
1622                val,
1623                "Prtry",
1624                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1625                &helpers::child_path(path, "Prtry"),
1626                config,
1627                collector,
1628            );
1629        }
1630    }
1631}
1632
1633// PersonIdentificationSchemeName1Choice2: Name of the identification scheme, in a coded form as published in an external list.
1634#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1635pub struct PersonIdentificationSchemeName1Choice2 {
1636    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1637    pub cd: Option<String>,
1638}
1639
1640impl Validate for PersonIdentificationSchemeName1Choice2 {
1641    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1642        if let Some(ref val) = self.cd {
1643            helpers::validate_length(
1644                val,
1645                "Cd",
1646                Some(1),
1647                Some(4),
1648                &helpers::child_path(path, "Cd"),
1649                config,
1650                collector,
1651            );
1652        }
1653    }
1654}
1655
1656// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
1657#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1658pub struct PostalAddress241 {
1659    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
1660    pub dept: Option<String>,
1661    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
1662    pub sub_dept: Option<String>,
1663    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
1664    pub strt_nm: Option<String>,
1665    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
1666    pub bldg_nb: Option<String>,
1667    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
1668    pub bldg_nm: Option<String>,
1669    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
1670    pub flr: Option<String>,
1671    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
1672    pub pst_bx: Option<String>,
1673    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
1674    pub room: Option<String>,
1675    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
1676    pub pst_cd: Option<String>,
1677    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
1678    pub twn_nm: Option<String>,
1679    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1680    pub twn_lctn_nm: Option<String>,
1681    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1682    pub dstrct_nm: Option<String>,
1683    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1684    pub ctry_sub_dvsn: Option<String>,
1685    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
1686    pub ctry: Option<String>,
1687    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1688    pub adr_line: Option<Vec<String>>,
1689}
1690
1691impl Validate for PostalAddress241 {
1692    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1693        if let Some(ref val) = self.dept {
1694            helpers::validate_length(
1695                val,
1696                "Dept",
1697                Some(1),
1698                Some(70),
1699                &helpers::child_path(path, "Dept"),
1700                config,
1701                collector,
1702            );
1703        }
1704        if let Some(ref val) = self.dept {
1705            helpers::validate_pattern(
1706                val,
1707                "Dept",
1708                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1709                &helpers::child_path(path, "Dept"),
1710                config,
1711                collector,
1712            );
1713        }
1714        if let Some(ref val) = self.sub_dept {
1715            helpers::validate_length(
1716                val,
1717                "SubDept",
1718                Some(1),
1719                Some(70),
1720                &helpers::child_path(path, "SubDept"),
1721                config,
1722                collector,
1723            );
1724        }
1725        if let Some(ref val) = self.sub_dept {
1726            helpers::validate_pattern(
1727                val,
1728                "SubDept",
1729                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1730                &helpers::child_path(path, "SubDept"),
1731                config,
1732                collector,
1733            );
1734        }
1735        if let Some(ref val) = self.strt_nm {
1736            helpers::validate_length(
1737                val,
1738                "StrtNm",
1739                Some(1),
1740                Some(70),
1741                &helpers::child_path(path, "StrtNm"),
1742                config,
1743                collector,
1744            );
1745        }
1746        if let Some(ref val) = self.strt_nm {
1747            helpers::validate_pattern(
1748                val,
1749                "StrtNm",
1750                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1751                &helpers::child_path(path, "StrtNm"),
1752                config,
1753                collector,
1754            );
1755        }
1756        if let Some(ref val) = self.bldg_nb {
1757            helpers::validate_length(
1758                val,
1759                "BldgNb",
1760                Some(1),
1761                Some(16),
1762                &helpers::child_path(path, "BldgNb"),
1763                config,
1764                collector,
1765            );
1766        }
1767        if let Some(ref val) = self.bldg_nb {
1768            helpers::validate_pattern(
1769                val,
1770                "BldgNb",
1771                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1772                &helpers::child_path(path, "BldgNb"),
1773                config,
1774                collector,
1775            );
1776        }
1777        if let Some(ref val) = self.bldg_nm {
1778            helpers::validate_length(
1779                val,
1780                "BldgNm",
1781                Some(1),
1782                Some(35),
1783                &helpers::child_path(path, "BldgNm"),
1784                config,
1785                collector,
1786            );
1787        }
1788        if let Some(ref val) = self.bldg_nm {
1789            helpers::validate_pattern(
1790                val,
1791                "BldgNm",
1792                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1793                &helpers::child_path(path, "BldgNm"),
1794                config,
1795                collector,
1796            );
1797        }
1798        if let Some(ref val) = self.flr {
1799            helpers::validate_length(
1800                val,
1801                "Flr",
1802                Some(1),
1803                Some(70),
1804                &helpers::child_path(path, "Flr"),
1805                config,
1806                collector,
1807            );
1808        }
1809        if let Some(ref val) = self.flr {
1810            helpers::validate_pattern(
1811                val,
1812                "Flr",
1813                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1814                &helpers::child_path(path, "Flr"),
1815                config,
1816                collector,
1817            );
1818        }
1819        if let Some(ref val) = self.pst_bx {
1820            helpers::validate_length(
1821                val,
1822                "PstBx",
1823                Some(1),
1824                Some(16),
1825                &helpers::child_path(path, "PstBx"),
1826                config,
1827                collector,
1828            );
1829        }
1830        if let Some(ref val) = self.pst_bx {
1831            helpers::validate_pattern(
1832                val,
1833                "PstBx",
1834                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1835                &helpers::child_path(path, "PstBx"),
1836                config,
1837                collector,
1838            );
1839        }
1840        if let Some(ref val) = self.room {
1841            helpers::validate_length(
1842                val,
1843                "Room",
1844                Some(1),
1845                Some(70),
1846                &helpers::child_path(path, "Room"),
1847                config,
1848                collector,
1849            );
1850        }
1851        if let Some(ref val) = self.room {
1852            helpers::validate_pattern(
1853                val,
1854                "Room",
1855                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1856                &helpers::child_path(path, "Room"),
1857                config,
1858                collector,
1859            );
1860        }
1861        if let Some(ref val) = self.pst_cd {
1862            helpers::validate_length(
1863                val,
1864                "PstCd",
1865                Some(1),
1866                Some(16),
1867                &helpers::child_path(path, "PstCd"),
1868                config,
1869                collector,
1870            );
1871        }
1872        if let Some(ref val) = self.pst_cd {
1873            helpers::validate_pattern(
1874                val,
1875                "PstCd",
1876                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1877                &helpers::child_path(path, "PstCd"),
1878                config,
1879                collector,
1880            );
1881        }
1882        if let Some(ref val) = self.twn_nm {
1883            helpers::validate_length(
1884                val,
1885                "TwnNm",
1886                Some(1),
1887                Some(35),
1888                &helpers::child_path(path, "TwnNm"),
1889                config,
1890                collector,
1891            );
1892        }
1893        if let Some(ref val) = self.twn_nm {
1894            helpers::validate_pattern(
1895                val,
1896                "TwnNm",
1897                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1898                &helpers::child_path(path, "TwnNm"),
1899                config,
1900                collector,
1901            );
1902        }
1903        if let Some(ref val) = self.twn_lctn_nm {
1904            helpers::validate_length(
1905                val,
1906                "TwnLctnNm",
1907                Some(1),
1908                Some(35),
1909                &helpers::child_path(path, "TwnLctnNm"),
1910                config,
1911                collector,
1912            );
1913        }
1914        if let Some(ref val) = self.twn_lctn_nm {
1915            helpers::validate_pattern(
1916                val,
1917                "TwnLctnNm",
1918                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1919                &helpers::child_path(path, "TwnLctnNm"),
1920                config,
1921                collector,
1922            );
1923        }
1924        if let Some(ref val) = self.dstrct_nm {
1925            helpers::validate_length(
1926                val,
1927                "DstrctNm",
1928                Some(1),
1929                Some(35),
1930                &helpers::child_path(path, "DstrctNm"),
1931                config,
1932                collector,
1933            );
1934        }
1935        if let Some(ref val) = self.dstrct_nm {
1936            helpers::validate_pattern(
1937                val,
1938                "DstrctNm",
1939                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1940                &helpers::child_path(path, "DstrctNm"),
1941                config,
1942                collector,
1943            );
1944        }
1945        if let Some(ref val) = self.ctry_sub_dvsn {
1946            helpers::validate_length(
1947                val,
1948                "CtrySubDvsn",
1949                Some(1),
1950                Some(35),
1951                &helpers::child_path(path, "CtrySubDvsn"),
1952                config,
1953                collector,
1954            );
1955        }
1956        if let Some(ref val) = self.ctry_sub_dvsn {
1957            helpers::validate_pattern(
1958                val,
1959                "CtrySubDvsn",
1960                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1961                &helpers::child_path(path, "CtrySubDvsn"),
1962                config,
1963                collector,
1964            );
1965        }
1966        if let Some(ref val) = self.ctry {
1967            helpers::validate_pattern(
1968                val,
1969                "Ctry",
1970                "[A-Z]{2,2}",
1971                &helpers::child_path(path, "Ctry"),
1972                config,
1973                collector,
1974            );
1975        }
1976        if let Some(ref vec) = self.adr_line {
1977            for item in vec {
1978                helpers::validate_length(
1979                    item,
1980                    "AdrLine",
1981                    Some(1),
1982                    Some(70),
1983                    &helpers::child_path(path, "AdrLine"),
1984                    config,
1985                    collector,
1986                );
1987            }
1988        }
1989        if let Some(ref vec) = self.adr_line {
1990            for item in vec {
1991                helpers::validate_pattern(
1992                    item,
1993                    "AdrLine",
1994                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1995                    &helpers::child_path(path, "AdrLine"),
1996                    config,
1997                    collector,
1998                );
1999            }
2000        }
2001    }
2002}
2003
2004// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
2005#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2006pub struct ProxyAccountIdentification11 {
2007    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2008    pub tp: Option<ProxyAccountType1Choice1>,
2009    #[serde(rename = "Id")]
2010    pub id: String,
2011}
2012
2013impl Validate for ProxyAccountIdentification11 {
2014    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2015        if let Some(ref val) = self.tp
2016            && config.validate_optional_fields
2017        {
2018            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2019        }
2020        helpers::validate_length(
2021            &self.id,
2022            "Id",
2023            Some(1),
2024            Some(320),
2025            &helpers::child_path(path, "Id"),
2026            config,
2027            collector,
2028        );
2029        helpers::validate_pattern(
2030            &self.id,
2031            "Id",
2032            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2033            &helpers::child_path(path, "Id"),
2034            config,
2035            collector,
2036        );
2037    }
2038}
2039
2040// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
2041#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2042pub struct ProxyAccountType1Choice1 {
2043    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2044    pub cd: Option<String>,
2045    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2046    pub prtry: Option<String>,
2047}
2048
2049impl Validate for ProxyAccountType1Choice1 {
2050    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2051        if let Some(ref val) = self.cd {
2052            helpers::validate_length(
2053                val,
2054                "Cd",
2055                Some(1),
2056                Some(4),
2057                &helpers::child_path(path, "Cd"),
2058                config,
2059                collector,
2060            );
2061        }
2062        if let Some(ref val) = self.prtry {
2063            helpers::validate_length(
2064                val,
2065                "Prtry",
2066                Some(1),
2067                Some(35),
2068                &helpers::child_path(path, "Prtry"),
2069                config,
2070                collector,
2071            );
2072        }
2073        if let Some(ref val) = self.prtry {
2074            helpers::validate_pattern(
2075                val,
2076                "Prtry",
2077                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2078                &helpers::child_path(path, "Prtry"),
2079                config,
2080                collector,
2081            );
2082        }
2083    }
2084}
2085
2086// Purpose2Choice1: Purpose, in a proprietary form.
2087#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2088pub struct Purpose2Choice1 {
2089    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2090    pub cd: Option<String>,
2091    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2092    pub prtry: Option<String>,
2093}
2094
2095impl Validate for Purpose2Choice1 {
2096    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2097        if let Some(ref val) = self.cd {
2098            helpers::validate_length(
2099                val,
2100                "Cd",
2101                Some(1),
2102                Some(4),
2103                &helpers::child_path(path, "Cd"),
2104                config,
2105                collector,
2106            );
2107        }
2108        if let Some(ref val) = self.prtry {
2109            helpers::validate_length(
2110                val,
2111                "Prtry",
2112                Some(1),
2113                Some(35),
2114                &helpers::child_path(path, "Prtry"),
2115                config,
2116                collector,
2117            );
2118        }
2119        if let Some(ref val) = self.prtry {
2120            helpers::validate_pattern(
2121                val,
2122                "Prtry",
2123                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2124                &helpers::child_path(path, "Prtry"),
2125                config,
2126                collector,
2127            );
2128        }
2129    }
2130}