mx_message/document/
pacs_003_001_08.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// AccountIdentification4Choice2: Unique identification of an account, as assigned by the account servicer, using an identification scheme.
53#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
54pub struct AccountIdentification4Choice2 {
55    #[serde(rename = "IBAN", skip_serializing_if = "Option::is_none")]
56    pub iban: Option<String>,
57    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
58    pub othr: Option<GenericAccountIdentification12>,
59}
60
61impl Validate for AccountIdentification4Choice2 {
62    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
63        if let Some(ref val) = self.iban {
64            helpers::validate_pattern(
65                val,
66                "IBAN",
67                "[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}",
68                &helpers::child_path(path, "IBAN"),
69                config,
70                collector,
71            );
72        }
73        if let Some(ref val) = self.othr
74            && config.validate_optional_fields
75        {
76            val.validate(&helpers::child_path(path, "Othr"), config, collector);
77        }
78    }
79}
80
81// AccountSchemeName1Choice: Name of the identification scheme, in a free text form.
82#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
83pub struct AccountSchemeName1Choice {
84    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
85    pub cd: Option<String>,
86    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
87    pub prtry: Option<String>,
88}
89
90impl Validate for AccountSchemeName1Choice {
91    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
92        if let Some(ref val) = self.cd {
93            helpers::validate_length(
94                val,
95                "Cd",
96                Some(1),
97                Some(4),
98                &helpers::child_path(path, "Cd"),
99                config,
100                collector,
101            );
102        }
103        if let Some(ref val) = self.prtry {
104            helpers::validate_length(
105                val,
106                "Prtry",
107                Some(1),
108                Some(35),
109                &helpers::child_path(path, "Prtry"),
110                config,
111                collector,
112            );
113        }
114    }
115}
116
117// AccountSchemeName1Choice1: Name of the identification scheme, in a free text form.
118#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
119pub struct AccountSchemeName1Choice1 {
120    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
121    pub cd: Option<String>,
122    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
123    pub prtry: Option<String>,
124}
125
126impl Validate for AccountSchemeName1Choice1 {
127    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
128        if let Some(ref val) = self.cd {
129            helpers::validate_length(
130                val,
131                "Cd",
132                Some(1),
133                Some(4),
134                &helpers::child_path(path, "Cd"),
135                config,
136                collector,
137            );
138        }
139        if let Some(ref val) = self.prtry {
140            helpers::validate_length(
141                val,
142                "Prtry",
143                Some(1),
144                Some(35),
145                &helpers::child_path(path, "Prtry"),
146                config,
147                collector,
148            );
149        }
150        if let Some(ref val) = self.prtry {
151            helpers::validate_pattern(
152                val,
153                "Prtry",
154                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
155                &helpers::child_path(path, "Prtry"),
156                config,
157                collector,
158            );
159        }
160    }
161}
162
163// 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.
164#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
165pub struct ActiveOrHistoricCurrencyAndAmount {
166    #[serde(rename = "@Ccy")]
167    pub ccy: String,
168    #[serde(rename = "$value")]
169    pub value: f64,
170}
171
172impl Validate for ActiveOrHistoricCurrencyAndAmount {
173    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
174}
175
176// AmendmentInformationDetails131: Original number of tracking days that has been modified.
177#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
178pub struct AmendmentInformationDetails131 {
179    #[serde(rename = "OrgnlMndtId", skip_serializing_if = "Option::is_none")]
180    pub orgnl_mndt_id: Option<String>,
181    #[serde(rename = "OrgnlCdtrSchmeId", skip_serializing_if = "Option::is_none")]
182    pub orgnl_cdtr_schme_id: Option<PartyIdentification1351>,
183    #[serde(rename = "OrgnlCdtrAgt", skip_serializing_if = "Option::is_none")]
184    pub orgnl_cdtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
185    #[serde(rename = "OrgnlCdtrAgtAcct", skip_serializing_if = "Option::is_none")]
186    pub orgnl_cdtr_agt_acct: Option<CashAccount382>,
187    #[serde(rename = "OrgnlDbtr", skip_serializing_if = "Option::is_none")]
188    pub orgnl_dbtr: Option<PartyIdentification1351>,
189    #[serde(rename = "OrgnlDbtrAcct", skip_serializing_if = "Option::is_none")]
190    pub orgnl_dbtr_acct: Option<CashAccount382>,
191    #[serde(rename = "OrgnlDbtrAgt", skip_serializing_if = "Option::is_none")]
192    pub orgnl_dbtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
193    #[serde(rename = "OrgnlDbtrAgtAcct", skip_serializing_if = "Option::is_none")]
194    pub orgnl_dbtr_agt_acct: Option<CashAccount382>,
195    #[serde(rename = "OrgnlFnlColltnDt", skip_serializing_if = "Option::is_none")]
196    pub orgnl_fnl_colltn_dt: Option<String>,
197    #[serde(rename = "OrgnlFrqcy", skip_serializing_if = "Option::is_none")]
198    pub orgnl_frqcy: Option<Frequency36Choice>,
199    #[serde(rename = "OrgnlRsn", skip_serializing_if = "Option::is_none")]
200    pub orgnl_rsn: Option<MandateSetupReason1Choice1>,
201    #[serde(rename = "OrgnlTrckgDays", skip_serializing_if = "Option::is_none")]
202    pub orgnl_trckg_days: Option<String>,
203}
204
205impl Validate for AmendmentInformationDetails131 {
206    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
207        if let Some(ref val) = self.orgnl_mndt_id {
208            helpers::validate_length(
209                val,
210                "OrgnlMndtId",
211                Some(1),
212                Some(35),
213                &helpers::child_path(path, "OrgnlMndtId"),
214                config,
215                collector,
216            );
217        }
218        if let Some(ref val) = self.orgnl_mndt_id {
219            helpers::validate_pattern(
220                val,
221                "OrgnlMndtId",
222                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
223                &helpers::child_path(path, "OrgnlMndtId"),
224                config,
225                collector,
226            );
227        }
228        if let Some(ref val) = self.orgnl_cdtr_schme_id
229            && config.validate_optional_fields
230        {
231            val.validate(
232                &helpers::child_path(path, "OrgnlCdtrSchmeId"),
233                config,
234                collector,
235            );
236        }
237        if let Some(ref val) = self.orgnl_cdtr_agt
238            && config.validate_optional_fields
239        {
240            val.validate(
241                &helpers::child_path(path, "OrgnlCdtrAgt"),
242                config,
243                collector,
244            );
245        }
246        if let Some(ref val) = self.orgnl_cdtr_agt_acct
247            && config.validate_optional_fields
248        {
249            val.validate(
250                &helpers::child_path(path, "OrgnlCdtrAgtAcct"),
251                config,
252                collector,
253            );
254        }
255        if let Some(ref val) = self.orgnl_dbtr
256            && config.validate_optional_fields
257        {
258            val.validate(&helpers::child_path(path, "OrgnlDbtr"), config, collector);
259        }
260        if let Some(ref val) = self.orgnl_dbtr_acct
261            && config.validate_optional_fields
262        {
263            val.validate(
264                &helpers::child_path(path, "OrgnlDbtrAcct"),
265                config,
266                collector,
267            );
268        }
269        if let Some(ref val) = self.orgnl_dbtr_agt
270            && config.validate_optional_fields
271        {
272            val.validate(
273                &helpers::child_path(path, "OrgnlDbtrAgt"),
274                config,
275                collector,
276            );
277        }
278        if let Some(ref val) = self.orgnl_dbtr_agt_acct
279            && config.validate_optional_fields
280        {
281            val.validate(
282                &helpers::child_path(path, "OrgnlDbtrAgtAcct"),
283                config,
284                collector,
285            );
286        }
287        if let Some(ref val) = self.orgnl_frqcy
288            && config.validate_optional_fields
289        {
290            val.validate(&helpers::child_path(path, "OrgnlFrqcy"), config, collector);
291        }
292        if let Some(ref val) = self.orgnl_rsn
293            && config.validate_optional_fields
294        {
295            val.validate(&helpers::child_path(path, "OrgnlRsn"), config, collector);
296        }
297        if let Some(ref val) = self.orgnl_trckg_days {
298            helpers::validate_pattern(
299                val,
300                "OrgnlTrckgDays",
301                "[0-9]{2}",
302                &helpers::child_path(path, "OrgnlTrckgDays"),
303                config,
304                collector,
305            );
306        }
307    }
308}
309
310// BranchAndFinancialInstitutionIdentification61: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
311#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
312pub struct BranchAndFinancialInstitutionIdentification61 {
313    #[serde(rename = "FinInstnId")]
314    pub fin_instn_id: FinancialInstitutionIdentification181,
315}
316
317impl Validate for BranchAndFinancialInstitutionIdentification61 {
318    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
319        self.fin_instn_id
320            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
321    }
322}
323
324// BranchAndFinancialInstitutionIdentification62: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
325#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
326pub struct BranchAndFinancialInstitutionIdentification62 {
327    #[serde(rename = "FinInstnId")]
328    pub fin_instn_id: FinancialInstitutionIdentification182,
329}
330
331impl Validate for BranchAndFinancialInstitutionIdentification62 {
332    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
333        self.fin_instn_id
334            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
335    }
336}
337
338// BranchAndFinancialInstitutionIdentification63: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
339#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
340pub struct BranchAndFinancialInstitutionIdentification63 {
341    #[serde(rename = "FinInstnId")]
342    pub fin_instn_id: FinancialInstitutionIdentification183,
343}
344
345impl Validate for BranchAndFinancialInstitutionIdentification63 {
346    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
347        self.fin_instn_id
348            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
349    }
350}
351
352// CBPRAmount: CBPR_Amount
353#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
354pub struct CBPRAmount {
355    #[serde(rename = "@Ccy")]
356    pub ccy: String,
357    #[serde(rename = "$value")]
358    pub value: f64,
359}
360
361impl Validate for CBPRAmount {
362    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
363}
364
365// CashAccount381: Specifies an alternate assumed name for the identification of the account.
366#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
367pub struct CashAccount381 {
368    #[serde(rename = "Id")]
369    pub id: AccountIdentification4Choice1,
370    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
371    pub tp: Option<CashAccountType2Choice1>,
372    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
373    pub ccy: Option<String>,
374    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
375    pub nm: Option<String>,
376    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
377    pub prxy: Option<ProxyAccountIdentification11>,
378}
379
380impl Validate for CashAccount381 {
381    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
382        self.id
383            .validate(&helpers::child_path(path, "Id"), config, collector);
384        if let Some(ref val) = self.tp
385            && config.validate_optional_fields
386        {
387            val.validate(&helpers::child_path(path, "Tp"), config, collector);
388        }
389        if let Some(ref val) = self.ccy {
390            helpers::validate_pattern(
391                val,
392                "Ccy",
393                "[A-Z]{3,3}",
394                &helpers::child_path(path, "Ccy"),
395                config,
396                collector,
397            );
398        }
399        if let Some(ref val) = self.nm {
400            helpers::validate_length(
401                val,
402                "Nm",
403                Some(1),
404                Some(70),
405                &helpers::child_path(path, "Nm"),
406                config,
407                collector,
408            );
409        }
410        if let Some(ref val) = self.nm {
411            helpers::validate_pattern(
412                val,
413                "Nm",
414                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
415                &helpers::child_path(path, "Nm"),
416                config,
417                collector,
418            );
419        }
420        if let Some(ref val) = self.prxy
421            && config.validate_optional_fields
422        {
423            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
424        }
425    }
426}
427
428// CashAccount382: Specifies an alternate assumed name for the identification of the account.
429#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
430pub struct CashAccount382 {
431    #[serde(rename = "Id")]
432    pub id: AccountIdentification4Choice2,
433    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
434    pub tp: Option<CashAccountType2Choice1>,
435    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
436    pub ccy: Option<String>,
437    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
438    pub nm: Option<String>,
439    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
440    pub prxy: Option<ProxyAccountIdentification12>,
441}
442
443impl Validate for CashAccount382 {
444    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
445        self.id
446            .validate(&helpers::child_path(path, "Id"), config, collector);
447        if let Some(ref val) = self.tp
448            && config.validate_optional_fields
449        {
450            val.validate(&helpers::child_path(path, "Tp"), config, collector);
451        }
452        if let Some(ref val) = self.ccy {
453            helpers::validate_pattern(
454                val,
455                "Ccy",
456                "[A-Z]{3,3}",
457                &helpers::child_path(path, "Ccy"),
458                config,
459                collector,
460            );
461        }
462        if let Some(ref val) = self.nm {
463            helpers::validate_length(
464                val,
465                "Nm",
466                Some(1),
467                Some(70),
468                &helpers::child_path(path, "Nm"),
469                config,
470                collector,
471            );
472        }
473        if let Some(ref val) = self.nm {
474            helpers::validate_pattern(
475                val,
476                "Nm",
477                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
478                &helpers::child_path(path, "Nm"),
479                config,
480                collector,
481            );
482        }
483        if let Some(ref val) = self.prxy
484            && config.validate_optional_fields
485        {
486            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
487        }
488    }
489}
490
491// CashAccount383: Specifies an alternate assumed name for the identification of the account.
492#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
493pub struct CashAccount383 {
494    #[serde(rename = "Id")]
495    pub id: AccountIdentification4Choice1,
496    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
497    pub tp: Option<CashAccountType2Choice1>,
498    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
499    pub ccy: Option<String>,
500    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
501    pub nm: Option<String>,
502    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
503    pub prxy: Option<ProxyAccountIdentification12>,
504}
505
506impl Validate for CashAccount383 {
507    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
508        self.id
509            .validate(&helpers::child_path(path, "Id"), config, collector);
510        if let Some(ref val) = self.tp
511            && config.validate_optional_fields
512        {
513            val.validate(&helpers::child_path(path, "Tp"), config, collector);
514        }
515        if let Some(ref val) = self.ccy {
516            helpers::validate_pattern(
517                val,
518                "Ccy",
519                "[A-Z]{3,3}",
520                &helpers::child_path(path, "Ccy"),
521                config,
522                collector,
523            );
524        }
525        if let Some(ref val) = self.nm {
526            helpers::validate_length(
527                val,
528                "Nm",
529                Some(1),
530                Some(70),
531                &helpers::child_path(path, "Nm"),
532                config,
533                collector,
534            );
535        }
536        if let Some(ref val) = self.nm {
537            helpers::validate_pattern(
538                val,
539                "Nm",
540                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
541                &helpers::child_path(path, "Nm"),
542                config,
543                collector,
544            );
545        }
546        if let Some(ref val) = self.prxy
547            && config.validate_optional_fields
548        {
549            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
550        }
551    }
552}
553
554// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
555#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
556pub struct CashAccountType2Choice1 {
557    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
558    pub cd: Option<String>,
559    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
560    pub prtry: Option<String>,
561}
562
563impl Validate for CashAccountType2Choice1 {
564    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
565        if let Some(ref val) = self.cd {
566            helpers::validate_length(
567                val,
568                "Cd",
569                Some(1),
570                Some(4),
571                &helpers::child_path(path, "Cd"),
572                config,
573                collector,
574            );
575        }
576        if let Some(ref val) = self.prtry {
577            helpers::validate_length(
578                val,
579                "Prtry",
580                Some(1),
581                Some(35),
582                &helpers::child_path(path, "Prtry"),
583                config,
584                collector,
585            );
586        }
587        if let Some(ref val) = self.prtry {
588            helpers::validate_pattern(
589                val,
590                "Prtry",
591                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
592                &helpers::child_path(path, "Prtry"),
593                config,
594                collector,
595            );
596        }
597    }
598}
599
600// CategoryPurpose1Choice1: Category purpose, in a proprietary form.
601#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
602pub struct CategoryPurpose1Choice1 {
603    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
604    pub cd: Option<String>,
605    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
606    pub prtry: Option<String>,
607}
608
609impl Validate for CategoryPurpose1Choice1 {
610    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
611        if let Some(ref val) = self.cd {
612            helpers::validate_length(
613                val,
614                "Cd",
615                Some(1),
616                Some(4),
617                &helpers::child_path(path, "Cd"),
618                config,
619                collector,
620            );
621        }
622        if let Some(ref val) = self.prtry {
623            helpers::validate_length(
624                val,
625                "Prtry",
626                Some(1),
627                Some(35),
628                &helpers::child_path(path, "Prtry"),
629                config,
630                collector,
631            );
632        }
633        if let Some(ref val) = self.prtry {
634            helpers::validate_pattern(
635                val,
636                "Prtry",
637                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
638                &helpers::child_path(path, "Prtry"),
639                config,
640                collector,
641            );
642        }
643    }
644}
645
646// ChargeBearerType1Code__1: In a credit transfer context, means that transaction charges on the sender side are to be borne by the debtor, transaction charges on the receiver side are to be borne by the creditor. In a direct debit context, means that transaction charges on the sender side are to be borne by the creditor, transaction charges on the receiver side are to be borne by the debtor.
647#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
648pub enum ChargeBearerType1Code1 {
649    #[default]
650    #[serde(rename = "DEBT")]
651    CodeDEBT,
652    #[serde(rename = "CRED")]
653    CodeCRED,
654    #[serde(rename = "SHAR")]
655    CodeSHAR,
656}
657
658impl Validate for ChargeBearerType1Code1 {
659    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
660        // Enum validation is typically empty
661    }
662}
663
664// Charges71: Agent that takes the transaction charges or to which the transaction charges are due.
665#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
666pub struct Charges71 {
667    #[serde(rename = "Amt")]
668    pub amt: CBPRAmount,
669    #[serde(rename = "Agt")]
670    pub agt: BranchAndFinancialInstitutionIdentification61,
671}
672
673impl Validate for Charges71 {
674    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
675        self.amt
676            .validate(&helpers::child_path(path, "Amt"), config, collector);
677        self.agt
678            .validate(&helpers::child_path(path, "Agt"), config, collector);
679    }
680}
681
682// ClearingChannel2Code: Payment through internal book transfer.
683#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
684pub enum ClearingChannel2Code {
685    #[default]
686    #[serde(rename = "RTGS")]
687    CodeRTGS,
688    #[serde(rename = "RTNS")]
689    CodeRTNS,
690    #[serde(rename = "MPNS")]
691    CodeMPNS,
692    #[serde(rename = "BOOK")]
693    CodeBOOK,
694}
695
696impl Validate for ClearingChannel2Code {
697    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
698        // Enum validation is typically empty
699    }
700}
701
702// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
703#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
704pub struct ClearingSystemIdentification2Choice1 {
705    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
706    pub cd: Option<String>,
707}
708
709impl Validate for ClearingSystemIdentification2Choice1 {
710    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
711        if let Some(ref val) = self.cd {
712            helpers::validate_length(
713                val,
714                "Cd",
715                Some(1),
716                Some(5),
717                &helpers::child_path(path, "Cd"),
718                config,
719                collector,
720            );
721        }
722    }
723}
724
725// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
726#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
727pub struct ClearingSystemMemberIdentification21 {
728    #[serde(rename = "ClrSysId")]
729    pub clr_sys_id: ClearingSystemIdentification2Choice1,
730    #[serde(rename = "MmbId")]
731    pub mmb_id: String,
732}
733
734impl Validate for ClearingSystemMemberIdentification21 {
735    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
736        self.clr_sys_id
737            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
738        helpers::validate_length(
739            &self.mmb_id,
740            "MmbId",
741            Some(1),
742            Some(28),
743            &helpers::child_path(path, "MmbId"),
744            config,
745            collector,
746        );
747        helpers::validate_pattern(
748            &self.mmb_id,
749            "MmbId",
750            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
751            &helpers::child_path(path, "MmbId"),
752            config,
753            collector,
754        );
755    }
756}
757
758// CreditDebitCode: Operation is a decrease.
759#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
760pub enum CreditDebitCode {
761    #[default]
762    #[serde(rename = "CRDT")]
763    CodeCRDT,
764    #[serde(rename = "DBIT")]
765    CodeDBIT,
766}
767
768impl Validate for CreditDebitCode {
769    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
770        // Enum validation is typically empty
771    }
772}
773
774// CreditorReferenceInformation21: Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction.
775//
776// Usage: If available, the initiating party should provide this reference in the structured remittance information, to enable reconciliation by the creditor upon receipt of the amount of money.
777//
778// If the business context requires the use of a creditor reference or a payment remit identification, and only one identifier can be passed through the end-to-end chain, the creditor's reference or payment remittance identification should be quoted in the end-to-end transaction identification.
779#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
780pub struct CreditorReferenceInformation21 {
781    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
782    pub tp: Option<CreditorReferenceType21>,
783    #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
784    pub ref_attr: Option<String>,
785}
786
787impl Validate for CreditorReferenceInformation21 {
788    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
789        if let Some(ref val) = self.tp
790            && config.validate_optional_fields
791        {
792            val.validate(&helpers::child_path(path, "Tp"), config, collector);
793        }
794        if let Some(ref val) = self.ref_attr {
795            helpers::validate_length(
796                val,
797                "Ref",
798                Some(1),
799                Some(35),
800                &helpers::child_path(path, "Ref"),
801                config,
802                collector,
803            );
804        }
805        if let Some(ref val) = self.ref_attr {
806            helpers::validate_pattern(
807                val,
808                "Ref",
809                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
810                &helpers::child_path(path, "Ref"),
811                config,
812                collector,
813            );
814        }
815    }
816}
817
818// CreditorReferenceType1Choice: Creditor reference type, in a proprietary form.
819#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
820pub struct CreditorReferenceType1Choice {
821    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
822    pub cd: Option<DocumentType3Code>,
823    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
824    pub prtry: Option<String>,
825}
826
827impl Validate for CreditorReferenceType1Choice {
828    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
829        if let Some(ref val) = self.cd
830            && config.validate_optional_fields
831        {
832            val.validate(&helpers::child_path(path, "Cd"), config, collector);
833        }
834        if let Some(ref val) = self.prtry {
835            helpers::validate_length(
836                val,
837                "Prtry",
838                Some(1),
839                Some(35),
840                &helpers::child_path(path, "Prtry"),
841                config,
842                collector,
843            );
844        }
845    }
846}
847
848// CreditorReferenceType21: Entity that assigns the credit reference type.
849#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
850pub struct CreditorReferenceType21 {
851    #[serde(rename = "CdOrPrtry")]
852    pub cd_or_prtry: CreditorReferenceType1Choice,
853    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
854    pub issr: Option<String>,
855}
856
857impl Validate for CreditorReferenceType21 {
858    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
859        self.cd_or_prtry
860            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
861        if let Some(ref val) = self.issr {
862            helpers::validate_length(
863                val,
864                "Issr",
865                Some(1),
866                Some(35),
867                &helpers::child_path(path, "Issr"),
868                config,
869                collector,
870            );
871        }
872        if let Some(ref val) = self.issr {
873            helpers::validate_pattern(
874                val,
875                "Issr",
876                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
877                &helpers::child_path(path, "Issr"),
878                config,
879                collector,
880            );
881        }
882    }
883}
884
885// DateAndPlaceOfBirth1: Country where a person was born.
886#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
887pub struct DateAndPlaceOfBirth1 {
888    #[serde(rename = "BirthDt")]
889    pub birth_dt: String,
890    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
891    pub prvc_of_birth: Option<String>,
892    #[serde(rename = "CityOfBirth")]
893    pub city_of_birth: String,
894    #[serde(rename = "CtryOfBirth")]
895    pub ctry_of_birth: String,
896}
897
898impl Validate for DateAndPlaceOfBirth1 {
899    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
900        if let Some(ref val) = self.prvc_of_birth {
901            helpers::validate_length(
902                val,
903                "PrvcOfBirth",
904                Some(1),
905                Some(35),
906                &helpers::child_path(path, "PrvcOfBirth"),
907                config,
908                collector,
909            );
910        }
911        helpers::validate_length(
912            &self.city_of_birth,
913            "CityOfBirth",
914            Some(1),
915            Some(35),
916            &helpers::child_path(path, "CityOfBirth"),
917            config,
918            collector,
919        );
920        helpers::validate_pattern(
921            &self.ctry_of_birth,
922            "CtryOfBirth",
923            "[A-Z]{2,2}",
924            &helpers::child_path(path, "CtryOfBirth"),
925            config,
926            collector,
927        );
928    }
929}
930
931// DateAndPlaceOfBirth11: Country where a person was born.
932#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
933pub struct DateAndPlaceOfBirth11 {
934    #[serde(rename = "BirthDt")]
935    pub birth_dt: String,
936    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
937    pub prvc_of_birth: Option<String>,
938    #[serde(rename = "CityOfBirth")]
939    pub city_of_birth: String,
940    #[serde(rename = "CtryOfBirth")]
941    pub ctry_of_birth: String,
942}
943
944impl Validate for DateAndPlaceOfBirth11 {
945    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
946        if let Some(ref val) = self.prvc_of_birth {
947            helpers::validate_length(
948                val,
949                "PrvcOfBirth",
950                Some(1),
951                Some(35),
952                &helpers::child_path(path, "PrvcOfBirth"),
953                config,
954                collector,
955            );
956        }
957        if let Some(ref val) = self.prvc_of_birth {
958            helpers::validate_pattern(
959                val,
960                "PrvcOfBirth",
961                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
962                &helpers::child_path(path, "PrvcOfBirth"),
963                config,
964                collector,
965            );
966        }
967        helpers::validate_length(
968            &self.city_of_birth,
969            "CityOfBirth",
970            Some(1),
971            Some(35),
972            &helpers::child_path(path, "CityOfBirth"),
973            config,
974            collector,
975        );
976        helpers::validate_pattern(
977            &self.city_of_birth,
978            "CityOfBirth",
979            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
980            &helpers::child_path(path, "CityOfBirth"),
981            config,
982            collector,
983        );
984        helpers::validate_pattern(
985            &self.ctry_of_birth,
986            "CtryOfBirth",
987            "[A-Z]{2,2}",
988            &helpers::child_path(path, "CtryOfBirth"),
989            config,
990            collector,
991        );
992    }
993}
994
995// DatePeriod2: End date of the range.
996#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
997pub struct DatePeriod2 {
998    #[serde(rename = "FrDt")]
999    pub fr_dt: String,
1000    #[serde(rename = "ToDt")]
1001    pub to_dt: String,
1002}
1003
1004impl Validate for DatePeriod2 {
1005    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
1006}
1007
1008// DirectDebitTransaction101: Date on which the creditor notifies the debtor about the amount and date on which the direct debit instruction will be presented to the debtor's agent.
1009#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1010pub struct DirectDebitTransaction101 {
1011    #[serde(rename = "MndtRltdInf", skip_serializing_if = "Option::is_none")]
1012    pub mndt_rltd_inf: Option<MandateRelatedInformation141>,
1013    #[serde(rename = "CdtrSchmeId", skip_serializing_if = "Option::is_none")]
1014    pub cdtr_schme_id: Option<PartyIdentification1352>,
1015    #[serde(rename = "PreNtfctnId", skip_serializing_if = "Option::is_none")]
1016    pub pre_ntfctn_id: Option<String>,
1017    #[serde(rename = "PreNtfctnDt", skip_serializing_if = "Option::is_none")]
1018    pub pre_ntfctn_dt: Option<String>,
1019}
1020
1021impl Validate for DirectDebitTransaction101 {
1022    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1023        if let Some(ref val) = self.mndt_rltd_inf
1024            && config.validate_optional_fields
1025        {
1026            val.validate(&helpers::child_path(path, "MndtRltdInf"), config, collector);
1027        }
1028        if let Some(ref val) = self.cdtr_schme_id
1029            && config.validate_optional_fields
1030        {
1031            val.validate(&helpers::child_path(path, "CdtrSchmeId"), config, collector);
1032        }
1033        if let Some(ref val) = self.pre_ntfctn_id {
1034            helpers::validate_length(
1035                val,
1036                "PreNtfctnId",
1037                Some(1),
1038                Some(35),
1039                &helpers::child_path(path, "PreNtfctnId"),
1040                config,
1041                collector,
1042            );
1043        }
1044        if let Some(ref val) = self.pre_ntfctn_id {
1045            helpers::validate_pattern(
1046                val,
1047                "PreNtfctnId",
1048                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1049                &helpers::child_path(path, "PreNtfctnId"),
1050                config,
1051                collector,
1052            );
1053        }
1054    }
1055}
1056
1057// DirectDebitTransactionInformation241: Information supplied to enable the matching of an entry with the items that the transfer is intended to settle, such as commercial invoices in an accounts' receivable system.
1058#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1059pub struct DirectDebitTransactionInformation241 {
1060    #[serde(rename = "PmtId")]
1061    pub pmt_id: PaymentIdentification71,
1062    #[serde(rename = "PmtTpInf", skip_serializing_if = "Option::is_none")]
1063    pub pmt_tp_inf: Option<PaymentTypeInformation271>,
1064    #[serde(rename = "IntrBkSttlmAmt")]
1065    pub intr_bk_sttlm_amt: CBPRAmount,
1066    #[serde(rename = "IntrBkSttlmDt")]
1067    pub intr_bk_sttlm_dt: String,
1068    #[serde(rename = "SttlmPrty", skip_serializing_if = "Option::is_none")]
1069    pub sttlm_prty: Option<Priority3Code>,
1070    #[serde(rename = "SttlmTmIndctn", skip_serializing_if = "Option::is_none")]
1071    pub sttlm_tm_indctn: Option<SettlementDateTimeIndication11>,
1072    #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
1073    pub instd_amt: Option<CBPRAmount>,
1074    #[serde(rename = "XchgRate", skip_serializing_if = "Option::is_none")]
1075    pub xchg_rate: Option<f64>,
1076    #[serde(rename = "ChrgBr")]
1077    pub chrg_br: ChargeBearerType1Code1,
1078    #[serde(rename = "ChrgsInf", skip_serializing_if = "Option::is_none")]
1079    pub chrgs_inf: Option<Vec<Charges71>>,
1080    #[serde(rename = "ReqdColltnDt")]
1081    pub reqd_colltn_dt: String,
1082    #[serde(rename = "DrctDbtTx", skip_serializing_if = "Option::is_none")]
1083    pub drct_dbt_tx: Option<DirectDebitTransaction101>,
1084    #[serde(rename = "Cdtr")]
1085    pub cdtr: PartyIdentification1351,
1086    #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
1087    pub cdtr_acct: Option<CashAccount382>,
1088    #[serde(rename = "CdtrAgt")]
1089    pub cdtr_agt: BranchAndFinancialInstitutionIdentification61,
1090    #[serde(rename = "CdtrAgtAcct", skip_serializing_if = "Option::is_none")]
1091    pub cdtr_agt_acct: Option<CashAccount382>,
1092    #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
1093    pub ultmt_cdtr: Option<PartyIdentification1353>,
1094    #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
1095    pub initg_pty: Option<PartyIdentification1353>,
1096    #[serde(rename = "InstgAgt")]
1097    pub instg_agt: BranchAndFinancialInstitutionIdentification62,
1098    #[serde(rename = "InstdAgt")]
1099    pub instd_agt: BranchAndFinancialInstitutionIdentification62,
1100    #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
1101    pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification63>,
1102    #[serde(rename = "IntrmyAgt1Acct", skip_serializing_if = "Option::is_none")]
1103    pub intrmy_agt1_acct: Option<CashAccount382>,
1104    #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
1105    pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
1106    #[serde(rename = "IntrmyAgt2Acct", skip_serializing_if = "Option::is_none")]
1107    pub intrmy_agt2_acct: Option<CashAccount382>,
1108    #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
1109    pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
1110    #[serde(rename = "IntrmyAgt3Acct", skip_serializing_if = "Option::is_none")]
1111    pub intrmy_agt3_acct: Option<CashAccount383>,
1112    #[serde(rename = "Dbtr")]
1113    pub dbtr: PartyIdentification1354,
1114    #[serde(rename = "DbtrAcct")]
1115    pub dbtr_acct: CashAccount382,
1116    #[serde(rename = "DbtrAgt")]
1117    pub dbtr_agt: BranchAndFinancialInstitutionIdentification61,
1118    #[serde(rename = "DbtrAgtAcct", skip_serializing_if = "Option::is_none")]
1119    pub dbtr_agt_acct: Option<CashAccount383>,
1120    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
1121    pub ultmt_dbtr: Option<PartyIdentification1353>,
1122    #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
1123    pub purp: Option<Purpose2Choice1>,
1124    #[serde(rename = "RgltryRptg", skip_serializing_if = "Option::is_none")]
1125    pub rgltry_rptg: Option<Vec<RegulatoryReporting31>>,
1126    #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
1127    pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
1128    #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
1129    pub rmt_inf: Option<RemittanceInformation161>,
1130}
1131
1132impl Validate for DirectDebitTransactionInformation241 {
1133    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1134        self.pmt_id
1135            .validate(&helpers::child_path(path, "PmtId"), config, collector);
1136        if let Some(ref val) = self.pmt_tp_inf
1137            && config.validate_optional_fields
1138        {
1139            val.validate(&helpers::child_path(path, "PmtTpInf"), config, collector);
1140        }
1141        self.intr_bk_sttlm_amt.validate(
1142            &helpers::child_path(path, "IntrBkSttlmAmt"),
1143            config,
1144            collector,
1145        );
1146        if let Some(ref val) = self.sttlm_prty
1147            && config.validate_optional_fields
1148        {
1149            val.validate(&helpers::child_path(path, "SttlmPrty"), config, collector);
1150        }
1151        if let Some(ref val) = self.sttlm_tm_indctn
1152            && config.validate_optional_fields
1153        {
1154            val.validate(
1155                &helpers::child_path(path, "SttlmTmIndctn"),
1156                config,
1157                collector,
1158            );
1159        }
1160        if let Some(ref val) = self.instd_amt
1161            && config.validate_optional_fields
1162        {
1163            val.validate(&helpers::child_path(path, "InstdAmt"), config, collector);
1164        }
1165        self.chrg_br
1166            .validate(&helpers::child_path(path, "ChrgBr"), config, collector);
1167        if let Some(ref vec) = self.chrgs_inf
1168            && config.validate_optional_fields
1169        {
1170            for item in vec {
1171                item.validate(&helpers::child_path(path, "ChrgsInf"), config, collector);
1172            }
1173        }
1174        if let Some(ref val) = self.drct_dbt_tx
1175            && config.validate_optional_fields
1176        {
1177            val.validate(&helpers::child_path(path, "DrctDbtTx"), config, collector);
1178        }
1179        self.cdtr
1180            .validate(&helpers::child_path(path, "Cdtr"), config, collector);
1181        if let Some(ref val) = self.cdtr_acct
1182            && config.validate_optional_fields
1183        {
1184            val.validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
1185        }
1186        self.cdtr_agt
1187            .validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
1188        if let Some(ref val) = self.cdtr_agt_acct
1189            && config.validate_optional_fields
1190        {
1191            val.validate(&helpers::child_path(path, "CdtrAgtAcct"), config, collector);
1192        }
1193        if let Some(ref val) = self.ultmt_cdtr
1194            && config.validate_optional_fields
1195        {
1196            val.validate(&helpers::child_path(path, "UltmtCdtr"), config, collector);
1197        }
1198        if let Some(ref val) = self.initg_pty
1199            && config.validate_optional_fields
1200        {
1201            val.validate(&helpers::child_path(path, "InitgPty"), config, collector);
1202        }
1203        self.instg_agt
1204            .validate(&helpers::child_path(path, "InstgAgt"), config, collector);
1205        self.instd_agt
1206            .validate(&helpers::child_path(path, "InstdAgt"), config, collector);
1207        if let Some(ref val) = self.intrmy_agt1
1208            && config.validate_optional_fields
1209        {
1210            val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
1211        }
1212        if let Some(ref val) = self.intrmy_agt1_acct
1213            && config.validate_optional_fields
1214        {
1215            val.validate(
1216                &helpers::child_path(path, "IntrmyAgt1Acct"),
1217                config,
1218                collector,
1219            );
1220        }
1221        if let Some(ref val) = self.intrmy_agt2
1222            && config.validate_optional_fields
1223        {
1224            val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
1225        }
1226        if let Some(ref val) = self.intrmy_agt2_acct
1227            && config.validate_optional_fields
1228        {
1229            val.validate(
1230                &helpers::child_path(path, "IntrmyAgt2Acct"),
1231                config,
1232                collector,
1233            );
1234        }
1235        if let Some(ref val) = self.intrmy_agt3
1236            && config.validate_optional_fields
1237        {
1238            val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
1239        }
1240        if let Some(ref val) = self.intrmy_agt3_acct
1241            && config.validate_optional_fields
1242        {
1243            val.validate(
1244                &helpers::child_path(path, "IntrmyAgt3Acct"),
1245                config,
1246                collector,
1247            );
1248        }
1249        self.dbtr
1250            .validate(&helpers::child_path(path, "Dbtr"), config, collector);
1251        self.dbtr_acct
1252            .validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
1253        self.dbtr_agt
1254            .validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
1255        if let Some(ref val) = self.dbtr_agt_acct
1256            && config.validate_optional_fields
1257        {
1258            val.validate(&helpers::child_path(path, "DbtrAgtAcct"), config, collector);
1259        }
1260        if let Some(ref val) = self.ultmt_dbtr
1261            && config.validate_optional_fields
1262        {
1263            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
1264        }
1265        if let Some(ref val) = self.purp
1266            && config.validate_optional_fields
1267        {
1268            val.validate(&helpers::child_path(path, "Purp"), config, collector);
1269        }
1270        if let Some(ref vec) = self.rgltry_rptg
1271            && config.validate_optional_fields
1272        {
1273            for item in vec {
1274                item.validate(&helpers::child_path(path, "RgltryRptg"), config, collector);
1275            }
1276        }
1277        if let Some(ref vec) = self.rltd_rmt_inf
1278            && config.validate_optional_fields
1279        {
1280            for item in vec {
1281                item.validate(&helpers::child_path(path, "RltdRmtInf"), config, collector);
1282            }
1283        }
1284        if let Some(ref val) = self.rmt_inf
1285            && config.validate_optional_fields
1286        {
1287            val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
1288        }
1289    }
1290}
1291
1292// DiscountAmountAndType1: Amount of money, which has been typed.
1293#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1294pub struct DiscountAmountAndType1 {
1295    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1296    pub tp: Option<DiscountAmountType1Choice>,
1297    #[serde(rename = "Amt")]
1298    pub amt: ActiveOrHistoricCurrencyAndAmount,
1299}
1300
1301impl Validate for DiscountAmountAndType1 {
1302    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1303        if let Some(ref val) = self.tp
1304            && config.validate_optional_fields
1305        {
1306            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1307        }
1308        self.amt
1309            .validate(&helpers::child_path(path, "Amt"), config, collector);
1310    }
1311}
1312
1313// DiscountAmountAndType11: Amount of money, which has been typed.
1314#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1315pub struct DiscountAmountAndType11 {
1316    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1317    pub tp: Option<DiscountAmountType1Choice1>,
1318    #[serde(rename = "Amt")]
1319    pub amt: ActiveOrHistoricCurrencyAndAmount,
1320}
1321
1322impl Validate for DiscountAmountAndType11 {
1323    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1324        if let Some(ref val) = self.tp
1325            && config.validate_optional_fields
1326        {
1327            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1328        }
1329        self.amt
1330            .validate(&helpers::child_path(path, "Amt"), config, collector);
1331    }
1332}
1333
1334// DiscountAmountType1Choice: Specifies the amount type, in a free-text form.
1335#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1336pub struct DiscountAmountType1Choice {
1337    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1338    pub cd: Option<String>,
1339    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1340    pub prtry: Option<String>,
1341}
1342
1343impl Validate for DiscountAmountType1Choice {
1344    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1345        if let Some(ref val) = self.cd {
1346            helpers::validate_length(
1347                val,
1348                "Cd",
1349                Some(1),
1350                Some(4),
1351                &helpers::child_path(path, "Cd"),
1352                config,
1353                collector,
1354            );
1355        }
1356        if let Some(ref val) = self.prtry {
1357            helpers::validate_length(
1358                val,
1359                "Prtry",
1360                Some(1),
1361                Some(35),
1362                &helpers::child_path(path, "Prtry"),
1363                config,
1364                collector,
1365            );
1366        }
1367    }
1368}
1369
1370// DiscountAmountType1Choice1: Specifies the amount type, in a free-text form.
1371#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1372pub struct DiscountAmountType1Choice1 {
1373    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1374    pub cd: Option<String>,
1375    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1376    pub prtry: Option<String>,
1377}
1378
1379impl Validate for DiscountAmountType1Choice1 {
1380    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1381        if let Some(ref val) = self.cd {
1382            helpers::validate_length(
1383                val,
1384                "Cd",
1385                Some(1),
1386                Some(4),
1387                &helpers::child_path(path, "Cd"),
1388                config,
1389                collector,
1390            );
1391        }
1392        if let Some(ref val) = self.prtry {
1393            helpers::validate_length(
1394                val,
1395                "Prtry",
1396                Some(1),
1397                Some(35),
1398                &helpers::child_path(path, "Prtry"),
1399                config,
1400                collector,
1401            );
1402        }
1403        if let Some(ref val) = self.prtry {
1404            helpers::validate_pattern(
1405                val,
1406                "Prtry",
1407                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1408                &helpers::child_path(path, "Prtry"),
1409                config,
1410                collector,
1411            );
1412        }
1413    }
1414}
1415
1416// DocumentAdjustment1: Provides further details on the document adjustment.
1417#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1418pub struct DocumentAdjustment1 {
1419    #[serde(rename = "Amt")]
1420    pub amt: ActiveOrHistoricCurrencyAndAmount,
1421    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
1422    pub cdt_dbt_ind: Option<CreditDebitCode>,
1423    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
1424    pub rsn: Option<String>,
1425    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
1426    pub addtl_inf: Option<String>,
1427}
1428
1429impl Validate for DocumentAdjustment1 {
1430    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1431        self.amt
1432            .validate(&helpers::child_path(path, "Amt"), config, collector);
1433        if let Some(ref val) = self.cdt_dbt_ind
1434            && config.validate_optional_fields
1435        {
1436            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
1437        }
1438        if let Some(ref val) = self.rsn {
1439            helpers::validate_length(
1440                val,
1441                "Rsn",
1442                Some(1),
1443                Some(4),
1444                &helpers::child_path(path, "Rsn"),
1445                config,
1446                collector,
1447            );
1448        }
1449        if let Some(ref val) = self.addtl_inf {
1450            helpers::validate_length(
1451                val,
1452                "AddtlInf",
1453                Some(1),
1454                Some(140),
1455                &helpers::child_path(path, "AddtlInf"),
1456                config,
1457                collector,
1458            );
1459        }
1460    }
1461}
1462
1463// DocumentAdjustment11: Provides further details on the document adjustment.
1464#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1465pub struct DocumentAdjustment11 {
1466    #[serde(rename = "Amt")]
1467    pub amt: ActiveOrHistoricCurrencyAndAmount,
1468    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
1469    pub cdt_dbt_ind: Option<CreditDebitCode>,
1470    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
1471    pub rsn: Option<String>,
1472    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
1473    pub addtl_inf: Option<String>,
1474}
1475
1476impl Validate for DocumentAdjustment11 {
1477    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1478        self.amt
1479            .validate(&helpers::child_path(path, "Amt"), config, collector);
1480        if let Some(ref val) = self.cdt_dbt_ind
1481            && config.validate_optional_fields
1482        {
1483            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
1484        }
1485        if let Some(ref val) = self.rsn {
1486            helpers::validate_length(
1487                val,
1488                "Rsn",
1489                Some(1),
1490                Some(4),
1491                &helpers::child_path(path, "Rsn"),
1492                config,
1493                collector,
1494            );
1495        }
1496        if let Some(ref val) = self.rsn {
1497            helpers::validate_pattern(
1498                val,
1499                "Rsn",
1500                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1501                &helpers::child_path(path, "Rsn"),
1502                config,
1503                collector,
1504            );
1505        }
1506        if let Some(ref val) = self.addtl_inf {
1507            helpers::validate_length(
1508                val,
1509                "AddtlInf",
1510                Some(1),
1511                Some(140),
1512                &helpers::child_path(path, "AddtlInf"),
1513                config,
1514                collector,
1515            );
1516        }
1517        if let Some(ref val) = self.addtl_inf {
1518            helpers::validate_pattern(
1519                val,
1520                "AddtlInf",
1521                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1522                &helpers::child_path(path, "AddtlInf"),
1523                config,
1524                collector,
1525            );
1526        }
1527    }
1528}
1529
1530// DocumentLineIdentification11: Date associated with the referred document line.
1531#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1532pub struct DocumentLineIdentification11 {
1533    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1534    pub tp: Option<DocumentLineType11>,
1535    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
1536    pub nb: Option<String>,
1537    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
1538    pub rltd_dt: Option<String>,
1539}
1540
1541impl Validate for DocumentLineIdentification11 {
1542    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1543        if let Some(ref val) = self.tp
1544            && config.validate_optional_fields
1545        {
1546            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1547        }
1548        if let Some(ref val) = self.nb {
1549            helpers::validate_length(
1550                val,
1551                "Nb",
1552                Some(1),
1553                Some(35),
1554                &helpers::child_path(path, "Nb"),
1555                config,
1556                collector,
1557            );
1558        }
1559        if let Some(ref val) = self.nb {
1560            helpers::validate_pattern(
1561                val,
1562                "Nb",
1563                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1564                &helpers::child_path(path, "Nb"),
1565                config,
1566                collector,
1567            );
1568        }
1569    }
1570}
1571
1572// DocumentLineInformation11: Provides details on the amounts of the document line.
1573#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1574pub struct DocumentLineInformation11 {
1575    #[serde(rename = "Id")]
1576    pub id: Vec<DocumentLineIdentification11>,
1577    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
1578    pub desc: Option<String>,
1579    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
1580    pub amt: Option<RemittanceAmount31>,
1581}
1582
1583impl Validate for DocumentLineInformation11 {
1584    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1585        for item in &self.id {
1586            item.validate(&helpers::child_path(path, "Id"), config, collector);
1587        }
1588        if let Some(ref val) = self.desc {
1589            helpers::validate_length(
1590                val,
1591                "Desc",
1592                Some(1),
1593                Some(35),
1594                &helpers::child_path(path, "Desc"),
1595                config,
1596                collector,
1597            );
1598        }
1599        if let Some(ref val) = self.desc {
1600            helpers::validate_pattern(
1601                val,
1602                "Desc",
1603                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1604                &helpers::child_path(path, "Desc"),
1605                config,
1606                collector,
1607            );
1608        }
1609        if let Some(ref val) = self.amt
1610            && config.validate_optional_fields
1611        {
1612            val.validate(&helpers::child_path(path, "Amt"), config, collector);
1613        }
1614    }
1615}
1616
1617// DocumentLineType1Choice1: Proprietary identification of the type of the remittance document.
1618#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1619pub struct DocumentLineType1Choice1 {
1620    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1621    pub cd: Option<String>,
1622    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1623    pub prtry: Option<String>,
1624}
1625
1626impl Validate for DocumentLineType1Choice1 {
1627    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1628        if let Some(ref val) = self.cd {
1629            helpers::validate_length(
1630                val,
1631                "Cd",
1632                Some(1),
1633                Some(4),
1634                &helpers::child_path(path, "Cd"),
1635                config,
1636                collector,
1637            );
1638        }
1639        if let Some(ref val) = self.prtry {
1640            helpers::validate_length(
1641                val,
1642                "Prtry",
1643                Some(1),
1644                Some(35),
1645                &helpers::child_path(path, "Prtry"),
1646                config,
1647                collector,
1648            );
1649        }
1650        if let Some(ref val) = self.prtry {
1651            helpers::validate_pattern(
1652                val,
1653                "Prtry",
1654                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1655                &helpers::child_path(path, "Prtry"),
1656                config,
1657                collector,
1658            );
1659        }
1660    }
1661}
1662
1663// DocumentLineType11: Identification of the issuer of the reference document line identificationtype.
1664#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1665pub struct DocumentLineType11 {
1666    #[serde(rename = "CdOrPrtry")]
1667    pub cd_or_prtry: DocumentLineType1Choice1,
1668    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1669    pub issr: Option<String>,
1670}
1671
1672impl Validate for DocumentLineType11 {
1673    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1674        self.cd_or_prtry
1675            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
1676        if let Some(ref val) = self.issr {
1677            helpers::validate_length(
1678                val,
1679                "Issr",
1680                Some(1),
1681                Some(35),
1682                &helpers::child_path(path, "Issr"),
1683                config,
1684                collector,
1685            );
1686        }
1687        if let Some(ref val) = self.issr {
1688            helpers::validate_pattern(
1689                val,
1690                "Issr",
1691                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1692                &helpers::child_path(path, "Issr"),
1693                config,
1694                collector,
1695            );
1696        }
1697    }
1698}
1699
1700// DocumentType3Code: Document is a structured communication reference provided by the creditor to identify the referred transaction.
1701#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1702pub enum DocumentType3Code {
1703    #[default]
1704    #[serde(rename = "RADM")]
1705    CodeRADM,
1706    #[serde(rename = "RPIN")]
1707    CodeRPIN,
1708    #[serde(rename = "FXDR")]
1709    CodeFXDR,
1710    #[serde(rename = "DISP")]
1711    CodeDISP,
1712    #[serde(rename = "PUOR")]
1713    CodePUOR,
1714    #[serde(rename = "SCOR")]
1715    CodeSCOR,
1716}
1717
1718impl Validate for DocumentType3Code {
1719    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1720        // Enum validation is typically empty
1721    }
1722}
1723
1724// DocumentType6Code: Document is a purchase order.
1725#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1726pub enum DocumentType6Code {
1727    #[default]
1728    #[serde(rename = "MSIN")]
1729    CodeMSIN,
1730    #[serde(rename = "CNFA")]
1731    CodeCNFA,
1732    #[serde(rename = "DNFA")]
1733    CodeDNFA,
1734    #[serde(rename = "CINV")]
1735    CodeCINV,
1736    #[serde(rename = "CREN")]
1737    CodeCREN,
1738    #[serde(rename = "DEBN")]
1739    CodeDEBN,
1740    #[serde(rename = "HIRI")]
1741    CodeHIRI,
1742    #[serde(rename = "SBIN")]
1743    CodeSBIN,
1744    #[serde(rename = "CMCN")]
1745    CodeCMCN,
1746    #[serde(rename = "SOAC")]
1747    CodeSOAC,
1748    #[serde(rename = "DISP")]
1749    CodeDISP,
1750    #[serde(rename = "BOLD")]
1751    CodeBOLD,
1752    #[serde(rename = "VCHR")]
1753    CodeVCHR,
1754    #[serde(rename = "AROI")]
1755    CodeAROI,
1756    #[serde(rename = "TSUT")]
1757    CodeTSUT,
1758    #[serde(rename = "PUOR")]
1759    CodePUOR,
1760}
1761
1762impl Validate for DocumentType6Code {
1763    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1764        // Enum validation is typically empty
1765    }
1766}
1767
1768// FIToFICustomerDirectDebitV08: Set of elements providing information specific to the individual direct debit(s).
1769#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1770pub struct FIToFICustomerDirectDebitV08 {
1771    #[serde(rename = "GrpHdr")]
1772    pub grp_hdr: GroupHeader941,
1773    #[serde(rename = "DrctDbtTxInf")]
1774    pub drct_dbt_tx_inf: DirectDebitTransactionInformation241,
1775}
1776
1777impl Validate for FIToFICustomerDirectDebitV08 {
1778    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1779        self.grp_hdr
1780            .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
1781        self.drct_dbt_tx_inf.validate(
1782            &helpers::child_path(path, "DrctDbtTxInf"),
1783            config,
1784            collector,
1785        );
1786    }
1787}
1788
1789// FinancialInstitutionIdentification181: Information that locates and identifies a specific address, as defined by postal services.
1790#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1791pub struct FinancialInstitutionIdentification181 {
1792    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1793    pub bicfi: Option<String>,
1794    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1795    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1796    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1797    pub lei: Option<String>,
1798    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1799    pub nm: Option<String>,
1800    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1801    pub pstl_adr: Option<PostalAddress241>,
1802}
1803
1804impl Validate for FinancialInstitutionIdentification181 {
1805    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1806        if let Some(ref val) = self.bicfi {
1807            helpers::validate_pattern(
1808                val,
1809                "BICFI",
1810                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1811                &helpers::child_path(path, "BICFI"),
1812                config,
1813                collector,
1814            );
1815        }
1816        if let Some(ref val) = self.clr_sys_mmb_id
1817            && config.validate_optional_fields
1818        {
1819            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
1820        }
1821        if let Some(ref val) = self.lei {
1822            helpers::validate_pattern(
1823                val,
1824                "LEI",
1825                "[A-Z0-9]{18,18}[0-9]{2,2}",
1826                &helpers::child_path(path, "LEI"),
1827                config,
1828                collector,
1829            );
1830        }
1831        if let Some(ref val) = self.nm {
1832            helpers::validate_length(
1833                val,
1834                "Nm",
1835                Some(1),
1836                Some(140),
1837                &helpers::child_path(path, "Nm"),
1838                config,
1839                collector,
1840            );
1841        }
1842        if let Some(ref val) = self.nm {
1843            helpers::validate_pattern(
1844                val,
1845                "Nm",
1846                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1847                &helpers::child_path(path, "Nm"),
1848                config,
1849                collector,
1850            );
1851        }
1852        if let Some(ref val) = self.pstl_adr
1853            && config.validate_optional_fields
1854        {
1855            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1856        }
1857    }
1858}
1859
1860// FinancialInstitutionIdentification182: Legal entity identifier of the financial institution.
1861#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1862pub struct FinancialInstitutionIdentification182 {
1863    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1864    pub bicfi: Option<String>,
1865    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1866    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1867    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1868    pub lei: Option<String>,
1869}
1870
1871impl Validate for FinancialInstitutionIdentification182 {
1872    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1873        if let Some(ref val) = self.bicfi {
1874            helpers::validate_pattern(
1875                val,
1876                "BICFI",
1877                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1878                &helpers::child_path(path, "BICFI"),
1879                config,
1880                collector,
1881            );
1882        }
1883        if let Some(ref val) = self.clr_sys_mmb_id
1884            && config.validate_optional_fields
1885        {
1886            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
1887        }
1888        if let Some(ref val) = self.lei {
1889            helpers::validate_pattern(
1890                val,
1891                "LEI",
1892                "[A-Z0-9]{18,18}[0-9]{2,2}",
1893                &helpers::child_path(path, "LEI"),
1894                config,
1895                collector,
1896            );
1897        }
1898    }
1899}
1900
1901// FinancialInstitutionIdentification183: Information that locates and identifies a specific address, as defined by postal services.
1902#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1903pub struct FinancialInstitutionIdentification183 {
1904    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1905    pub bicfi: Option<String>,
1906    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1907    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1908    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1909    pub lei: Option<String>,
1910    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1911    pub nm: Option<String>,
1912    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1913    pub pstl_adr: Option<PostalAddress244>,
1914}
1915
1916impl Validate for FinancialInstitutionIdentification183 {
1917    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1918        if let Some(ref val) = self.bicfi {
1919            helpers::validate_pattern(
1920                val,
1921                "BICFI",
1922                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1923                &helpers::child_path(path, "BICFI"),
1924                config,
1925                collector,
1926            );
1927        }
1928        if let Some(ref val) = self.clr_sys_mmb_id
1929            && config.validate_optional_fields
1930        {
1931            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
1932        }
1933        if let Some(ref val) = self.lei {
1934            helpers::validate_pattern(
1935                val,
1936                "LEI",
1937                "[A-Z0-9]{18,18}[0-9]{2,2}",
1938                &helpers::child_path(path, "LEI"),
1939                config,
1940                collector,
1941            );
1942        }
1943        if let Some(ref val) = self.nm {
1944            helpers::validate_length(
1945                val,
1946                "Nm",
1947                Some(1),
1948                Some(140),
1949                &helpers::child_path(path, "Nm"),
1950                config,
1951                collector,
1952            );
1953        }
1954        if let Some(ref val) = self.nm {
1955            helpers::validate_pattern(
1956                val,
1957                "Nm",
1958                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1959                &helpers::child_path(path, "Nm"),
1960                config,
1961                collector,
1962            );
1963        }
1964        if let Some(ref val) = self.pstl_adr
1965            && config.validate_optional_fields
1966        {
1967            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1968        }
1969    }
1970}
1971
1972// Frequency36Choice: Specifies a frequency in terms of an exact point in time or moment within a specified period type.
1973#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1974pub struct Frequency36Choice {
1975    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1976    pub tp: Option<Frequency6Code>,
1977    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
1978    pub prd: Option<FrequencyPeriod1>,
1979    #[serde(rename = "PtInTm", skip_serializing_if = "Option::is_none")]
1980    pub pt_in_tm: Option<FrequencyAndMoment1>,
1981}
1982
1983impl Validate for Frequency36Choice {
1984    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1985        if let Some(ref val) = self.tp
1986            && config.validate_optional_fields
1987        {
1988            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1989        }
1990        if let Some(ref val) = self.prd
1991            && config.validate_optional_fields
1992        {
1993            val.validate(&helpers::child_path(path, "Prd"), config, collector);
1994        }
1995        if let Some(ref val) = self.pt_in_tm
1996            && config.validate_optional_fields
1997        {
1998            val.validate(&helpers::child_path(path, "PtInTm"), config, collector);
1999        }
2000    }
2001}
2002
2003// Frequency6Code: Event takes place every two weeks.
2004#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2005pub enum Frequency6Code {
2006    #[default]
2007    #[serde(rename = "YEAR")]
2008    CodeYEAR,
2009    #[serde(rename = "MNTH")]
2010    CodeMNTH,
2011    #[serde(rename = "QURT")]
2012    CodeQURT,
2013    #[serde(rename = "MIAN")]
2014    CodeMIAN,
2015    #[serde(rename = "WEEK")]
2016    CodeWEEK,
2017    #[serde(rename = "DAIL")]
2018    CodeDAIL,
2019    #[serde(rename = "ADHO")]
2020    CodeADHO,
2021    #[serde(rename = "INDA")]
2022    CodeINDA,
2023    #[serde(rename = "FRTN")]
2024    CodeFRTN,
2025}
2026
2027impl Validate for Frequency6Code {
2028    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2029        // Enum validation is typically empty
2030    }
2031}
2032
2033// FrequencyAndMoment1: Further information on the exact point in time the event should take place.
2034#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2035pub struct FrequencyAndMoment1 {
2036    #[serde(rename = "Tp")]
2037    pub tp: Frequency6Code,
2038    #[serde(rename = "PtInTm")]
2039    pub pt_in_tm: String,
2040}
2041
2042impl Validate for FrequencyAndMoment1 {
2043    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2044        self.tp
2045            .validate(&helpers::child_path(path, "Tp"), config, collector);
2046        helpers::validate_pattern(
2047            &self.pt_in_tm,
2048            "PtInTm",
2049            "[0-9]{2}",
2050            &helpers::child_path(path, "PtInTm"),
2051            config,
2052            collector,
2053        );
2054    }
2055}
2056
2057// FrequencyPeriod1: Number of instructions to be created and processed during the specified period.
2058#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2059pub struct FrequencyPeriod1 {
2060    #[serde(rename = "Tp")]
2061    pub tp: Frequency6Code,
2062    #[serde(rename = "CntPerPrd")]
2063    pub cnt_per_prd: f64,
2064}
2065
2066impl Validate for FrequencyPeriod1 {
2067    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2068        self.tp
2069            .validate(&helpers::child_path(path, "Tp"), config, collector);
2070    }
2071}
2072
2073// Garnishment31: Indicates if the employment of the person to whom the garnishment applies (that is, the ultimate debtor) has been terminated.
2074#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2075pub struct Garnishment31 {
2076    #[serde(rename = "Tp")]
2077    pub tp: GarnishmentType11,
2078    #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
2079    pub grnshee: Option<PartyIdentification1356>,
2080    #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
2081    pub grnshmt_admstr: Option<PartyIdentification1357>,
2082    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
2083    pub ref_nb: Option<String>,
2084    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2085    pub dt: Option<String>,
2086    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
2087    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2088    #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
2089    pub fmly_mdcl_insrnc_ind: Option<bool>,
2090    #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
2091    pub mplyee_termntn_ind: Option<bool>,
2092}
2093
2094impl Validate for Garnishment31 {
2095    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2096        self.tp
2097            .validate(&helpers::child_path(path, "Tp"), config, collector);
2098        if let Some(ref val) = self.grnshee
2099            && config.validate_optional_fields
2100        {
2101            val.validate(&helpers::child_path(path, "Grnshee"), config, collector);
2102        }
2103        if let Some(ref val) = self.grnshmt_admstr
2104            && config.validate_optional_fields
2105        {
2106            val.validate(
2107                &helpers::child_path(path, "GrnshmtAdmstr"),
2108                config,
2109                collector,
2110            );
2111        }
2112        if let Some(ref val) = self.ref_nb {
2113            helpers::validate_length(
2114                val,
2115                "RefNb",
2116                Some(1),
2117                Some(140),
2118                &helpers::child_path(path, "RefNb"),
2119                config,
2120                collector,
2121            );
2122        }
2123        if let Some(ref val) = self.ref_nb {
2124            helpers::validate_pattern(
2125                val,
2126                "RefNb",
2127                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2128                &helpers::child_path(path, "RefNb"),
2129                config,
2130                collector,
2131            );
2132        }
2133        if let Some(ref val) = self.rmtd_amt
2134            && config.validate_optional_fields
2135        {
2136            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
2137        }
2138    }
2139}
2140
2141// GarnishmentType1Choice: Proprietary identification of the type of garnishment.
2142#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2143pub struct GarnishmentType1Choice {
2144    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2145    pub cd: Option<String>,
2146    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2147    pub prtry: Option<String>,
2148}
2149
2150impl Validate for GarnishmentType1Choice {
2151    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2152        if let Some(ref val) = self.cd {
2153            helpers::validate_length(
2154                val,
2155                "Cd",
2156                Some(1),
2157                Some(4),
2158                &helpers::child_path(path, "Cd"),
2159                config,
2160                collector,
2161            );
2162        }
2163        if let Some(ref val) = self.prtry {
2164            helpers::validate_length(
2165                val,
2166                "Prtry",
2167                Some(1),
2168                Some(35),
2169                &helpers::child_path(path, "Prtry"),
2170                config,
2171                collector,
2172            );
2173        }
2174    }
2175}
2176
2177// GarnishmentType11: Identification of the issuer of the garnishment type.
2178#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2179pub struct GarnishmentType11 {
2180    #[serde(rename = "CdOrPrtry")]
2181    pub cd_or_prtry: GarnishmentType1Choice,
2182    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2183    pub issr: Option<String>,
2184}
2185
2186impl Validate for GarnishmentType11 {
2187    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2188        self.cd_or_prtry
2189            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
2190        if let Some(ref val) = self.issr {
2191            helpers::validate_length(
2192                val,
2193                "Issr",
2194                Some(1),
2195                Some(35),
2196                &helpers::child_path(path, "Issr"),
2197                config,
2198                collector,
2199            );
2200        }
2201        if let Some(ref val) = self.issr {
2202            helpers::validate_pattern(
2203                val,
2204                "Issr",
2205                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2206                &helpers::child_path(path, "Issr"),
2207                config,
2208                collector,
2209            );
2210        }
2211    }
2212}
2213
2214// GenericAccountIdentification11: Entity that assigns the identification.
2215#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2216pub struct GenericAccountIdentification11 {
2217    #[serde(rename = "Id")]
2218    pub id: String,
2219    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2220    pub schme_nm: Option<AccountSchemeName1Choice>,
2221    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2222    pub issr: Option<String>,
2223}
2224
2225impl Validate for GenericAccountIdentification11 {
2226    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2227        helpers::validate_length(
2228            &self.id,
2229            "Id",
2230            Some(1),
2231            Some(34),
2232            &helpers::child_path(path, "Id"),
2233            config,
2234            collector,
2235        );
2236        helpers::validate_pattern(
2237            &self.id,
2238            "Id",
2239            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
2240            &helpers::child_path(path, "Id"),
2241            config,
2242            collector,
2243        );
2244        if let Some(ref val) = self.schme_nm
2245            && config.validate_optional_fields
2246        {
2247            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2248        }
2249        if let Some(ref val) = self.issr {
2250            helpers::validate_length(
2251                val,
2252                "Issr",
2253                Some(1),
2254                Some(35),
2255                &helpers::child_path(path, "Issr"),
2256                config,
2257                collector,
2258            );
2259        }
2260        if let Some(ref val) = self.issr {
2261            helpers::validate_pattern(
2262                val,
2263                "Issr",
2264                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2265                &helpers::child_path(path, "Issr"),
2266                config,
2267                collector,
2268            );
2269        }
2270    }
2271}
2272
2273// GenericAccountIdentification12: Entity that assigns the identification.
2274#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2275pub struct GenericAccountIdentification12 {
2276    #[serde(rename = "Id")]
2277    pub id: String,
2278    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2279    pub schme_nm: Option<AccountSchemeName1Choice1>,
2280    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2281    pub issr: Option<String>,
2282}
2283
2284impl Validate for GenericAccountIdentification12 {
2285    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2286        helpers::validate_length(
2287            &self.id,
2288            "Id",
2289            Some(1),
2290            Some(34),
2291            &helpers::child_path(path, "Id"),
2292            config,
2293            collector,
2294        );
2295        helpers::validate_pattern(
2296            &self.id,
2297            "Id",
2298            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
2299            &helpers::child_path(path, "Id"),
2300            config,
2301            collector,
2302        );
2303        if let Some(ref val) = self.schme_nm
2304            && config.validate_optional_fields
2305        {
2306            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2307        }
2308        if let Some(ref val) = self.issr {
2309            helpers::validate_length(
2310                val,
2311                "Issr",
2312                Some(1),
2313                Some(35),
2314                &helpers::child_path(path, "Issr"),
2315                config,
2316                collector,
2317            );
2318        }
2319        if let Some(ref val) = self.issr {
2320            helpers::validate_pattern(
2321                val,
2322                "Issr",
2323                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2324                &helpers::child_path(path, "Issr"),
2325                config,
2326                collector,
2327            );
2328        }
2329    }
2330}
2331
2332// GenericOrganisationIdentification11: Entity that assigns the identification.
2333#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2334pub struct GenericOrganisationIdentification11 {
2335    #[serde(rename = "Id")]
2336    pub id: String,
2337    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2338    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
2339    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2340    pub issr: Option<String>,
2341}
2342
2343impl Validate for GenericOrganisationIdentification11 {
2344    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2345        helpers::validate_length(
2346            &self.id,
2347            "Id",
2348            Some(1),
2349            Some(35),
2350            &helpers::child_path(path, "Id"),
2351            config,
2352            collector,
2353        );
2354        helpers::validate_pattern(
2355            &self.id,
2356            "Id",
2357            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2358            &helpers::child_path(path, "Id"),
2359            config,
2360            collector,
2361        );
2362        if let Some(ref val) = self.schme_nm
2363            && config.validate_optional_fields
2364        {
2365            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2366        }
2367        if let Some(ref val) = self.issr {
2368            helpers::validate_length(
2369                val,
2370                "Issr",
2371                Some(1),
2372                Some(35),
2373                &helpers::child_path(path, "Issr"),
2374                config,
2375                collector,
2376            );
2377        }
2378        if let Some(ref val) = self.issr {
2379            helpers::validate_pattern(
2380                val,
2381                "Issr",
2382                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2383                &helpers::child_path(path, "Issr"),
2384                config,
2385                collector,
2386            );
2387        }
2388    }
2389}
2390
2391// GenericOrganisationIdentification12: Entity that assigns the identification.
2392#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2393pub struct GenericOrganisationIdentification12 {
2394    #[serde(rename = "Id")]
2395    pub id: String,
2396    #[serde(rename = "SchmeNm")]
2397    pub schme_nm: OrganisationIdentificationSchemeName1Choice2,
2398    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2399    pub issr: Option<String>,
2400}
2401
2402impl Validate for GenericOrganisationIdentification12 {
2403    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2404        helpers::validate_length(
2405            &self.id,
2406            "Id",
2407            Some(1),
2408            Some(35),
2409            &helpers::child_path(path, "Id"),
2410            config,
2411            collector,
2412        );
2413        helpers::validate_pattern(
2414            &self.id,
2415            "Id",
2416            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2417            &helpers::child_path(path, "Id"),
2418            config,
2419            collector,
2420        );
2421        self.schme_nm
2422            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2423        if let Some(ref val) = self.issr {
2424            helpers::validate_length(
2425                val,
2426                "Issr",
2427                Some(1),
2428                Some(35),
2429                &helpers::child_path(path, "Issr"),
2430                config,
2431                collector,
2432            );
2433        }
2434        if let Some(ref val) = self.issr {
2435            helpers::validate_pattern(
2436                val,
2437                "Issr",
2438                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2439                &helpers::child_path(path, "Issr"),
2440                config,
2441                collector,
2442            );
2443        }
2444    }
2445}
2446
2447// GenericOrganisationIdentification13: Entity that assigns the identification.
2448#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2449pub struct GenericOrganisationIdentification13 {
2450    #[serde(rename = "Id")]
2451    pub id: String,
2452    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2453    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice3>,
2454    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2455    pub issr: Option<String>,
2456}
2457
2458impl Validate for GenericOrganisationIdentification13 {
2459    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2460        helpers::validate_length(
2461            &self.id,
2462            "Id",
2463            Some(1),
2464            Some(35),
2465            &helpers::child_path(path, "Id"),
2466            config,
2467            collector,
2468        );
2469        helpers::validate_pattern(
2470            &self.id,
2471            "Id",
2472            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2473            &helpers::child_path(path, "Id"),
2474            config,
2475            collector,
2476        );
2477        if let Some(ref val) = self.schme_nm
2478            && config.validate_optional_fields
2479        {
2480            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2481        }
2482        if let Some(ref val) = self.issr {
2483            helpers::validate_length(
2484                val,
2485                "Issr",
2486                Some(1),
2487                Some(35),
2488                &helpers::child_path(path, "Issr"),
2489                config,
2490                collector,
2491            );
2492        }
2493        if let Some(ref val) = self.issr {
2494            helpers::validate_pattern(
2495                val,
2496                "Issr",
2497                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2498                &helpers::child_path(path, "Issr"),
2499                config,
2500                collector,
2501            );
2502        }
2503    }
2504}
2505
2506// GenericPersonIdentification11: Entity that assigns the identification.
2507#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2508pub struct GenericPersonIdentification11 {
2509    #[serde(rename = "Id")]
2510    pub id: String,
2511    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2512    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
2513    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2514    pub issr: Option<String>,
2515}
2516
2517impl Validate for GenericPersonIdentification11 {
2518    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2519        helpers::validate_length(
2520            &self.id,
2521            "Id",
2522            Some(1),
2523            Some(35),
2524            &helpers::child_path(path, "Id"),
2525            config,
2526            collector,
2527        );
2528        helpers::validate_pattern(
2529            &self.id,
2530            "Id",
2531            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2532            &helpers::child_path(path, "Id"),
2533            config,
2534            collector,
2535        );
2536        if let Some(ref val) = self.schme_nm
2537            && config.validate_optional_fields
2538        {
2539            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2540        }
2541        if let Some(ref val) = self.issr {
2542            helpers::validate_length(
2543                val,
2544                "Issr",
2545                Some(1),
2546                Some(35),
2547                &helpers::child_path(path, "Issr"),
2548                config,
2549                collector,
2550            );
2551        }
2552        if let Some(ref val) = self.issr {
2553            helpers::validate_pattern(
2554                val,
2555                "Issr",
2556                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2557                &helpers::child_path(path, "Issr"),
2558                config,
2559                collector,
2560            );
2561        }
2562    }
2563}
2564
2565// GenericPersonIdentification12: Entity that assigns the identification.
2566#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2567pub struct GenericPersonIdentification12 {
2568    #[serde(rename = "Id")]
2569    pub id: String,
2570    #[serde(rename = "SchmeNm")]
2571    pub schme_nm: PersonIdentificationSchemeName1Choice2,
2572    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2573    pub issr: Option<String>,
2574}
2575
2576impl Validate for GenericPersonIdentification12 {
2577    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2578        helpers::validate_length(
2579            &self.id,
2580            "Id",
2581            Some(1),
2582            Some(35),
2583            &helpers::child_path(path, "Id"),
2584            config,
2585            collector,
2586        );
2587        helpers::validate_pattern(
2588            &self.id,
2589            "Id",
2590            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2591            &helpers::child_path(path, "Id"),
2592            config,
2593            collector,
2594        );
2595        self.schme_nm
2596            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2597        if let Some(ref val) = self.issr {
2598            helpers::validate_length(
2599                val,
2600                "Issr",
2601                Some(1),
2602                Some(35),
2603                &helpers::child_path(path, "Issr"),
2604                config,
2605                collector,
2606            );
2607        }
2608        if let Some(ref val) = self.issr {
2609            helpers::validate_pattern(
2610                val,
2611                "Issr",
2612                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2613                &helpers::child_path(path, "Issr"),
2614                config,
2615                collector,
2616            );
2617        }
2618    }
2619}
2620
2621// GenericPersonIdentification13: Entity that assigns the identification.
2622#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2623pub struct GenericPersonIdentification13 {
2624    #[serde(rename = "Id")]
2625    pub id: String,
2626    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2627    pub schme_nm: Option<PersonIdentificationSchemeName1Choice3>,
2628    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2629    pub issr: Option<String>,
2630}
2631
2632impl Validate for GenericPersonIdentification13 {
2633    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2634        helpers::validate_length(
2635            &self.id,
2636            "Id",
2637            Some(1),
2638            Some(35),
2639            &helpers::child_path(path, "Id"),
2640            config,
2641            collector,
2642        );
2643        helpers::validate_pattern(
2644            &self.id,
2645            "Id",
2646            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2647            &helpers::child_path(path, "Id"),
2648            config,
2649            collector,
2650        );
2651        if let Some(ref val) = self.schme_nm
2652            && config.validate_optional_fields
2653        {
2654            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2655        }
2656        if let Some(ref val) = self.issr {
2657            helpers::validate_length(
2658                val,
2659                "Issr",
2660                Some(1),
2661                Some(35),
2662                &helpers::child_path(path, "Issr"),
2663                config,
2664                collector,
2665            );
2666        }
2667        if let Some(ref val) = self.issr {
2668            helpers::validate_pattern(
2669                val,
2670                "Issr",
2671                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2672                &helpers::child_path(path, "Issr"),
2673                config,
2674                collector,
2675            );
2676        }
2677    }
2678}
2679
2680// GroupHeader941: Specifies the details on how the settlement of the transaction(s) between the instructing agent and the instructed agent is completed.
2681#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2682pub struct GroupHeader941 {
2683    #[serde(rename = "MsgId")]
2684    pub msg_id: String,
2685    #[serde(rename = "CreDtTm")]
2686    pub cre_dt_tm: String,
2687    #[serde(rename = "NbOfTxs")]
2688    pub nb_of_txs: Max15NumericTextfixed,
2689    #[serde(rename = "SttlmInf")]
2690    pub sttlm_inf: SettlementInstruction81,
2691}
2692
2693impl Validate for GroupHeader941 {
2694    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2695        helpers::validate_length(
2696            &self.msg_id,
2697            "MsgId",
2698            Some(1),
2699            Some(35),
2700            &helpers::child_path(path, "MsgId"),
2701            config,
2702            collector,
2703        );
2704        helpers::validate_pattern(
2705            &self.msg_id,
2706            "MsgId",
2707            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2708            &helpers::child_path(path, "MsgId"),
2709            config,
2710            collector,
2711        );
2712        helpers::validate_pattern(
2713            &self.cre_dt_tm,
2714            "CreDtTm",
2715            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
2716            &helpers::child_path(path, "CreDtTm"),
2717            config,
2718            collector,
2719        );
2720        self.nb_of_txs
2721            .validate(&helpers::child_path(path, "NbOfTxs"), config, collector);
2722        self.sttlm_inf
2723            .validate(&helpers::child_path(path, "SttlmInf"), config, collector);
2724    }
2725}
2726
2727// LocalInstrument2Choice1: Specifies the local instrument, as a proprietary code.
2728#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2729pub struct LocalInstrument2Choice1 {
2730    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2731    pub cd: Option<String>,
2732    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2733    pub prtry: Option<String>,
2734}
2735
2736impl Validate for LocalInstrument2Choice1 {
2737    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2738        if let Some(ref val) = self.cd {
2739            helpers::validate_length(
2740                val,
2741                "Cd",
2742                Some(1),
2743                Some(35),
2744                &helpers::child_path(path, "Cd"),
2745                config,
2746                collector,
2747            );
2748        }
2749        if let Some(ref val) = self.prtry {
2750            helpers::validate_length(
2751                val,
2752                "Prtry",
2753                Some(1),
2754                Some(35),
2755                &helpers::child_path(path, "Prtry"),
2756                config,
2757                collector,
2758            );
2759        }
2760        if let Some(ref val) = self.prtry {
2761            helpers::validate_pattern(
2762                val,
2763                "Prtry",
2764                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2765                &helpers::child_path(path, "Prtry"),
2766                config,
2767                collector,
2768            );
2769        }
2770    }
2771}
2772
2773// MandateRelatedInformation141: Specifies the number of days the direct debit instruction must be tracked.
2774#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2775pub struct MandateRelatedInformation141 {
2776    #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
2777    pub mndt_id: Option<String>,
2778    #[serde(rename = "DtOfSgntr", skip_serializing_if = "Option::is_none")]
2779    pub dt_of_sgntr: Option<String>,
2780    #[serde(rename = "AmdmntInd", skip_serializing_if = "Option::is_none")]
2781    pub amdmnt_ind: Option<bool>,
2782    #[serde(rename = "AmdmntInfDtls", skip_serializing_if = "Option::is_none")]
2783    pub amdmnt_inf_dtls: Option<AmendmentInformationDetails131>,
2784    #[serde(rename = "ElctrncSgntr", skip_serializing_if = "Option::is_none")]
2785    pub elctrnc_sgntr: Option<String>,
2786    #[serde(rename = "FrstColltnDt", skip_serializing_if = "Option::is_none")]
2787    pub frst_colltn_dt: Option<String>,
2788    #[serde(rename = "FnlColltnDt", skip_serializing_if = "Option::is_none")]
2789    pub fnl_colltn_dt: Option<String>,
2790    #[serde(rename = "Frqcy", skip_serializing_if = "Option::is_none")]
2791    pub frqcy: Option<Frequency36Choice>,
2792    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
2793    pub rsn: Option<MandateSetupReason1Choice1>,
2794    #[serde(rename = "TrckgDays", skip_serializing_if = "Option::is_none")]
2795    pub trckg_days: Option<String>,
2796}
2797
2798impl Validate for MandateRelatedInformation141 {
2799    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2800        if let Some(ref val) = self.mndt_id {
2801            helpers::validate_length(
2802                val,
2803                "MndtId",
2804                Some(1),
2805                Some(35),
2806                &helpers::child_path(path, "MndtId"),
2807                config,
2808                collector,
2809            );
2810        }
2811        if let Some(ref val) = self.mndt_id {
2812            helpers::validate_pattern(
2813                val,
2814                "MndtId",
2815                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2816                &helpers::child_path(path, "MndtId"),
2817                config,
2818                collector,
2819            );
2820        }
2821        if let Some(ref val) = self.amdmnt_inf_dtls
2822            && config.validate_optional_fields
2823        {
2824            val.validate(
2825                &helpers::child_path(path, "AmdmntInfDtls"),
2826                config,
2827                collector,
2828            );
2829        }
2830        if let Some(ref val) = self.elctrnc_sgntr {
2831            helpers::validate_length(
2832                val,
2833                "ElctrncSgntr",
2834                Some(1),
2835                Some(1025),
2836                &helpers::child_path(path, "ElctrncSgntr"),
2837                config,
2838                collector,
2839            );
2840        }
2841        if let Some(ref val) = self.frqcy
2842            && config.validate_optional_fields
2843        {
2844            val.validate(&helpers::child_path(path, "Frqcy"), config, collector);
2845        }
2846        if let Some(ref val) = self.rsn
2847            && config.validate_optional_fields
2848        {
2849            val.validate(&helpers::child_path(path, "Rsn"), config, collector);
2850        }
2851        if let Some(ref val) = self.trckg_days {
2852            helpers::validate_pattern(
2853                val,
2854                "TrckgDays",
2855                "[0-9]{2}",
2856                &helpers::child_path(path, "TrckgDays"),
2857                config,
2858                collector,
2859            );
2860        }
2861    }
2862}
2863
2864// MandateSetupReason1Choice1: Reason for the mandate setup, in a proprietary form.
2865#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2866pub struct MandateSetupReason1Choice1 {
2867    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2868    pub cd: Option<String>,
2869    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2870    pub prtry: Option<String>,
2871}
2872
2873impl Validate for MandateSetupReason1Choice1 {
2874    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2875        if let Some(ref val) = self.cd {
2876            helpers::validate_length(
2877                val,
2878                "Cd",
2879                Some(1),
2880                Some(4),
2881                &helpers::child_path(path, "Cd"),
2882                config,
2883                collector,
2884            );
2885        }
2886        if let Some(ref val) = self.prtry {
2887            helpers::validate_length(
2888                val,
2889                "Prtry",
2890                Some(1),
2891                Some(70),
2892                &helpers::child_path(path, "Prtry"),
2893                config,
2894                collector,
2895            );
2896        }
2897        if let Some(ref val) = self.prtry {
2898            helpers::validate_pattern(
2899                val,
2900                "Prtry",
2901                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2902                &helpers::child_path(path, "Prtry"),
2903                config,
2904                collector,
2905            );
2906        }
2907    }
2908}
2909
2910// Max15NumericText_fixed: 1
2911#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2912pub enum Max15NumericTextfixed {
2913    #[default]
2914    #[serde(rename = "1")]
2915    Code1,
2916}
2917
2918impl Validate for Max15NumericTextfixed {
2919    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2920        // Enum validation is typically empty
2921    }
2922}
2923
2924// NameAndAddress161: Postal address of a party.
2925#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2926pub struct NameAndAddress161 {
2927    #[serde(rename = "Nm")]
2928    pub nm: String,
2929    #[serde(rename = "Adr")]
2930    pub adr: PostalAddress241,
2931}
2932
2933impl Validate for NameAndAddress161 {
2934    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2935        helpers::validate_length(
2936            &self.nm,
2937            "Nm",
2938            Some(1),
2939            Some(140),
2940            &helpers::child_path(path, "Nm"),
2941            config,
2942            collector,
2943        );
2944        helpers::validate_pattern(
2945            &self.nm,
2946            "Nm",
2947            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2948            &helpers::child_path(path, "Nm"),
2949            config,
2950            collector,
2951        );
2952        self.adr
2953            .validate(&helpers::child_path(path, "Adr"), config, collector);
2954    }
2955}
2956
2957// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
2958#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2959pub struct OrganisationIdentification291 {
2960    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2961    pub any_bic: Option<String>,
2962    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2963    pub lei: Option<String>,
2964    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2965    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
2966}
2967
2968impl Validate for OrganisationIdentification291 {
2969    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2970        if let Some(ref val) = self.any_bic {
2971            helpers::validate_pattern(
2972                val,
2973                "AnyBIC",
2974                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
2975                &helpers::child_path(path, "AnyBIC"),
2976                config,
2977                collector,
2978            );
2979        }
2980        if let Some(ref val) = self.lei {
2981            helpers::validate_pattern(
2982                val,
2983                "LEI",
2984                "[A-Z0-9]{18,18}[0-9]{2,2}",
2985                &helpers::child_path(path, "LEI"),
2986                config,
2987                collector,
2988            );
2989        }
2990        if let Some(ref vec) = self.othr
2991            && config.validate_optional_fields
2992        {
2993            for item in vec {
2994                item.validate(&helpers::child_path(path, "Othr"), config, collector);
2995            }
2996        }
2997    }
2998}
2999
3000// OrganisationIdentification292: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
3001#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3002pub struct OrganisationIdentification292 {
3003    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
3004    pub any_bic: Option<String>,
3005    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3006    pub lei: Option<String>,
3007    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3008    pub othr: Option<Vec<GenericOrganisationIdentification12>>,
3009}
3010
3011impl Validate for OrganisationIdentification292 {
3012    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3013        if let Some(ref val) = self.any_bic {
3014            helpers::validate_pattern(
3015                val,
3016                "AnyBIC",
3017                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
3018                &helpers::child_path(path, "AnyBIC"),
3019                config,
3020                collector,
3021            );
3022        }
3023        if let Some(ref val) = self.lei {
3024            helpers::validate_pattern(
3025                val,
3026                "LEI",
3027                "[A-Z0-9]{18,18}[0-9]{2,2}",
3028                &helpers::child_path(path, "LEI"),
3029                config,
3030                collector,
3031            );
3032        }
3033        if let Some(ref vec) = self.othr
3034            && config.validate_optional_fields
3035        {
3036            for item in vec {
3037                item.validate(&helpers::child_path(path, "Othr"), config, collector);
3038            }
3039        }
3040    }
3041}
3042
3043// OrganisationIdentification293: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
3044#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3045pub struct OrganisationIdentification293 {
3046    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
3047    pub any_bic: Option<String>,
3048    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3049    pub lei: Option<String>,
3050    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3051    pub othr: Option<Vec<GenericOrganisationIdentification13>>,
3052}
3053
3054impl Validate for OrganisationIdentification293 {
3055    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3056        if let Some(ref val) = self.any_bic {
3057            helpers::validate_pattern(
3058                val,
3059                "AnyBIC",
3060                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
3061                &helpers::child_path(path, "AnyBIC"),
3062                config,
3063                collector,
3064            );
3065        }
3066        if let Some(ref val) = self.lei {
3067            helpers::validate_pattern(
3068                val,
3069                "LEI",
3070                "[A-Z0-9]{18,18}[0-9]{2,2}",
3071                &helpers::child_path(path, "LEI"),
3072                config,
3073                collector,
3074            );
3075        }
3076        if let Some(ref vec) = self.othr
3077            && config.validate_optional_fields
3078        {
3079            for item in vec {
3080                item.validate(&helpers::child_path(path, "Othr"), config, collector);
3081            }
3082        }
3083    }
3084}
3085
3086// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
3087#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3088pub struct OrganisationIdentificationSchemeName1Choice1 {
3089    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3090    pub cd: Option<String>,
3091    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3092    pub prtry: Option<String>,
3093}
3094
3095impl Validate for OrganisationIdentificationSchemeName1Choice1 {
3096    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3097        if let Some(ref val) = self.cd {
3098            helpers::validate_length(
3099                val,
3100                "Cd",
3101                Some(1),
3102                Some(4),
3103                &helpers::child_path(path, "Cd"),
3104                config,
3105                collector,
3106            );
3107        }
3108        if let Some(ref val) = self.prtry {
3109            helpers::validate_length(
3110                val,
3111                "Prtry",
3112                Some(1),
3113                Some(35),
3114                &helpers::child_path(path, "Prtry"),
3115                config,
3116                collector,
3117            );
3118        }
3119        if let Some(ref val) = self.prtry {
3120            helpers::validate_pattern(
3121                val,
3122                "Prtry",
3123                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3124                &helpers::child_path(path, "Prtry"),
3125                config,
3126                collector,
3127            );
3128        }
3129    }
3130}
3131
3132// OrganisationIdentificationSchemeName1Choice2: Name of the identification scheme, in a coded form as published in an external list.
3133#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3134pub struct OrganisationIdentificationSchemeName1Choice2 {
3135    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3136    pub cd: Option<String>,
3137}
3138
3139impl Validate for OrganisationIdentificationSchemeName1Choice2 {
3140    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3141        if let Some(ref val) = self.cd {
3142            helpers::validate_length(
3143                val,
3144                "Cd",
3145                Some(1),
3146                Some(4),
3147                &helpers::child_path(path, "Cd"),
3148                config,
3149                collector,
3150            );
3151        }
3152    }
3153}
3154
3155// OrganisationIdentificationSchemeName1Choice3: Name of the identification scheme, in a free text form.
3156#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3157pub struct OrganisationIdentificationSchemeName1Choice3 {
3158    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3159    pub cd: Option<String>,
3160    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3161    pub prtry: Option<String>,
3162}
3163
3164impl Validate for OrganisationIdentificationSchemeName1Choice3 {
3165    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3166        if let Some(ref val) = self.cd {
3167            helpers::validate_length(
3168                val,
3169                "Cd",
3170                Some(1),
3171                Some(4),
3172                &helpers::child_path(path, "Cd"),
3173                config,
3174                collector,
3175            );
3176        }
3177        if let Some(ref val) = self.prtry {
3178            helpers::validate_length(
3179                val,
3180                "Prtry",
3181                Some(1),
3182                Some(35),
3183                &helpers::child_path(path, "Prtry"),
3184                config,
3185                collector,
3186            );
3187        }
3188        if let Some(ref val) = self.prtry {
3189            helpers::validate_pattern(
3190                val,
3191                "Prtry",
3192                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3193                &helpers::child_path(path, "Prtry"),
3194                config,
3195                collector,
3196            );
3197        }
3198    }
3199}
3200
3201// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
3202#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3203pub struct Party38Choice1 {
3204    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
3205    pub org_id: Option<OrganisationIdentification291>,
3206    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
3207    pub prvt_id: Option<PersonIdentification131>,
3208}
3209
3210impl Validate for Party38Choice1 {
3211    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3212        if let Some(ref val) = self.org_id
3213            && config.validate_optional_fields
3214        {
3215            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
3216        }
3217        if let Some(ref val) = self.prvt_id
3218            && config.validate_optional_fields
3219        {
3220            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
3221        }
3222    }
3223}
3224
3225// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
3226#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3227pub struct Party38Choice2 {
3228    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
3229    pub org_id: Option<OrganisationIdentification291>,
3230    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
3231    pub prvt_id: Option<PersonIdentification132>,
3232}
3233
3234impl Validate for Party38Choice2 {
3235    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3236        if let Some(ref val) = self.org_id
3237            && config.validate_optional_fields
3238        {
3239            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
3240        }
3241        if let Some(ref val) = self.prvt_id
3242            && config.validate_optional_fields
3243        {
3244            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
3245        }
3246    }
3247}
3248
3249// Party38Choice3: Unique and unambiguous identification of a person, for example a passport.
3250#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3251pub struct Party38Choice3 {
3252    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
3253    pub org_id: Option<OrganisationIdentification292>,
3254    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
3255    pub prvt_id: Option<PersonIdentification133>,
3256}
3257
3258impl Validate for Party38Choice3 {
3259    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3260        if let Some(ref val) = self.org_id
3261            && config.validate_optional_fields
3262        {
3263            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
3264        }
3265        if let Some(ref val) = self.prvt_id
3266            && config.validate_optional_fields
3267        {
3268            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
3269        }
3270    }
3271}
3272
3273// Party38Choice4: Unique and unambiguous identification of a person, for example a passport.
3274#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3275pub struct Party38Choice4 {
3276    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
3277    pub org_id: Option<OrganisationIdentification293>,
3278    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
3279    pub prvt_id: Option<PersonIdentification134>,
3280}
3281
3282impl Validate for Party38Choice4 {
3283    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3284        if let Some(ref val) = self.org_id
3285            && config.validate_optional_fields
3286        {
3287            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
3288        }
3289        if let Some(ref val) = self.prvt_id
3290            && config.validate_optional_fields
3291        {
3292            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
3293        }
3294    }
3295}
3296
3297// Party38Choice5: Unique and unambiguous identification of a person, for example a passport.
3298#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3299pub struct Party38Choice5 {
3300    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
3301    pub org_id: Option<OrganisationIdentification293>,
3302    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
3303    pub prvt_id: Option<PersonIdentification135>,
3304}
3305
3306impl Validate for Party38Choice5 {
3307    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3308        if let Some(ref val) = self.org_id
3309            && config.validate_optional_fields
3310        {
3311            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
3312        }
3313        if let Some(ref val) = self.prvt_id
3314            && config.validate_optional_fields
3315        {
3316            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
3317        }
3318    }
3319}
3320
3321// 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.
3322#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3323pub struct PartyIdentification1351 {
3324    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3325    pub nm: Option<String>,
3326    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3327    pub pstl_adr: Option<PostalAddress241>,
3328    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3329    pub id: Option<Party38Choice1>,
3330    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3331    pub ctry_of_res: Option<String>,
3332}
3333
3334impl Validate for PartyIdentification1351 {
3335    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3336        if let Some(ref val) = self.nm {
3337            helpers::validate_length(
3338                val,
3339                "Nm",
3340                Some(1),
3341                Some(140),
3342                &helpers::child_path(path, "Nm"),
3343                config,
3344                collector,
3345            );
3346        }
3347        if let Some(ref val) = self.nm {
3348            helpers::validate_pattern(
3349                val,
3350                "Nm",
3351                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3352                &helpers::child_path(path, "Nm"),
3353                config,
3354                collector,
3355            );
3356        }
3357        if let Some(ref val) = self.pstl_adr
3358            && config.validate_optional_fields
3359        {
3360            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
3361        }
3362        if let Some(ref val) = self.id
3363            && config.validate_optional_fields
3364        {
3365            val.validate(&helpers::child_path(path, "Id"), config, collector);
3366        }
3367        if let Some(ref val) = self.ctry_of_res {
3368            helpers::validate_pattern(
3369                val,
3370                "CtryOfRes",
3371                "[A-Z]{2,2}",
3372                &helpers::child_path(path, "CtryOfRes"),
3373                config,
3374                collector,
3375            );
3376        }
3377    }
3378}
3379
3380// 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.
3381#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3382pub struct PartyIdentification1352 {
3383    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3384    pub nm: Option<String>,
3385    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3386    pub pstl_adr: Option<PostalAddress242>,
3387    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3388    pub id: Option<Party38Choice2>,
3389    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3390    pub ctry_of_res: Option<String>,
3391}
3392
3393impl Validate for PartyIdentification1352 {
3394    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3395        if let Some(ref val) = self.nm {
3396            helpers::validate_length(
3397                val,
3398                "Nm",
3399                Some(1),
3400                Some(140),
3401                &helpers::child_path(path, "Nm"),
3402                config,
3403                collector,
3404            );
3405        }
3406        if let Some(ref val) = self.nm {
3407            helpers::validate_pattern(
3408                val,
3409                "Nm",
3410                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3411                &helpers::child_path(path, "Nm"),
3412                config,
3413                collector,
3414            );
3415        }
3416        if let Some(ref val) = self.pstl_adr
3417            && config.validate_optional_fields
3418        {
3419            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
3420        }
3421        if let Some(ref val) = self.id
3422            && config.validate_optional_fields
3423        {
3424            val.validate(&helpers::child_path(path, "Id"), config, collector);
3425        }
3426        if let Some(ref val) = self.ctry_of_res {
3427            helpers::validate_pattern(
3428                val,
3429                "CtryOfRes",
3430                "[A-Z]{2,2}",
3431                &helpers::child_path(path, "CtryOfRes"),
3432                config,
3433                collector,
3434            );
3435        }
3436    }
3437}
3438
3439// 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.
3440#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3441pub struct PartyIdentification1353 {
3442    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3443    pub nm: Option<String>,
3444    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3445    pub pstl_adr: Option<PostalAddress243>,
3446    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3447    pub id: Option<Party38Choice1>,
3448    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3449    pub ctry_of_res: Option<String>,
3450}
3451
3452impl Validate for PartyIdentification1353 {
3453    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3454        if let Some(ref val) = self.nm {
3455            helpers::validate_length(
3456                val,
3457                "Nm",
3458                Some(1),
3459                Some(140),
3460                &helpers::child_path(path, "Nm"),
3461                config,
3462                collector,
3463            );
3464        }
3465        if let Some(ref val) = self.nm {
3466            helpers::validate_pattern(
3467                val,
3468                "Nm",
3469                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3470                &helpers::child_path(path, "Nm"),
3471                config,
3472                collector,
3473            );
3474        }
3475        if let Some(ref val) = self.pstl_adr
3476            && config.validate_optional_fields
3477        {
3478            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
3479        }
3480        if let Some(ref val) = self.id
3481            && config.validate_optional_fields
3482        {
3483            val.validate(&helpers::child_path(path, "Id"), config, collector);
3484        }
3485        if let Some(ref val) = self.ctry_of_res {
3486            helpers::validate_pattern(
3487                val,
3488                "CtryOfRes",
3489                "[A-Z]{2,2}",
3490                &helpers::child_path(path, "CtryOfRes"),
3491                config,
3492                collector,
3493            );
3494        }
3495    }
3496}
3497
3498// PartyIdentification1354: 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.
3499#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3500pub struct PartyIdentification1354 {
3501    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3502    pub nm: Option<String>,
3503    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3504    pub pstl_adr: Option<PostalAddress241>,
3505    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3506    pub id: Option<Party38Choice3>,
3507    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3508    pub ctry_of_res: Option<String>,
3509}
3510
3511impl Validate for PartyIdentification1354 {
3512    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3513        if let Some(ref val) = self.nm {
3514            helpers::validate_length(
3515                val,
3516                "Nm",
3517                Some(1),
3518                Some(140),
3519                &helpers::child_path(path, "Nm"),
3520                config,
3521                collector,
3522            );
3523        }
3524        if let Some(ref val) = self.nm {
3525            helpers::validate_pattern(
3526                val,
3527                "Nm",
3528                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3529                &helpers::child_path(path, "Nm"),
3530                config,
3531                collector,
3532            );
3533        }
3534        if let Some(ref val) = self.pstl_adr
3535            && config.validate_optional_fields
3536        {
3537            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
3538        }
3539        if let Some(ref val) = self.id
3540            && config.validate_optional_fields
3541        {
3542            val.validate(&helpers::child_path(path, "Id"), config, collector);
3543        }
3544        if let Some(ref val) = self.ctry_of_res {
3545            helpers::validate_pattern(
3546                val,
3547                "CtryOfRes",
3548                "[A-Z]{2,2}",
3549                &helpers::child_path(path, "CtryOfRes"),
3550                config,
3551                collector,
3552            );
3553        }
3554    }
3555}
3556
3557// PartyIdentification1355: 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.
3558#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3559pub struct PartyIdentification1355 {
3560    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3561    pub nm: Option<String>,
3562    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3563    pub pstl_adr: Option<PostalAddress243>,
3564    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3565    pub id: Option<Party38Choice4>,
3566    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3567    pub ctry_of_res: Option<String>,
3568}
3569
3570impl Validate for PartyIdentification1355 {
3571    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3572        if let Some(ref val) = self.nm {
3573            helpers::validate_length(
3574                val,
3575                "Nm",
3576                Some(1),
3577                Some(140),
3578                &helpers::child_path(path, "Nm"),
3579                config,
3580                collector,
3581            );
3582        }
3583        if let Some(ref val) = self.nm {
3584            helpers::validate_pattern(
3585                val,
3586                "Nm",
3587                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3588                &helpers::child_path(path, "Nm"),
3589                config,
3590                collector,
3591            );
3592        }
3593        if let Some(ref val) = self.pstl_adr
3594            && config.validate_optional_fields
3595        {
3596            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
3597        }
3598        if let Some(ref val) = self.id
3599            && config.validate_optional_fields
3600        {
3601            val.validate(&helpers::child_path(path, "Id"), config, collector);
3602        }
3603        if let Some(ref val) = self.ctry_of_res {
3604            helpers::validate_pattern(
3605                val,
3606                "CtryOfRes",
3607                "[A-Z]{2,2}",
3608                &helpers::child_path(path, "CtryOfRes"),
3609                config,
3610                collector,
3611            );
3612        }
3613    }
3614}
3615
3616// PartyIdentification1356: 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.
3617#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3618pub struct PartyIdentification1356 {
3619    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3620    pub nm: Option<String>,
3621    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3622    pub pstl_adr: Option<PostalAddress245>,
3623    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3624    pub id: Option<Party38Choice5>,
3625    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3626    pub ctry_of_res: Option<String>,
3627}
3628
3629impl Validate for PartyIdentification1356 {
3630    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3631        if let Some(ref val) = self.nm {
3632            helpers::validate_length(
3633                val,
3634                "Nm",
3635                Some(1),
3636                Some(140),
3637                &helpers::child_path(path, "Nm"),
3638                config,
3639                collector,
3640            );
3641        }
3642        if let Some(ref val) = self.nm {
3643            helpers::validate_pattern(
3644                val,
3645                "Nm",
3646                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3647                &helpers::child_path(path, "Nm"),
3648                config,
3649                collector,
3650            );
3651        }
3652        if let Some(ref val) = self.pstl_adr
3653            && config.validate_optional_fields
3654        {
3655            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
3656        }
3657        if let Some(ref val) = self.id
3658            && config.validate_optional_fields
3659        {
3660            val.validate(&helpers::child_path(path, "Id"), config, collector);
3661        }
3662        if let Some(ref val) = self.ctry_of_res {
3663            helpers::validate_pattern(
3664                val,
3665                "CtryOfRes",
3666                "[A-Z]{2,2}",
3667                &helpers::child_path(path, "CtryOfRes"),
3668                config,
3669                collector,
3670            );
3671        }
3672    }
3673}
3674
3675// PartyIdentification1357: 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.
3676#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3677pub struct PartyIdentification1357 {
3678    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3679    pub nm: Option<String>,
3680    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3681    pub pstl_adr: Option<PostalAddress245>,
3682    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3683    pub id: Option<Party38Choice4>,
3684    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3685    pub ctry_of_res: Option<String>,
3686}
3687
3688impl Validate for PartyIdentification1357 {
3689    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3690        if let Some(ref val) = self.nm {
3691            helpers::validate_length(
3692                val,
3693                "Nm",
3694                Some(1),
3695                Some(140),
3696                &helpers::child_path(path, "Nm"),
3697                config,
3698                collector,
3699            );
3700        }
3701        if let Some(ref val) = self.nm {
3702            helpers::validate_pattern(
3703                val,
3704                "Nm",
3705                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3706                &helpers::child_path(path, "Nm"),
3707                config,
3708                collector,
3709            );
3710        }
3711        if let Some(ref val) = self.pstl_adr
3712            && config.validate_optional_fields
3713        {
3714            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
3715        }
3716        if let Some(ref val) = self.id
3717            && config.validate_optional_fields
3718        {
3719            val.validate(&helpers::child_path(path, "Id"), config, collector);
3720        }
3721        if let Some(ref val) = self.ctry_of_res {
3722            helpers::validate_pattern(
3723                val,
3724                "CtryOfRes",
3725                "[A-Z]{2,2}",
3726                &helpers::child_path(path, "CtryOfRes"),
3727                config,
3728                collector,
3729            );
3730        }
3731    }
3732}
3733
3734// PaymentIdentification71: Unique reference, as assigned by a clearing system, to unambiguously identify the instruction.
3735#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3736pub struct PaymentIdentification71 {
3737    #[serde(rename = "InstrId")]
3738    pub instr_id: String,
3739    #[serde(rename = "EndToEndId")]
3740    pub end_to_end_id: String,
3741    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
3742    pub tx_id: Option<String>,
3743    #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
3744    pub uetr: Option<String>,
3745    #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
3746    pub clr_sys_ref: Option<String>,
3747}
3748
3749impl Validate for PaymentIdentification71 {
3750    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3751        helpers::validate_length(
3752            &self.instr_id,
3753            "InstrId",
3754            Some(1),
3755            Some(16),
3756            &helpers::child_path(path, "InstrId"),
3757            config,
3758            collector,
3759        );
3760        helpers::validate_pattern(
3761            &self.instr_id,
3762            "InstrId",
3763            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3764            &helpers::child_path(path, "InstrId"),
3765            config,
3766            collector,
3767        );
3768        helpers::validate_length(
3769            &self.end_to_end_id,
3770            "EndToEndId",
3771            Some(1),
3772            Some(35),
3773            &helpers::child_path(path, "EndToEndId"),
3774            config,
3775            collector,
3776        );
3777        helpers::validate_pattern(
3778            &self.end_to_end_id,
3779            "EndToEndId",
3780            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3781            &helpers::child_path(path, "EndToEndId"),
3782            config,
3783            collector,
3784        );
3785        if let Some(ref val) = self.tx_id {
3786            helpers::validate_length(
3787                val,
3788                "TxId",
3789                Some(1),
3790                Some(35),
3791                &helpers::child_path(path, "TxId"),
3792                config,
3793                collector,
3794            );
3795        }
3796        if let Some(ref val) = self.tx_id {
3797            helpers::validate_pattern(
3798                val,
3799                "TxId",
3800                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3801                &helpers::child_path(path, "TxId"),
3802                config,
3803                collector,
3804            );
3805        }
3806        if let Some(ref val) = self.uetr {
3807            helpers::validate_pattern(
3808                val,
3809                "UETR",
3810                "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
3811                &helpers::child_path(path, "UETR"),
3812                config,
3813                collector,
3814            );
3815        }
3816        if let Some(ref val) = self.clr_sys_ref {
3817            helpers::validate_length(
3818                val,
3819                "ClrSysRef",
3820                Some(1),
3821                Some(35),
3822                &helpers::child_path(path, "ClrSysRef"),
3823                config,
3824                collector,
3825            );
3826        }
3827        if let Some(ref val) = self.clr_sys_ref {
3828            helpers::validate_pattern(
3829                val,
3830                "ClrSysRef",
3831                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3832                &helpers::child_path(path, "ClrSysRef"),
3833                config,
3834                collector,
3835            );
3836        }
3837    }
3838}
3839
3840// PaymentTypeInformation271: Specifies the high level purpose of the instruction based on a set of pre-defined categories.
3841// Usage: This is used by the initiating party to provide information concerning the processing of the payment. It is likely to trigger special processing by any of the agents involved in the payment chain.
3842#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3843pub struct PaymentTypeInformation271 {
3844    #[serde(rename = "InstrPrty", skip_serializing_if = "Option::is_none")]
3845    pub instr_prty: Option<Priority2Code>,
3846    #[serde(rename = "ClrChanl", skip_serializing_if = "Option::is_none")]
3847    pub clr_chanl: Option<ClearingChannel2Code>,
3848    #[serde(rename = "SvcLvl", skip_serializing_if = "Option::is_none")]
3849    pub svc_lvl: Option<Vec<ServiceLevel8Choice1>>,
3850    #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3851    pub lcl_instrm: Option<LocalInstrument2Choice1>,
3852    #[serde(rename = "SeqTp", skip_serializing_if = "Option::is_none")]
3853    pub seq_tp: Option<SequenceType3Code>,
3854    #[serde(rename = "CtgyPurp", skip_serializing_if = "Option::is_none")]
3855    pub ctgy_purp: Option<CategoryPurpose1Choice1>,
3856}
3857
3858impl Validate for PaymentTypeInformation271 {
3859    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3860        if let Some(ref val) = self.instr_prty
3861            && config.validate_optional_fields
3862        {
3863            val.validate(&helpers::child_path(path, "InstrPrty"), config, collector);
3864        }
3865        if let Some(ref val) = self.clr_chanl
3866            && config.validate_optional_fields
3867        {
3868            val.validate(&helpers::child_path(path, "ClrChanl"), config, collector);
3869        }
3870        if let Some(ref vec) = self.svc_lvl
3871            && config.validate_optional_fields
3872        {
3873            for item in vec {
3874                item.validate(&helpers::child_path(path, "SvcLvl"), config, collector);
3875            }
3876        }
3877        if let Some(ref val) = self.lcl_instrm
3878            && config.validate_optional_fields
3879        {
3880            val.validate(&helpers::child_path(path, "LclInstrm"), config, collector);
3881        }
3882        if let Some(ref val) = self.seq_tp
3883            && config.validate_optional_fields
3884        {
3885            val.validate(&helpers::child_path(path, "SeqTp"), config, collector);
3886        }
3887        if let Some(ref val) = self.ctgy_purp
3888            && config.validate_optional_fields
3889        {
3890            val.validate(&helpers::child_path(path, "CtgyPurp"), config, collector);
3891        }
3892    }
3893}
3894
3895// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
3896#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3897pub struct PersonIdentification131 {
3898    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3899    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
3900    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3901    pub othr: Option<Vec<GenericPersonIdentification11>>,
3902}
3903
3904impl Validate for PersonIdentification131 {
3905    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3906        if let Some(ref val) = self.dt_and_plc_of_birth
3907            && config.validate_optional_fields
3908        {
3909            val.validate(
3910                &helpers::child_path(path, "DtAndPlcOfBirth"),
3911                config,
3912                collector,
3913            );
3914        }
3915        if let Some(ref vec) = self.othr
3916            && config.validate_optional_fields
3917        {
3918            for item in vec {
3919                item.validate(&helpers::child_path(path, "Othr"), config, collector);
3920            }
3921        }
3922    }
3923}
3924
3925// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
3926#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3927pub struct PersonIdentification132 {
3928    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3929    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
3930    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3931    pub othr: Option<Vec<GenericPersonIdentification11>>,
3932}
3933
3934impl Validate for PersonIdentification132 {
3935    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3936        if let Some(ref val) = self.dt_and_plc_of_birth
3937            && config.validate_optional_fields
3938        {
3939            val.validate(
3940                &helpers::child_path(path, "DtAndPlcOfBirth"),
3941                config,
3942                collector,
3943            );
3944        }
3945        if let Some(ref vec) = self.othr
3946            && config.validate_optional_fields
3947        {
3948            for item in vec {
3949                item.validate(&helpers::child_path(path, "Othr"), config, collector);
3950            }
3951        }
3952    }
3953}
3954
3955// PersonIdentification133: Unique identification of a person, as assigned by an institution, using an identification scheme.
3956#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3957pub struct PersonIdentification133 {
3958    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3959    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
3960    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3961    pub othr: Option<Vec<GenericPersonIdentification12>>,
3962}
3963
3964impl Validate for PersonIdentification133 {
3965    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3966        if let Some(ref val) = self.dt_and_plc_of_birth
3967            && config.validate_optional_fields
3968        {
3969            val.validate(
3970                &helpers::child_path(path, "DtAndPlcOfBirth"),
3971                config,
3972                collector,
3973            );
3974        }
3975        if let Some(ref vec) = self.othr
3976            && config.validate_optional_fields
3977        {
3978            for item in vec {
3979                item.validate(&helpers::child_path(path, "Othr"), config, collector);
3980            }
3981        }
3982    }
3983}
3984
3985// PersonIdentification134: Unique identification of a person, as assigned by an institution, using an identification scheme.
3986#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3987pub struct PersonIdentification134 {
3988    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3989    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
3990    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3991    pub othr: Option<Vec<GenericPersonIdentification13>>,
3992}
3993
3994impl Validate for PersonIdentification134 {
3995    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3996        if let Some(ref val) = self.dt_and_plc_of_birth
3997            && config.validate_optional_fields
3998        {
3999            val.validate(
4000                &helpers::child_path(path, "DtAndPlcOfBirth"),
4001                config,
4002                collector,
4003            );
4004        }
4005        if let Some(ref vec) = self.othr
4006            && config.validate_optional_fields
4007        {
4008            for item in vec {
4009                item.validate(&helpers::child_path(path, "Othr"), config, collector);
4010            }
4011        }
4012    }
4013}
4014
4015// PersonIdentification135: Unique identification of a person, as assigned by an institution, using an identification scheme.
4016#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4017pub struct PersonIdentification135 {
4018    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
4019    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
4020    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4021    pub othr: Option<Vec<GenericPersonIdentification13>>,
4022}
4023
4024impl Validate for PersonIdentification135 {
4025    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4026        if let Some(ref val) = self.dt_and_plc_of_birth
4027            && config.validate_optional_fields
4028        {
4029            val.validate(
4030                &helpers::child_path(path, "DtAndPlcOfBirth"),
4031                config,
4032                collector,
4033            );
4034        }
4035        if let Some(ref vec) = self.othr
4036            && config.validate_optional_fields
4037        {
4038            for item in vec {
4039                item.validate(&helpers::child_path(path, "Othr"), config, collector);
4040            }
4041        }
4042    }
4043}
4044
4045// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
4046#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4047pub struct PersonIdentificationSchemeName1Choice1 {
4048    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4049    pub cd: Option<String>,
4050    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4051    pub prtry: Option<String>,
4052}
4053
4054impl Validate for PersonIdentificationSchemeName1Choice1 {
4055    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4056        if let Some(ref val) = self.cd {
4057            helpers::validate_length(
4058                val,
4059                "Cd",
4060                Some(1),
4061                Some(4),
4062                &helpers::child_path(path, "Cd"),
4063                config,
4064                collector,
4065            );
4066        }
4067        if let Some(ref val) = self.prtry {
4068            helpers::validate_length(
4069                val,
4070                "Prtry",
4071                Some(1),
4072                Some(35),
4073                &helpers::child_path(path, "Prtry"),
4074                config,
4075                collector,
4076            );
4077        }
4078        if let Some(ref val) = self.prtry {
4079            helpers::validate_pattern(
4080                val,
4081                "Prtry",
4082                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4083                &helpers::child_path(path, "Prtry"),
4084                config,
4085                collector,
4086            );
4087        }
4088    }
4089}
4090
4091// PersonIdentificationSchemeName1Choice2: Name of the identification scheme, in a coded form as published in an external list.
4092#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4093pub struct PersonIdentificationSchemeName1Choice2 {
4094    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4095    pub cd: Option<String>,
4096}
4097
4098impl Validate for PersonIdentificationSchemeName1Choice2 {
4099    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4100        if let Some(ref val) = self.cd {
4101            helpers::validate_length(
4102                val,
4103                "Cd",
4104                Some(1),
4105                Some(4),
4106                &helpers::child_path(path, "Cd"),
4107                config,
4108                collector,
4109            );
4110        }
4111    }
4112}
4113
4114// PersonIdentificationSchemeName1Choice3: Name of the identification scheme, in a free text form.
4115#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4116pub struct PersonIdentificationSchemeName1Choice3 {
4117    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4118    pub cd: Option<String>,
4119    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4120    pub prtry: Option<String>,
4121}
4122
4123impl Validate for PersonIdentificationSchemeName1Choice3 {
4124    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4125        if let Some(ref val) = self.cd {
4126            helpers::validate_length(
4127                val,
4128                "Cd",
4129                Some(1),
4130                Some(4),
4131                &helpers::child_path(path, "Cd"),
4132                config,
4133                collector,
4134            );
4135        }
4136        if let Some(ref val) = self.prtry {
4137            helpers::validate_length(
4138                val,
4139                "Prtry",
4140                Some(1),
4141                Some(35),
4142                &helpers::child_path(path, "Prtry"),
4143                config,
4144                collector,
4145            );
4146        }
4147        if let Some(ref val) = self.prtry {
4148            helpers::validate_pattern(
4149                val,
4150                "Prtry",
4151                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4152                &helpers::child_path(path, "Prtry"),
4153                config,
4154                collector,
4155            );
4156        }
4157    }
4158}
4159
4160// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
4161#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4162pub struct PostalAddress241 {
4163    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
4164    pub dept: Option<String>,
4165    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
4166    pub sub_dept: Option<String>,
4167    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
4168    pub strt_nm: Option<String>,
4169    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
4170    pub bldg_nb: Option<String>,
4171    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
4172    pub bldg_nm: Option<String>,
4173    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
4174    pub flr: Option<String>,
4175    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
4176    pub pst_bx: Option<String>,
4177    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
4178    pub room: Option<String>,
4179    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
4180    pub pst_cd: Option<String>,
4181    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
4182    pub twn_nm: Option<String>,
4183    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
4184    pub twn_lctn_nm: Option<String>,
4185    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
4186    pub dstrct_nm: Option<String>,
4187    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
4188    pub ctry_sub_dvsn: Option<String>,
4189    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
4190    pub ctry: Option<String>,
4191    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
4192    pub adr_line: Option<Vec<String>>,
4193}
4194
4195impl Validate for PostalAddress241 {
4196    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4197        if let Some(ref val) = self.dept {
4198            helpers::validate_length(
4199                val,
4200                "Dept",
4201                Some(1),
4202                Some(70),
4203                &helpers::child_path(path, "Dept"),
4204                config,
4205                collector,
4206            );
4207        }
4208        if let Some(ref val) = self.dept {
4209            helpers::validate_pattern(
4210                val,
4211                "Dept",
4212                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4213                &helpers::child_path(path, "Dept"),
4214                config,
4215                collector,
4216            );
4217        }
4218        if let Some(ref val) = self.sub_dept {
4219            helpers::validate_length(
4220                val,
4221                "SubDept",
4222                Some(1),
4223                Some(70),
4224                &helpers::child_path(path, "SubDept"),
4225                config,
4226                collector,
4227            );
4228        }
4229        if let Some(ref val) = self.sub_dept {
4230            helpers::validate_pattern(
4231                val,
4232                "SubDept",
4233                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4234                &helpers::child_path(path, "SubDept"),
4235                config,
4236                collector,
4237            );
4238        }
4239        if let Some(ref val) = self.strt_nm {
4240            helpers::validate_length(
4241                val,
4242                "StrtNm",
4243                Some(1),
4244                Some(70),
4245                &helpers::child_path(path, "StrtNm"),
4246                config,
4247                collector,
4248            );
4249        }
4250        if let Some(ref val) = self.strt_nm {
4251            helpers::validate_pattern(
4252                val,
4253                "StrtNm",
4254                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4255                &helpers::child_path(path, "StrtNm"),
4256                config,
4257                collector,
4258            );
4259        }
4260        if let Some(ref val) = self.bldg_nb {
4261            helpers::validate_length(
4262                val,
4263                "BldgNb",
4264                Some(1),
4265                Some(16),
4266                &helpers::child_path(path, "BldgNb"),
4267                config,
4268                collector,
4269            );
4270        }
4271        if let Some(ref val) = self.bldg_nb {
4272            helpers::validate_pattern(
4273                val,
4274                "BldgNb",
4275                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4276                &helpers::child_path(path, "BldgNb"),
4277                config,
4278                collector,
4279            );
4280        }
4281        if let Some(ref val) = self.bldg_nm {
4282            helpers::validate_length(
4283                val,
4284                "BldgNm",
4285                Some(1),
4286                Some(35),
4287                &helpers::child_path(path, "BldgNm"),
4288                config,
4289                collector,
4290            );
4291        }
4292        if let Some(ref val) = self.bldg_nm {
4293            helpers::validate_pattern(
4294                val,
4295                "BldgNm",
4296                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4297                &helpers::child_path(path, "BldgNm"),
4298                config,
4299                collector,
4300            );
4301        }
4302        if let Some(ref val) = self.flr {
4303            helpers::validate_length(
4304                val,
4305                "Flr",
4306                Some(1),
4307                Some(70),
4308                &helpers::child_path(path, "Flr"),
4309                config,
4310                collector,
4311            );
4312        }
4313        if let Some(ref val) = self.flr {
4314            helpers::validate_pattern(
4315                val,
4316                "Flr",
4317                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4318                &helpers::child_path(path, "Flr"),
4319                config,
4320                collector,
4321            );
4322        }
4323        if let Some(ref val) = self.pst_bx {
4324            helpers::validate_length(
4325                val,
4326                "PstBx",
4327                Some(1),
4328                Some(16),
4329                &helpers::child_path(path, "PstBx"),
4330                config,
4331                collector,
4332            );
4333        }
4334        if let Some(ref val) = self.pst_bx {
4335            helpers::validate_pattern(
4336                val,
4337                "PstBx",
4338                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4339                &helpers::child_path(path, "PstBx"),
4340                config,
4341                collector,
4342            );
4343        }
4344        if let Some(ref val) = self.room {
4345            helpers::validate_length(
4346                val,
4347                "Room",
4348                Some(1),
4349                Some(70),
4350                &helpers::child_path(path, "Room"),
4351                config,
4352                collector,
4353            );
4354        }
4355        if let Some(ref val) = self.room {
4356            helpers::validate_pattern(
4357                val,
4358                "Room",
4359                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4360                &helpers::child_path(path, "Room"),
4361                config,
4362                collector,
4363            );
4364        }
4365        if let Some(ref val) = self.pst_cd {
4366            helpers::validate_length(
4367                val,
4368                "PstCd",
4369                Some(1),
4370                Some(16),
4371                &helpers::child_path(path, "PstCd"),
4372                config,
4373                collector,
4374            );
4375        }
4376        if let Some(ref val) = self.pst_cd {
4377            helpers::validate_pattern(
4378                val,
4379                "PstCd",
4380                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4381                &helpers::child_path(path, "PstCd"),
4382                config,
4383                collector,
4384            );
4385        }
4386        if let Some(ref val) = self.twn_nm {
4387            helpers::validate_length(
4388                val,
4389                "TwnNm",
4390                Some(1),
4391                Some(35),
4392                &helpers::child_path(path, "TwnNm"),
4393                config,
4394                collector,
4395            );
4396        }
4397        if let Some(ref val) = self.twn_nm {
4398            helpers::validate_pattern(
4399                val,
4400                "TwnNm",
4401                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4402                &helpers::child_path(path, "TwnNm"),
4403                config,
4404                collector,
4405            );
4406        }
4407        if let Some(ref val) = self.twn_lctn_nm {
4408            helpers::validate_length(
4409                val,
4410                "TwnLctnNm",
4411                Some(1),
4412                Some(35),
4413                &helpers::child_path(path, "TwnLctnNm"),
4414                config,
4415                collector,
4416            );
4417        }
4418        if let Some(ref val) = self.twn_lctn_nm {
4419            helpers::validate_pattern(
4420                val,
4421                "TwnLctnNm",
4422                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4423                &helpers::child_path(path, "TwnLctnNm"),
4424                config,
4425                collector,
4426            );
4427        }
4428        if let Some(ref val) = self.dstrct_nm {
4429            helpers::validate_length(
4430                val,
4431                "DstrctNm",
4432                Some(1),
4433                Some(35),
4434                &helpers::child_path(path, "DstrctNm"),
4435                config,
4436                collector,
4437            );
4438        }
4439        if let Some(ref val) = self.dstrct_nm {
4440            helpers::validate_pattern(
4441                val,
4442                "DstrctNm",
4443                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4444                &helpers::child_path(path, "DstrctNm"),
4445                config,
4446                collector,
4447            );
4448        }
4449        if let Some(ref val) = self.ctry_sub_dvsn {
4450            helpers::validate_length(
4451                val,
4452                "CtrySubDvsn",
4453                Some(1),
4454                Some(35),
4455                &helpers::child_path(path, "CtrySubDvsn"),
4456                config,
4457                collector,
4458            );
4459        }
4460        if let Some(ref val) = self.ctry_sub_dvsn {
4461            helpers::validate_pattern(
4462                val,
4463                "CtrySubDvsn",
4464                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4465                &helpers::child_path(path, "CtrySubDvsn"),
4466                config,
4467                collector,
4468            );
4469        }
4470        if let Some(ref val) = self.ctry {
4471            helpers::validate_pattern(
4472                val,
4473                "Ctry",
4474                "[A-Z]{2,2}",
4475                &helpers::child_path(path, "Ctry"),
4476                config,
4477                collector,
4478            );
4479        }
4480        if let Some(ref vec) = self.adr_line {
4481            for item in vec {
4482                helpers::validate_length(
4483                    item,
4484                    "AdrLine",
4485                    Some(1),
4486                    Some(70),
4487                    &helpers::child_path(path, "AdrLine"),
4488                    config,
4489                    collector,
4490                );
4491            }
4492        }
4493        if let Some(ref vec) = self.adr_line {
4494            for item in vec {
4495                helpers::validate_pattern(
4496                    item,
4497                    "AdrLine",
4498                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4499                    &helpers::child_path(path, "AdrLine"),
4500                    config,
4501                    collector,
4502                );
4503            }
4504        }
4505    }
4506}
4507
4508// PostalAddress242: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
4509#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4510pub struct PostalAddress242 {
4511    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
4512    pub dept: Option<String>,
4513    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
4514    pub sub_dept: Option<String>,
4515    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
4516    pub strt_nm: Option<String>,
4517    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
4518    pub bldg_nb: Option<String>,
4519    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
4520    pub bldg_nm: Option<String>,
4521    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
4522    pub flr: Option<String>,
4523    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
4524    pub pst_bx: Option<String>,
4525    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
4526    pub room: Option<String>,
4527    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
4528    pub pst_cd: Option<String>,
4529    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
4530    pub twn_nm: Option<String>,
4531    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
4532    pub twn_lctn_nm: Option<String>,
4533    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
4534    pub dstrct_nm: Option<String>,
4535    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
4536    pub ctry_sub_dvsn: Option<String>,
4537    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
4538    pub ctry: Option<String>,
4539    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
4540    pub adr_line: Option<Vec<String>>,
4541}
4542
4543impl Validate for PostalAddress242 {
4544    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4545        if let Some(ref val) = self.dept {
4546            helpers::validate_length(
4547                val,
4548                "Dept",
4549                Some(1),
4550                Some(70),
4551                &helpers::child_path(path, "Dept"),
4552                config,
4553                collector,
4554            );
4555        }
4556        if let Some(ref val) = self.sub_dept {
4557            helpers::validate_length(
4558                val,
4559                "SubDept",
4560                Some(1),
4561                Some(70),
4562                &helpers::child_path(path, "SubDept"),
4563                config,
4564                collector,
4565            );
4566        }
4567        if let Some(ref val) = self.strt_nm {
4568            helpers::validate_length(
4569                val,
4570                "StrtNm",
4571                Some(1),
4572                Some(70),
4573                &helpers::child_path(path, "StrtNm"),
4574                config,
4575                collector,
4576            );
4577        }
4578        if let Some(ref val) = self.bldg_nb {
4579            helpers::validate_length(
4580                val,
4581                "BldgNb",
4582                Some(1),
4583                Some(16),
4584                &helpers::child_path(path, "BldgNb"),
4585                config,
4586                collector,
4587            );
4588        }
4589        if let Some(ref val) = self.bldg_nm {
4590            helpers::validate_length(
4591                val,
4592                "BldgNm",
4593                Some(1),
4594                Some(35),
4595                &helpers::child_path(path, "BldgNm"),
4596                config,
4597                collector,
4598            );
4599        }
4600        if let Some(ref val) = self.flr {
4601            helpers::validate_length(
4602                val,
4603                "Flr",
4604                Some(1),
4605                Some(70),
4606                &helpers::child_path(path, "Flr"),
4607                config,
4608                collector,
4609            );
4610        }
4611        if let Some(ref val) = self.pst_bx {
4612            helpers::validate_length(
4613                val,
4614                "PstBx",
4615                Some(1),
4616                Some(16),
4617                &helpers::child_path(path, "PstBx"),
4618                config,
4619                collector,
4620            );
4621        }
4622        if let Some(ref val) = self.room {
4623            helpers::validate_length(
4624                val,
4625                "Room",
4626                Some(1),
4627                Some(70),
4628                &helpers::child_path(path, "Room"),
4629                config,
4630                collector,
4631            );
4632        }
4633        if let Some(ref val) = self.pst_cd {
4634            helpers::validate_length(
4635                val,
4636                "PstCd",
4637                Some(1),
4638                Some(16),
4639                &helpers::child_path(path, "PstCd"),
4640                config,
4641                collector,
4642            );
4643        }
4644        if let Some(ref val) = self.twn_nm {
4645            helpers::validate_length(
4646                val,
4647                "TwnNm",
4648                Some(1),
4649                Some(35),
4650                &helpers::child_path(path, "TwnNm"),
4651                config,
4652                collector,
4653            );
4654        }
4655        if let Some(ref val) = self.twn_lctn_nm {
4656            helpers::validate_length(
4657                val,
4658                "TwnLctnNm",
4659                Some(1),
4660                Some(35),
4661                &helpers::child_path(path, "TwnLctnNm"),
4662                config,
4663                collector,
4664            );
4665        }
4666        if let Some(ref val) = self.dstrct_nm {
4667            helpers::validate_length(
4668                val,
4669                "DstrctNm",
4670                Some(1),
4671                Some(35),
4672                &helpers::child_path(path, "DstrctNm"),
4673                config,
4674                collector,
4675            );
4676        }
4677        if let Some(ref val) = self.ctry_sub_dvsn {
4678            helpers::validate_length(
4679                val,
4680                "CtrySubDvsn",
4681                Some(1),
4682                Some(35),
4683                &helpers::child_path(path, "CtrySubDvsn"),
4684                config,
4685                collector,
4686            );
4687        }
4688        if let Some(ref val) = self.ctry {
4689            helpers::validate_pattern(
4690                val,
4691                "Ctry",
4692                "[A-Z]{2,2}",
4693                &helpers::child_path(path, "Ctry"),
4694                config,
4695                collector,
4696            );
4697        }
4698        if let Some(ref vec) = self.adr_line {
4699            for item in vec {
4700                helpers::validate_length(
4701                    item,
4702                    "AdrLine",
4703                    Some(1),
4704                    Some(70),
4705                    &helpers::child_path(path, "AdrLine"),
4706                    config,
4707                    collector,
4708                );
4709            }
4710        }
4711    }
4712}
4713
4714// PostalAddress243: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
4715#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4716pub struct PostalAddress243 {
4717    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
4718    pub dept: Option<String>,
4719    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
4720    pub sub_dept: Option<String>,
4721    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
4722    pub strt_nm: Option<String>,
4723    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
4724    pub bldg_nb: Option<String>,
4725    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
4726    pub bldg_nm: Option<String>,
4727    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
4728    pub flr: Option<String>,
4729    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
4730    pub pst_bx: Option<String>,
4731    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
4732    pub room: Option<String>,
4733    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
4734    pub pst_cd: Option<String>,
4735    #[serde(rename = "TwnNm")]
4736    pub twn_nm: String,
4737    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
4738    pub twn_lctn_nm: Option<String>,
4739    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
4740    pub dstrct_nm: Option<String>,
4741    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
4742    pub ctry_sub_dvsn: Option<String>,
4743    #[serde(rename = "Ctry")]
4744    pub ctry: String,
4745    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
4746    pub adr_line: Option<Vec<String>>,
4747}
4748
4749impl Validate for PostalAddress243 {
4750    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4751        if let Some(ref val) = self.dept {
4752            helpers::validate_length(
4753                val,
4754                "Dept",
4755                Some(1),
4756                Some(70),
4757                &helpers::child_path(path, "Dept"),
4758                config,
4759                collector,
4760            );
4761        }
4762        if let Some(ref val) = self.dept {
4763            helpers::validate_pattern(
4764                val,
4765                "Dept",
4766                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4767                &helpers::child_path(path, "Dept"),
4768                config,
4769                collector,
4770            );
4771        }
4772        if let Some(ref val) = self.sub_dept {
4773            helpers::validate_length(
4774                val,
4775                "SubDept",
4776                Some(1),
4777                Some(70),
4778                &helpers::child_path(path, "SubDept"),
4779                config,
4780                collector,
4781            );
4782        }
4783        if let Some(ref val) = self.sub_dept {
4784            helpers::validate_pattern(
4785                val,
4786                "SubDept",
4787                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4788                &helpers::child_path(path, "SubDept"),
4789                config,
4790                collector,
4791            );
4792        }
4793        if let Some(ref val) = self.strt_nm {
4794            helpers::validate_length(
4795                val,
4796                "StrtNm",
4797                Some(1),
4798                Some(70),
4799                &helpers::child_path(path, "StrtNm"),
4800                config,
4801                collector,
4802            );
4803        }
4804        if let Some(ref val) = self.strt_nm {
4805            helpers::validate_pattern(
4806                val,
4807                "StrtNm",
4808                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4809                &helpers::child_path(path, "StrtNm"),
4810                config,
4811                collector,
4812            );
4813        }
4814        if let Some(ref val) = self.bldg_nb {
4815            helpers::validate_length(
4816                val,
4817                "BldgNb",
4818                Some(1),
4819                Some(16),
4820                &helpers::child_path(path, "BldgNb"),
4821                config,
4822                collector,
4823            );
4824        }
4825        if let Some(ref val) = self.bldg_nb {
4826            helpers::validate_pattern(
4827                val,
4828                "BldgNb",
4829                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4830                &helpers::child_path(path, "BldgNb"),
4831                config,
4832                collector,
4833            );
4834        }
4835        if let Some(ref val) = self.bldg_nm {
4836            helpers::validate_length(
4837                val,
4838                "BldgNm",
4839                Some(1),
4840                Some(35),
4841                &helpers::child_path(path, "BldgNm"),
4842                config,
4843                collector,
4844            );
4845        }
4846        if let Some(ref val) = self.bldg_nm {
4847            helpers::validate_pattern(
4848                val,
4849                "BldgNm",
4850                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4851                &helpers::child_path(path, "BldgNm"),
4852                config,
4853                collector,
4854            );
4855        }
4856        if let Some(ref val) = self.flr {
4857            helpers::validate_length(
4858                val,
4859                "Flr",
4860                Some(1),
4861                Some(70),
4862                &helpers::child_path(path, "Flr"),
4863                config,
4864                collector,
4865            );
4866        }
4867        if let Some(ref val) = self.flr {
4868            helpers::validate_pattern(
4869                val,
4870                "Flr",
4871                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4872                &helpers::child_path(path, "Flr"),
4873                config,
4874                collector,
4875            );
4876        }
4877        if let Some(ref val) = self.pst_bx {
4878            helpers::validate_length(
4879                val,
4880                "PstBx",
4881                Some(1),
4882                Some(16),
4883                &helpers::child_path(path, "PstBx"),
4884                config,
4885                collector,
4886            );
4887        }
4888        if let Some(ref val) = self.pst_bx {
4889            helpers::validate_pattern(
4890                val,
4891                "PstBx",
4892                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4893                &helpers::child_path(path, "PstBx"),
4894                config,
4895                collector,
4896            );
4897        }
4898        if let Some(ref val) = self.room {
4899            helpers::validate_length(
4900                val,
4901                "Room",
4902                Some(1),
4903                Some(70),
4904                &helpers::child_path(path, "Room"),
4905                config,
4906                collector,
4907            );
4908        }
4909        if let Some(ref val) = self.room {
4910            helpers::validate_pattern(
4911                val,
4912                "Room",
4913                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4914                &helpers::child_path(path, "Room"),
4915                config,
4916                collector,
4917            );
4918        }
4919        if let Some(ref val) = self.pst_cd {
4920            helpers::validate_length(
4921                val,
4922                "PstCd",
4923                Some(1),
4924                Some(16),
4925                &helpers::child_path(path, "PstCd"),
4926                config,
4927                collector,
4928            );
4929        }
4930        if let Some(ref val) = self.pst_cd {
4931            helpers::validate_pattern(
4932                val,
4933                "PstCd",
4934                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4935                &helpers::child_path(path, "PstCd"),
4936                config,
4937                collector,
4938            );
4939        }
4940        helpers::validate_length(
4941            &self.twn_nm,
4942            "TwnNm",
4943            Some(1),
4944            Some(35),
4945            &helpers::child_path(path, "TwnNm"),
4946            config,
4947            collector,
4948        );
4949        helpers::validate_pattern(
4950            &self.twn_nm,
4951            "TwnNm",
4952            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4953            &helpers::child_path(path, "TwnNm"),
4954            config,
4955            collector,
4956        );
4957        if let Some(ref val) = self.twn_lctn_nm {
4958            helpers::validate_length(
4959                val,
4960                "TwnLctnNm",
4961                Some(1),
4962                Some(35),
4963                &helpers::child_path(path, "TwnLctnNm"),
4964                config,
4965                collector,
4966            );
4967        }
4968        if let Some(ref val) = self.twn_lctn_nm {
4969            helpers::validate_pattern(
4970                val,
4971                "TwnLctnNm",
4972                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4973                &helpers::child_path(path, "TwnLctnNm"),
4974                config,
4975                collector,
4976            );
4977        }
4978        if let Some(ref val) = self.dstrct_nm {
4979            helpers::validate_length(
4980                val,
4981                "DstrctNm",
4982                Some(1),
4983                Some(35),
4984                &helpers::child_path(path, "DstrctNm"),
4985                config,
4986                collector,
4987            );
4988        }
4989        if let Some(ref val) = self.dstrct_nm {
4990            helpers::validate_pattern(
4991                val,
4992                "DstrctNm",
4993                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4994                &helpers::child_path(path, "DstrctNm"),
4995                config,
4996                collector,
4997            );
4998        }
4999        if let Some(ref val) = self.ctry_sub_dvsn {
5000            helpers::validate_length(
5001                val,
5002                "CtrySubDvsn",
5003                Some(1),
5004                Some(35),
5005                &helpers::child_path(path, "CtrySubDvsn"),
5006                config,
5007                collector,
5008            );
5009        }
5010        if let Some(ref val) = self.ctry_sub_dvsn {
5011            helpers::validate_pattern(
5012                val,
5013                "CtrySubDvsn",
5014                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5015                &helpers::child_path(path, "CtrySubDvsn"),
5016                config,
5017                collector,
5018            );
5019        }
5020        helpers::validate_pattern(
5021            &self.ctry,
5022            "Ctry",
5023            "[A-Z]{2,2}",
5024            &helpers::child_path(path, "Ctry"),
5025            config,
5026            collector,
5027        );
5028        if let Some(ref vec) = self.adr_line {
5029            for item in vec {
5030                helpers::validate_length(
5031                    item,
5032                    "AdrLine",
5033                    Some(1),
5034                    Some(70),
5035                    &helpers::child_path(path, "AdrLine"),
5036                    config,
5037                    collector,
5038                );
5039            }
5040        }
5041        if let Some(ref vec) = self.adr_line {
5042            for item in vec {
5043                helpers::validate_pattern(
5044                    item,
5045                    "AdrLine",
5046                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5047                    &helpers::child_path(path, "AdrLine"),
5048                    config,
5049                    collector,
5050                );
5051            }
5052        }
5053    }
5054}
5055
5056// PostalAddress244: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
5057#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5058pub struct PostalAddress244 {
5059    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
5060    pub dept: Option<String>,
5061    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
5062    pub sub_dept: Option<String>,
5063    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
5064    pub strt_nm: Option<String>,
5065    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
5066    pub bldg_nb: Option<String>,
5067    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
5068    pub bldg_nm: Option<String>,
5069    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
5070    pub flr: Option<String>,
5071    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
5072    pub pst_bx: Option<String>,
5073    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
5074    pub room: Option<String>,
5075    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
5076    pub pst_cd: Option<String>,
5077    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
5078    pub twn_nm: Option<String>,
5079    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
5080    pub twn_lctn_nm: Option<String>,
5081    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
5082    pub dstrct_nm: Option<String>,
5083    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
5084    pub ctry_sub_dvsn: Option<String>,
5085    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
5086    pub ctry: Option<String>,
5087    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
5088    pub adr_line: Option<Vec<String>>,
5089}
5090
5091impl Validate for PostalAddress244 {
5092    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5093        if let Some(ref val) = self.dept {
5094            helpers::validate_length(
5095                val,
5096                "Dept",
5097                Some(1),
5098                Some(35),
5099                &helpers::child_path(path, "Dept"),
5100                config,
5101                collector,
5102            );
5103        }
5104        if let Some(ref val) = self.dept {
5105            helpers::validate_pattern(
5106                val,
5107                "Dept",
5108                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5109                &helpers::child_path(path, "Dept"),
5110                config,
5111                collector,
5112            );
5113        }
5114        if let Some(ref val) = self.sub_dept {
5115            helpers::validate_length(
5116                val,
5117                "SubDept",
5118                Some(1),
5119                Some(35),
5120                &helpers::child_path(path, "SubDept"),
5121                config,
5122                collector,
5123            );
5124        }
5125        if let Some(ref val) = self.sub_dept {
5126            helpers::validate_pattern(
5127                val,
5128                "SubDept",
5129                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5130                &helpers::child_path(path, "SubDept"),
5131                config,
5132                collector,
5133            );
5134        }
5135        if let Some(ref val) = self.strt_nm {
5136            helpers::validate_length(
5137                val,
5138                "StrtNm",
5139                Some(1),
5140                Some(35),
5141                &helpers::child_path(path, "StrtNm"),
5142                config,
5143                collector,
5144            );
5145        }
5146        if let Some(ref val) = self.strt_nm {
5147            helpers::validate_pattern(
5148                val,
5149                "StrtNm",
5150                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5151                &helpers::child_path(path, "StrtNm"),
5152                config,
5153                collector,
5154            );
5155        }
5156        if let Some(ref val) = self.bldg_nb {
5157            helpers::validate_length(
5158                val,
5159                "BldgNb",
5160                Some(1),
5161                Some(16),
5162                &helpers::child_path(path, "BldgNb"),
5163                config,
5164                collector,
5165            );
5166        }
5167        if let Some(ref val) = self.bldg_nb {
5168            helpers::validate_pattern(
5169                val,
5170                "BldgNb",
5171                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5172                &helpers::child_path(path, "BldgNb"),
5173                config,
5174                collector,
5175            );
5176        }
5177        if let Some(ref val) = self.bldg_nm {
5178            helpers::validate_length(
5179                val,
5180                "BldgNm",
5181                Some(1),
5182                Some(35),
5183                &helpers::child_path(path, "BldgNm"),
5184                config,
5185                collector,
5186            );
5187        }
5188        if let Some(ref val) = self.bldg_nm {
5189            helpers::validate_pattern(
5190                val,
5191                "BldgNm",
5192                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5193                &helpers::child_path(path, "BldgNm"),
5194                config,
5195                collector,
5196            );
5197        }
5198        if let Some(ref val) = self.flr {
5199            helpers::validate_length(
5200                val,
5201                "Flr",
5202                Some(1),
5203                Some(35),
5204                &helpers::child_path(path, "Flr"),
5205                config,
5206                collector,
5207            );
5208        }
5209        if let Some(ref val) = self.flr {
5210            helpers::validate_pattern(
5211                val,
5212                "Flr",
5213                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5214                &helpers::child_path(path, "Flr"),
5215                config,
5216                collector,
5217            );
5218        }
5219        if let Some(ref val) = self.pst_bx {
5220            helpers::validate_length(
5221                val,
5222                "PstBx",
5223                Some(1),
5224                Some(16),
5225                &helpers::child_path(path, "PstBx"),
5226                config,
5227                collector,
5228            );
5229        }
5230        if let Some(ref val) = self.pst_bx {
5231            helpers::validate_pattern(
5232                val,
5233                "PstBx",
5234                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5235                &helpers::child_path(path, "PstBx"),
5236                config,
5237                collector,
5238            );
5239        }
5240        if let Some(ref val) = self.room {
5241            helpers::validate_length(
5242                val,
5243                "Room",
5244                Some(1),
5245                Some(35),
5246                &helpers::child_path(path, "Room"),
5247                config,
5248                collector,
5249            );
5250        }
5251        if let Some(ref val) = self.room {
5252            helpers::validate_pattern(
5253                val,
5254                "Room",
5255                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5256                &helpers::child_path(path, "Room"),
5257                config,
5258                collector,
5259            );
5260        }
5261        if let Some(ref val) = self.pst_cd {
5262            helpers::validate_length(
5263                val,
5264                "PstCd",
5265                Some(1),
5266                Some(16),
5267                &helpers::child_path(path, "PstCd"),
5268                config,
5269                collector,
5270            );
5271        }
5272        if let Some(ref val) = self.pst_cd {
5273            helpers::validate_pattern(
5274                val,
5275                "PstCd",
5276                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5277                &helpers::child_path(path, "PstCd"),
5278                config,
5279                collector,
5280            );
5281        }
5282        if let Some(ref val) = self.twn_nm {
5283            helpers::validate_length(
5284                val,
5285                "TwnNm",
5286                Some(1),
5287                Some(35),
5288                &helpers::child_path(path, "TwnNm"),
5289                config,
5290                collector,
5291            );
5292        }
5293        if let Some(ref val) = self.twn_nm {
5294            helpers::validate_pattern(
5295                val,
5296                "TwnNm",
5297                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5298                &helpers::child_path(path, "TwnNm"),
5299                config,
5300                collector,
5301            );
5302        }
5303        if let Some(ref val) = self.twn_lctn_nm {
5304            helpers::validate_length(
5305                val,
5306                "TwnLctnNm",
5307                Some(1),
5308                Some(35),
5309                &helpers::child_path(path, "TwnLctnNm"),
5310                config,
5311                collector,
5312            );
5313        }
5314        if let Some(ref val) = self.twn_lctn_nm {
5315            helpers::validate_pattern(
5316                val,
5317                "TwnLctnNm",
5318                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5319                &helpers::child_path(path, "TwnLctnNm"),
5320                config,
5321                collector,
5322            );
5323        }
5324        if let Some(ref val) = self.dstrct_nm {
5325            helpers::validate_length(
5326                val,
5327                "DstrctNm",
5328                Some(1),
5329                Some(35),
5330                &helpers::child_path(path, "DstrctNm"),
5331                config,
5332                collector,
5333            );
5334        }
5335        if let Some(ref val) = self.dstrct_nm {
5336            helpers::validate_pattern(
5337                val,
5338                "DstrctNm",
5339                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5340                &helpers::child_path(path, "DstrctNm"),
5341                config,
5342                collector,
5343            );
5344        }
5345        if let Some(ref val) = self.ctry_sub_dvsn {
5346            helpers::validate_length(
5347                val,
5348                "CtrySubDvsn",
5349                Some(1),
5350                Some(35),
5351                &helpers::child_path(path, "CtrySubDvsn"),
5352                config,
5353                collector,
5354            );
5355        }
5356        if let Some(ref val) = self.ctry_sub_dvsn {
5357            helpers::validate_pattern(
5358                val,
5359                "CtrySubDvsn",
5360                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5361                &helpers::child_path(path, "CtrySubDvsn"),
5362                config,
5363                collector,
5364            );
5365        }
5366        if let Some(ref val) = self.ctry {
5367            helpers::validate_pattern(
5368                val,
5369                "Ctry",
5370                "[A-Z]{2,2}",
5371                &helpers::child_path(path, "Ctry"),
5372                config,
5373                collector,
5374            );
5375        }
5376        if let Some(ref vec) = self.adr_line {
5377            for item in vec {
5378                helpers::validate_length(
5379                    item,
5380                    "AdrLine",
5381                    Some(1),
5382                    Some(70),
5383                    &helpers::child_path(path, "AdrLine"),
5384                    config,
5385                    collector,
5386                );
5387            }
5388        }
5389        if let Some(ref vec) = self.adr_line {
5390            for item in vec {
5391                helpers::validate_pattern(
5392                    item,
5393                    "AdrLine",
5394                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5395                    &helpers::child_path(path, "AdrLine"),
5396                    config,
5397                    collector,
5398                );
5399            }
5400        }
5401    }
5402}
5403
5404// PostalAddress245: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
5405#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5406pub struct PostalAddress245 {
5407    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
5408    pub dept: Option<String>,
5409    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
5410    pub sub_dept: Option<String>,
5411    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
5412    pub strt_nm: Option<String>,
5413    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
5414    pub bldg_nb: Option<String>,
5415    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
5416    pub bldg_nm: Option<String>,
5417    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
5418    pub flr: Option<String>,
5419    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
5420    pub pst_bx: Option<String>,
5421    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
5422    pub room: Option<String>,
5423    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
5424    pub pst_cd: Option<String>,
5425    #[serde(rename = "TwnNm")]
5426    pub twn_nm: String,
5427    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
5428    pub twn_lctn_nm: Option<String>,
5429    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
5430    pub dstrct_nm: Option<String>,
5431    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
5432    pub ctry_sub_dvsn: Option<String>,
5433    #[serde(rename = "Ctry")]
5434    pub ctry: String,
5435    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
5436    pub adr_line: Option<Vec<String>>,
5437}
5438
5439impl Validate for PostalAddress245 {
5440    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5441        if let Some(ref val) = self.dept {
5442            helpers::validate_length(
5443                val,
5444                "Dept",
5445                Some(1),
5446                Some(70),
5447                &helpers::child_path(path, "Dept"),
5448                config,
5449                collector,
5450            );
5451        }
5452        if let Some(ref val) = self.dept {
5453            helpers::validate_pattern(
5454                val,
5455                "Dept",
5456                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5457                &helpers::child_path(path, "Dept"),
5458                config,
5459                collector,
5460            );
5461        }
5462        if let Some(ref val) = self.sub_dept {
5463            helpers::validate_length(
5464                val,
5465                "SubDept",
5466                Some(1),
5467                Some(70),
5468                &helpers::child_path(path, "SubDept"),
5469                config,
5470                collector,
5471            );
5472        }
5473        if let Some(ref val) = self.sub_dept {
5474            helpers::validate_pattern(
5475                val,
5476                "SubDept",
5477                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5478                &helpers::child_path(path, "SubDept"),
5479                config,
5480                collector,
5481            );
5482        }
5483        if let Some(ref val) = self.strt_nm {
5484            helpers::validate_length(
5485                val,
5486                "StrtNm",
5487                Some(1),
5488                Some(70),
5489                &helpers::child_path(path, "StrtNm"),
5490                config,
5491                collector,
5492            );
5493        }
5494        if let Some(ref val) = self.strt_nm {
5495            helpers::validate_pattern(
5496                val,
5497                "StrtNm",
5498                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5499                &helpers::child_path(path, "StrtNm"),
5500                config,
5501                collector,
5502            );
5503        }
5504        if let Some(ref val) = self.bldg_nb {
5505            helpers::validate_length(
5506                val,
5507                "BldgNb",
5508                Some(1),
5509                Some(16),
5510                &helpers::child_path(path, "BldgNb"),
5511                config,
5512                collector,
5513            );
5514        }
5515        if let Some(ref val) = self.bldg_nb {
5516            helpers::validate_pattern(
5517                val,
5518                "BldgNb",
5519                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5520                &helpers::child_path(path, "BldgNb"),
5521                config,
5522                collector,
5523            );
5524        }
5525        if let Some(ref val) = self.bldg_nm {
5526            helpers::validate_length(
5527                val,
5528                "BldgNm",
5529                Some(1),
5530                Some(35),
5531                &helpers::child_path(path, "BldgNm"),
5532                config,
5533                collector,
5534            );
5535        }
5536        if let Some(ref val) = self.bldg_nm {
5537            helpers::validate_pattern(
5538                val,
5539                "BldgNm",
5540                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5541                &helpers::child_path(path, "BldgNm"),
5542                config,
5543                collector,
5544            );
5545        }
5546        if let Some(ref val) = self.flr {
5547            helpers::validate_length(
5548                val,
5549                "Flr",
5550                Some(1),
5551                Some(70),
5552                &helpers::child_path(path, "Flr"),
5553                config,
5554                collector,
5555            );
5556        }
5557        if let Some(ref val) = self.flr {
5558            helpers::validate_pattern(
5559                val,
5560                "Flr",
5561                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5562                &helpers::child_path(path, "Flr"),
5563                config,
5564                collector,
5565            );
5566        }
5567        if let Some(ref val) = self.pst_bx {
5568            helpers::validate_length(
5569                val,
5570                "PstBx",
5571                Some(1),
5572                Some(16),
5573                &helpers::child_path(path, "PstBx"),
5574                config,
5575                collector,
5576            );
5577        }
5578        if let Some(ref val) = self.pst_bx {
5579            helpers::validate_pattern(
5580                val,
5581                "PstBx",
5582                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5583                &helpers::child_path(path, "PstBx"),
5584                config,
5585                collector,
5586            );
5587        }
5588        if let Some(ref val) = self.room {
5589            helpers::validate_length(
5590                val,
5591                "Room",
5592                Some(1),
5593                Some(70),
5594                &helpers::child_path(path, "Room"),
5595                config,
5596                collector,
5597            );
5598        }
5599        if let Some(ref val) = self.room {
5600            helpers::validate_pattern(
5601                val,
5602                "Room",
5603                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5604                &helpers::child_path(path, "Room"),
5605                config,
5606                collector,
5607            );
5608        }
5609        if let Some(ref val) = self.pst_cd {
5610            helpers::validate_length(
5611                val,
5612                "PstCd",
5613                Some(1),
5614                Some(16),
5615                &helpers::child_path(path, "PstCd"),
5616                config,
5617                collector,
5618            );
5619        }
5620        if let Some(ref val) = self.pst_cd {
5621            helpers::validate_pattern(
5622                val,
5623                "PstCd",
5624                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5625                &helpers::child_path(path, "PstCd"),
5626                config,
5627                collector,
5628            );
5629        }
5630        helpers::validate_length(
5631            &self.twn_nm,
5632            "TwnNm",
5633            Some(1),
5634            Some(35),
5635            &helpers::child_path(path, "TwnNm"),
5636            config,
5637            collector,
5638        );
5639        if let Some(ref val) = self.twn_lctn_nm {
5640            helpers::validate_length(
5641                val,
5642                "TwnLctnNm",
5643                Some(1),
5644                Some(35),
5645                &helpers::child_path(path, "TwnLctnNm"),
5646                config,
5647                collector,
5648            );
5649        }
5650        if let Some(ref val) = self.twn_lctn_nm {
5651            helpers::validate_pattern(
5652                val,
5653                "TwnLctnNm",
5654                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5655                &helpers::child_path(path, "TwnLctnNm"),
5656                config,
5657                collector,
5658            );
5659        }
5660        if let Some(ref val) = self.dstrct_nm {
5661            helpers::validate_length(
5662                val,
5663                "DstrctNm",
5664                Some(1),
5665                Some(35),
5666                &helpers::child_path(path, "DstrctNm"),
5667                config,
5668                collector,
5669            );
5670        }
5671        if let Some(ref val) = self.dstrct_nm {
5672            helpers::validate_pattern(
5673                val,
5674                "DstrctNm",
5675                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5676                &helpers::child_path(path, "DstrctNm"),
5677                config,
5678                collector,
5679            );
5680        }
5681        if let Some(ref val) = self.ctry_sub_dvsn {
5682            helpers::validate_length(
5683                val,
5684                "CtrySubDvsn",
5685                Some(1),
5686                Some(35),
5687                &helpers::child_path(path, "CtrySubDvsn"),
5688                config,
5689                collector,
5690            );
5691        }
5692        if let Some(ref val) = self.ctry_sub_dvsn {
5693            helpers::validate_pattern(
5694                val,
5695                "CtrySubDvsn",
5696                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5697                &helpers::child_path(path, "CtrySubDvsn"),
5698                config,
5699                collector,
5700            );
5701        }
5702        helpers::validate_pattern(
5703            &self.ctry,
5704            "Ctry",
5705            "[A-Z]{2,2}",
5706            &helpers::child_path(path, "Ctry"),
5707            config,
5708            collector,
5709        );
5710        if let Some(ref vec) = self.adr_line {
5711            for item in vec {
5712                helpers::validate_length(
5713                    item,
5714                    "AdrLine",
5715                    Some(1),
5716                    Some(70),
5717                    &helpers::child_path(path, "AdrLine"),
5718                    config,
5719                    collector,
5720                );
5721            }
5722        }
5723        if let Some(ref vec) = self.adr_line {
5724            for item in vec {
5725                helpers::validate_pattern(
5726                    item,
5727                    "AdrLine",
5728                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5729                    &helpers::child_path(path, "AdrLine"),
5730                    config,
5731                    collector,
5732                );
5733            }
5734        }
5735    }
5736}
5737
5738// Priority2Code: Priority level is normal.
5739#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5740pub enum Priority2Code {
5741    #[default]
5742    #[serde(rename = "HIGH")]
5743    CodeHIGH,
5744    #[serde(rename = "NORM")]
5745    CodeNORM,
5746}
5747
5748impl Validate for Priority2Code {
5749    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5750        // Enum validation is typically empty
5751    }
5752}
5753
5754// Priority3Code: Priority level is normal.
5755#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5756pub enum Priority3Code {
5757    #[default]
5758    #[serde(rename = "URGT")]
5759    CodeURGT,
5760    #[serde(rename = "HIGH")]
5761    CodeHIGH,
5762    #[serde(rename = "NORM")]
5763    CodeNORM,
5764}
5765
5766impl Validate for Priority3Code {
5767    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5768        // Enum validation is typically empty
5769    }
5770}
5771
5772// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
5773#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5774pub struct ProxyAccountIdentification11 {
5775    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5776    pub tp: Option<ProxyAccountType1Choice>,
5777    #[serde(rename = "Id")]
5778    pub id: String,
5779}
5780
5781impl Validate for ProxyAccountIdentification11 {
5782    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5783        if let Some(ref val) = self.tp
5784            && config.validate_optional_fields
5785        {
5786            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5787        }
5788        helpers::validate_length(
5789            &self.id,
5790            "Id",
5791            Some(1),
5792            Some(320),
5793            &helpers::child_path(path, "Id"),
5794            config,
5795            collector,
5796        );
5797        helpers::validate_pattern(
5798            &self.id,
5799            "Id",
5800            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5801            &helpers::child_path(path, "Id"),
5802            config,
5803            collector,
5804        );
5805    }
5806}
5807
5808// ProxyAccountIdentification12: Identification used to indicate the account identification under another specified name.
5809#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5810pub struct ProxyAccountIdentification12 {
5811    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5812    pub tp: Option<ProxyAccountType1Choice1>,
5813    #[serde(rename = "Id")]
5814    pub id: String,
5815}
5816
5817impl Validate for ProxyAccountIdentification12 {
5818    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5819        if let Some(ref val) = self.tp
5820            && config.validate_optional_fields
5821        {
5822            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5823        }
5824        helpers::validate_length(
5825            &self.id,
5826            "Id",
5827            Some(1),
5828            Some(320),
5829            &helpers::child_path(path, "Id"),
5830            config,
5831            collector,
5832        );
5833        helpers::validate_pattern(
5834            &self.id,
5835            "Id",
5836            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5837            &helpers::child_path(path, "Id"),
5838            config,
5839            collector,
5840        );
5841    }
5842}
5843
5844// ProxyAccountType1Choice: Name of the identification scheme, in a free text form.
5845#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5846pub struct ProxyAccountType1Choice {
5847    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5848    pub cd: Option<String>,
5849    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5850    pub prtry: Option<String>,
5851}
5852
5853impl Validate for ProxyAccountType1Choice {
5854    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5855        if let Some(ref val) = self.cd {
5856            helpers::validate_length(
5857                val,
5858                "Cd",
5859                Some(1),
5860                Some(4),
5861                &helpers::child_path(path, "Cd"),
5862                config,
5863                collector,
5864            );
5865        }
5866        if let Some(ref val) = self.prtry {
5867            helpers::validate_length(
5868                val,
5869                "Prtry",
5870                Some(1),
5871                Some(35),
5872                &helpers::child_path(path, "Prtry"),
5873                config,
5874                collector,
5875            );
5876        }
5877    }
5878}
5879
5880// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
5881#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5882pub struct ProxyAccountType1Choice1 {
5883    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5884    pub cd: Option<String>,
5885    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5886    pub prtry: Option<String>,
5887}
5888
5889impl Validate for ProxyAccountType1Choice1 {
5890    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5891        if let Some(ref val) = self.cd {
5892            helpers::validate_length(
5893                val,
5894                "Cd",
5895                Some(1),
5896                Some(4),
5897                &helpers::child_path(path, "Cd"),
5898                config,
5899                collector,
5900            );
5901        }
5902        if let Some(ref val) = self.prtry {
5903            helpers::validate_length(
5904                val,
5905                "Prtry",
5906                Some(1),
5907                Some(35),
5908                &helpers::child_path(path, "Prtry"),
5909                config,
5910                collector,
5911            );
5912        }
5913        if let Some(ref val) = self.prtry {
5914            helpers::validate_pattern(
5915                val,
5916                "Prtry",
5917                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5918                &helpers::child_path(path, "Prtry"),
5919                config,
5920                collector,
5921            );
5922        }
5923    }
5924}
5925
5926// Purpose2Choice1: Purpose, in a proprietary form.
5927#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5928pub struct Purpose2Choice1 {
5929    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5930    pub cd: Option<String>,
5931    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5932    pub prtry: Option<String>,
5933}
5934
5935impl Validate for Purpose2Choice1 {
5936    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5937        if let Some(ref val) = self.cd {
5938            helpers::validate_length(
5939                val,
5940                "Cd",
5941                Some(1),
5942                Some(4),
5943                &helpers::child_path(path, "Cd"),
5944                config,
5945                collector,
5946            );
5947        }
5948        if let Some(ref val) = self.prtry {
5949            helpers::validate_length(
5950                val,
5951                "Prtry",
5952                Some(1),
5953                Some(35),
5954                &helpers::child_path(path, "Prtry"),
5955                config,
5956                collector,
5957            );
5958        }
5959        if let Some(ref val) = self.prtry {
5960            helpers::validate_pattern(
5961                val,
5962                "Prtry",
5963                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5964                &helpers::child_path(path, "Prtry"),
5965                config,
5966                collector,
5967            );
5968        }
5969    }
5970}
5971
5972// ReferredDocumentInformation71: Set of elements used to provide the content of the referred document line.
5973#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5974pub struct ReferredDocumentInformation71 {
5975    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5976    pub tp: Option<ReferredDocumentType41>,
5977    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
5978    pub nb: Option<String>,
5979    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
5980    pub rltd_dt: Option<String>,
5981    #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
5982    pub line_dtls: Option<Vec<DocumentLineInformation11>>,
5983}
5984
5985impl Validate for ReferredDocumentInformation71 {
5986    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5987        if let Some(ref val) = self.tp
5988            && config.validate_optional_fields
5989        {
5990            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5991        }
5992        if let Some(ref val) = self.nb {
5993            helpers::validate_length(
5994                val,
5995                "Nb",
5996                Some(1),
5997                Some(35),
5998                &helpers::child_path(path, "Nb"),
5999                config,
6000                collector,
6001            );
6002        }
6003        if let Some(ref val) = self.nb {
6004            helpers::validate_pattern(
6005                val,
6006                "Nb",
6007                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6008                &helpers::child_path(path, "Nb"),
6009                config,
6010                collector,
6011            );
6012        }
6013        if let Some(ref vec) = self.line_dtls
6014            && config.validate_optional_fields
6015        {
6016            for item in vec {
6017                item.validate(&helpers::child_path(path, "LineDtls"), config, collector);
6018            }
6019        }
6020    }
6021}
6022
6023// ReferredDocumentType3Choice: Proprietary identification of the type of the remittance document.
6024#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6025pub struct ReferredDocumentType3Choice {
6026    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6027    pub cd: Option<DocumentType6Code>,
6028    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6029    pub prtry: Option<String>,
6030}
6031
6032impl Validate for ReferredDocumentType3Choice {
6033    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6034        if let Some(ref val) = self.cd
6035            && config.validate_optional_fields
6036        {
6037            val.validate(&helpers::child_path(path, "Cd"), config, collector);
6038        }
6039        if let Some(ref val) = self.prtry {
6040            helpers::validate_length(
6041                val,
6042                "Prtry",
6043                Some(1),
6044                Some(35),
6045                &helpers::child_path(path, "Prtry"),
6046                config,
6047                collector,
6048            );
6049        }
6050    }
6051}
6052
6053// ReferredDocumentType41: Identification of the issuer of the reference document type.
6054#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6055pub struct ReferredDocumentType41 {
6056    #[serde(rename = "CdOrPrtry")]
6057    pub cd_or_prtry: ReferredDocumentType3Choice,
6058    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
6059    pub issr: Option<String>,
6060}
6061
6062impl Validate for ReferredDocumentType41 {
6063    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6064        self.cd_or_prtry
6065            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
6066        if let Some(ref val) = self.issr {
6067            helpers::validate_length(
6068                val,
6069                "Issr",
6070                Some(1),
6071                Some(35),
6072                &helpers::child_path(path, "Issr"),
6073                config,
6074                collector,
6075            );
6076        }
6077        if let Some(ref val) = self.issr {
6078            helpers::validate_pattern(
6079                val,
6080                "Issr",
6081                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6082                &helpers::child_path(path, "Issr"),
6083                config,
6084                collector,
6085            );
6086        }
6087    }
6088}
6089
6090// RegulatoryAuthority21: Country of the entity that requires the regulatory reporting information.
6091#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6092pub struct RegulatoryAuthority21 {
6093    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6094    pub nm: Option<String>,
6095    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
6096    pub ctry: Option<String>,
6097}
6098
6099impl Validate for RegulatoryAuthority21 {
6100    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6101        if let Some(ref val) = self.nm {
6102            helpers::validate_length(
6103                val,
6104                "Nm",
6105                Some(1),
6106                Some(140),
6107                &helpers::child_path(path, "Nm"),
6108                config,
6109                collector,
6110            );
6111        }
6112        if let Some(ref val) = self.nm {
6113            helpers::validate_pattern(
6114                val,
6115                "Nm",
6116                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6117                &helpers::child_path(path, "Nm"),
6118                config,
6119                collector,
6120            );
6121        }
6122        if let Some(ref val) = self.ctry {
6123            helpers::validate_pattern(
6124                val,
6125                "Ctry",
6126                "[A-Z]{2,2}",
6127                &helpers::child_path(path, "Ctry"),
6128                config,
6129                collector,
6130            );
6131        }
6132    }
6133}
6134
6135// RegulatoryReporting31: Set of elements used to provide details on the regulatory reporting information.
6136#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6137pub struct RegulatoryReporting31 {
6138    #[serde(rename = "DbtCdtRptgInd", skip_serializing_if = "Option::is_none")]
6139    pub dbt_cdt_rptg_ind: Option<RegulatoryReportingType1Code>,
6140    #[serde(rename = "Authrty", skip_serializing_if = "Option::is_none")]
6141    pub authrty: Option<RegulatoryAuthority21>,
6142    #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
6143    pub dtls: Option<Vec<StructuredRegulatoryReporting31>>,
6144}
6145
6146impl Validate for RegulatoryReporting31 {
6147    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6148        if let Some(ref val) = self.dbt_cdt_rptg_ind
6149            && config.validate_optional_fields
6150        {
6151            val.validate(
6152                &helpers::child_path(path, "DbtCdtRptgInd"),
6153                config,
6154                collector,
6155            );
6156        }
6157        if let Some(ref val) = self.authrty
6158            && config.validate_optional_fields
6159        {
6160            val.validate(&helpers::child_path(path, "Authrty"), config, collector);
6161        }
6162        if let Some(ref vec) = self.dtls
6163            && config.validate_optional_fields
6164        {
6165            for item in vec {
6166                item.validate(&helpers::child_path(path, "Dtls"), config, collector);
6167            }
6168        }
6169    }
6170}
6171
6172// RegulatoryReportingType1Code: Regulatory information applies to both credit and debit sides.
6173#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6174pub enum RegulatoryReportingType1Code {
6175    #[default]
6176    #[serde(rename = "CRED")]
6177    CodeCRED,
6178    #[serde(rename = "DEBT")]
6179    CodeDEBT,
6180    #[serde(rename = "BOTH")]
6181    CodeBOTH,
6182}
6183
6184impl Validate for RegulatoryReportingType1Code {
6185    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6186        // Enum validation is typically empty
6187    }
6188}
6189
6190// RemittanceAmount2: Amount of money remitted for the referred document.
6191#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6192pub struct RemittanceAmount2 {
6193    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
6194    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6195    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
6196    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
6197    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
6198    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6199    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
6200    pub tax_amt: Option<Vec<TaxAmountAndType1>>,
6201    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
6202    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment1>>,
6203    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
6204    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6205}
6206
6207impl Validate for RemittanceAmount2 {
6208    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6209        if let Some(ref val) = self.due_pybl_amt
6210            && config.validate_optional_fields
6211        {
6212            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
6213        }
6214        if let Some(ref vec) = self.dscnt_apld_amt
6215            && config.validate_optional_fields
6216        {
6217            for item in vec {
6218                item.validate(
6219                    &helpers::child_path(path, "DscntApldAmt"),
6220                    config,
6221                    collector,
6222                );
6223            }
6224        }
6225        if let Some(ref val) = self.cdt_note_amt
6226            && config.validate_optional_fields
6227        {
6228            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
6229        }
6230        if let Some(ref vec) = self.tax_amt
6231            && config.validate_optional_fields
6232        {
6233            for item in vec {
6234                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
6235            }
6236        }
6237        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
6238            && config.validate_optional_fields
6239        {
6240            for item in vec {
6241                item.validate(
6242                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
6243                    config,
6244                    collector,
6245                );
6246            }
6247        }
6248        if let Some(ref val) = self.rmtd_amt
6249            && config.validate_optional_fields
6250        {
6251            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
6252        }
6253    }
6254}
6255
6256// RemittanceAmount31: Amount of money remitted.
6257#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6258pub struct RemittanceAmount31 {
6259    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
6260    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6261    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
6262    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
6263    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
6264    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6265    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
6266    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
6267    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
6268    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
6269    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
6270    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6271}
6272
6273impl Validate for RemittanceAmount31 {
6274    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6275        if let Some(ref val) = self.due_pybl_amt
6276            && config.validate_optional_fields
6277        {
6278            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
6279        }
6280        if let Some(ref vec) = self.dscnt_apld_amt
6281            && config.validate_optional_fields
6282        {
6283            for item in vec {
6284                item.validate(
6285                    &helpers::child_path(path, "DscntApldAmt"),
6286                    config,
6287                    collector,
6288                );
6289            }
6290        }
6291        if let Some(ref val) = self.cdt_note_amt
6292            && config.validate_optional_fields
6293        {
6294            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
6295        }
6296        if let Some(ref vec) = self.tax_amt
6297            && config.validate_optional_fields
6298        {
6299            for item in vec {
6300                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
6301            }
6302        }
6303        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
6304            && config.validate_optional_fields
6305        {
6306            for item in vec {
6307                item.validate(
6308                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
6309                    config,
6310                    collector,
6311                );
6312            }
6313        }
6314        if let Some(ref val) = self.rmtd_amt
6315            && config.validate_optional_fields
6316        {
6317            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
6318        }
6319    }
6320}
6321
6322// RemittanceInformation161: Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system, in a structured form.
6323#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6324pub struct RemittanceInformation161 {
6325    #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
6326    pub ustrd: Option<String>,
6327    #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
6328    pub strd: Option<Vec<StructuredRemittanceInformation161>>,
6329}
6330
6331impl Validate for RemittanceInformation161 {
6332    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6333        if let Some(ref val) = self.ustrd {
6334            helpers::validate_length(
6335                val,
6336                "Ustrd",
6337                Some(1),
6338                Some(140),
6339                &helpers::child_path(path, "Ustrd"),
6340                config,
6341                collector,
6342            );
6343        }
6344        if let Some(ref val) = self.ustrd {
6345            helpers::validate_pattern(
6346                val,
6347                "Ustrd",
6348                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6349                &helpers::child_path(path, "Ustrd"),
6350                config,
6351                collector,
6352            );
6353        }
6354        if let Some(ref vec) = self.strd
6355            && config.validate_optional_fields
6356        {
6357            for item in vec {
6358                item.validate(&helpers::child_path(path, "Strd"), config, collector);
6359            }
6360        }
6361    }
6362}
6363
6364// RemittanceLocation71: Set of elements used to provide information on the location and/or delivery of the remittance information.
6365#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6366pub struct RemittanceLocation71 {
6367    #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
6368    pub rmt_id: Option<String>,
6369    #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
6370    pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
6371}
6372
6373impl Validate for RemittanceLocation71 {
6374    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6375        if let Some(ref val) = self.rmt_id {
6376            helpers::validate_length(
6377                val,
6378                "RmtId",
6379                Some(1),
6380                Some(35),
6381                &helpers::child_path(path, "RmtId"),
6382                config,
6383                collector,
6384            );
6385        }
6386        if let Some(ref val) = self.rmt_id {
6387            helpers::validate_pattern(
6388                val,
6389                "RmtId",
6390                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6391                &helpers::child_path(path, "RmtId"),
6392                config,
6393                collector,
6394            );
6395        }
6396        if let Some(ref vec) = self.rmt_lctn_dtls
6397            && config.validate_optional_fields
6398        {
6399            for item in vec {
6400                item.validate(&helpers::child_path(path, "RmtLctnDtls"), config, collector);
6401            }
6402        }
6403    }
6404}
6405
6406// RemittanceLocationData11: Postal address to which an agent is to send the remittance information.
6407#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6408pub struct RemittanceLocationData11 {
6409    #[serde(rename = "Mtd")]
6410    pub mtd: RemittanceLocationMethod2Code,
6411    #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
6412    pub elctrnc_adr: Option<String>,
6413    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6414    pub pstl_adr: Option<NameAndAddress161>,
6415}
6416
6417impl Validate for RemittanceLocationData11 {
6418    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6419        self.mtd
6420            .validate(&helpers::child_path(path, "Mtd"), config, collector);
6421        if let Some(ref val) = self.elctrnc_adr {
6422            helpers::validate_length(
6423                val,
6424                "ElctrncAdr",
6425                Some(1),
6426                Some(2048),
6427                &helpers::child_path(path, "ElctrncAdr"),
6428                config,
6429                collector,
6430            );
6431        }
6432        if let Some(ref val) = self.elctrnc_adr {
6433            helpers::validate_pattern(
6434                val,
6435                "ElctrncAdr",
6436                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6437                &helpers::child_path(path, "ElctrncAdr"),
6438                config,
6439                collector,
6440            );
6441        }
6442        if let Some(ref val) = self.pstl_adr
6443            && config.validate_optional_fields
6444        {
6445            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6446        }
6447    }
6448}
6449
6450// RemittanceLocationMethod2Code: Remittance advice information must be sent through by phone as a short message service (SMS).
6451#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6452pub enum RemittanceLocationMethod2Code {
6453    #[default]
6454    #[serde(rename = "FAXI")]
6455    CodeFAXI,
6456    #[serde(rename = "EDIC")]
6457    CodeEDIC,
6458    #[serde(rename = "URID")]
6459    CodeURID,
6460    #[serde(rename = "EMAL")]
6461    CodeEMAL,
6462    #[serde(rename = "POST")]
6463    CodePOST,
6464    #[serde(rename = "SMSM")]
6465    CodeSMSM,
6466}
6467
6468impl Validate for RemittanceLocationMethod2Code {
6469    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6470        // Enum validation is typically empty
6471    }
6472}
6473
6474// SequenceType3Code: Collection used to re-present previously reversed or returned direct debit transactions.
6475#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6476pub enum SequenceType3Code {
6477    #[default]
6478    #[serde(rename = "FRST")]
6479    CodeFRST,
6480    #[serde(rename = "RCUR")]
6481    CodeRCUR,
6482    #[serde(rename = "FNAL")]
6483    CodeFNAL,
6484    #[serde(rename = "OOFF")]
6485    CodeOOFF,
6486    #[serde(rename = "RPRE")]
6487    CodeRPRE,
6488}
6489
6490impl Validate for SequenceType3Code {
6491    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6492        // Enum validation is typically empty
6493    }
6494}
6495
6496// ServiceLevel8Choice1: Specifies a pre-agreed service or level of service between the parties, as a proprietary code.
6497#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6498pub struct ServiceLevel8Choice1 {
6499    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6500    pub cd: Option<String>,
6501    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6502    pub prtry: Option<String>,
6503}
6504
6505impl Validate for ServiceLevel8Choice1 {
6506    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6507        if let Some(ref val) = self.cd {
6508            helpers::validate_length(
6509                val,
6510                "Cd",
6511                Some(1),
6512                Some(4),
6513                &helpers::child_path(path, "Cd"),
6514                config,
6515                collector,
6516            );
6517        }
6518        if let Some(ref val) = self.prtry {
6519            helpers::validate_length(
6520                val,
6521                "Prtry",
6522                Some(1),
6523                Some(35),
6524                &helpers::child_path(path, "Prtry"),
6525                config,
6526                collector,
6527            );
6528        }
6529        if let Some(ref val) = self.prtry {
6530            helpers::validate_pattern(
6531                val,
6532                "Prtry",
6533                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6534                &helpers::child_path(path, "Prtry"),
6535                config,
6536                collector,
6537            );
6538        }
6539    }
6540}
6541
6542// SettlementDateTimeIndication11: Date and time at which a payment has been credited at the transaction administrator. In the case of TARGET, the date and time at which the payment has been credited at the receiving central bank, expressed in Central European Time (CET).
6543#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6544pub struct SettlementDateTimeIndication11 {
6545    #[serde(rename = "DbtDtTm", skip_serializing_if = "Option::is_none")]
6546    pub dbt_dt_tm: Option<String>,
6547    #[serde(rename = "CdtDtTm", skip_serializing_if = "Option::is_none")]
6548    pub cdt_dt_tm: Option<String>,
6549}
6550
6551impl Validate for SettlementDateTimeIndication11 {
6552    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6553        if let Some(ref val) = self.dbt_dt_tm {
6554            helpers::validate_pattern(
6555                val,
6556                "DbtDtTm",
6557                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
6558                &helpers::child_path(path, "DbtDtTm"),
6559                config,
6560                collector,
6561            );
6562        }
6563        if let Some(ref val) = self.cdt_dt_tm {
6564            helpers::validate_pattern(
6565                val,
6566                "CdtDtTm",
6567                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
6568                &helpers::child_path(path, "CdtDtTm"),
6569                config,
6570                collector,
6571            );
6572        }
6573    }
6574}
6575
6576// SettlementInstruction81: A specific purpose account used to post debit and credit entries as a result of the transaction.
6577#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6578pub struct SettlementInstruction81 {
6579    #[serde(rename = "SttlmMtd")]
6580    pub sttlm_mtd: SettlementMethod2Code1,
6581    #[serde(rename = "SttlmAcct", skip_serializing_if = "Option::is_none")]
6582    pub sttlm_acct: Option<CashAccount381>,
6583}
6584
6585impl Validate for SettlementInstruction81 {
6586    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6587        self.sttlm_mtd
6588            .validate(&helpers::child_path(path, "SttlmMtd"), config, collector);
6589        if let Some(ref val) = self.sttlm_acct
6590            && config.validate_optional_fields
6591        {
6592            val.validate(&helpers::child_path(path, "SttlmAcct"), config, collector);
6593        }
6594    }
6595}
6596
6597// SettlementMethod2Code__1: Settlement is done by the agent instructing and forwarding the payment to the next party in the payment chain.
6598#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6599pub enum SettlementMethod2Code1 {
6600    #[default]
6601    #[serde(rename = "INDA")]
6602    CodeINDA,
6603    #[serde(rename = "INGA")]
6604    CodeINGA,
6605}
6606
6607impl Validate for SettlementMethod2Code1 {
6608    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6609        // Enum validation is typically empty
6610    }
6611}
6612
6613// StructuredRegulatoryReporting31: Additional details that cater for specific domestic regulatory requirements.
6614#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6615pub struct StructuredRegulatoryReporting31 {
6616    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
6617    pub tp: Option<String>,
6618    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
6619    pub dt: Option<String>,
6620    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
6621    pub ctry: Option<String>,
6622    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6623    pub cd: Option<String>,
6624    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
6625    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6626    #[serde(rename = "Inf", skip_serializing_if = "Option::is_none")]
6627    pub inf: Option<Vec<String>>,
6628}
6629
6630impl Validate for StructuredRegulatoryReporting31 {
6631    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6632        if let Some(ref val) = self.tp {
6633            helpers::validate_length(
6634                val,
6635                "Tp",
6636                Some(1),
6637                Some(35),
6638                &helpers::child_path(path, "Tp"),
6639                config,
6640                collector,
6641            );
6642        }
6643        if let Some(ref val) = self.tp {
6644            helpers::validate_pattern(
6645                val,
6646                "Tp",
6647                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6648                &helpers::child_path(path, "Tp"),
6649                config,
6650                collector,
6651            );
6652        }
6653        if let Some(ref val) = self.ctry {
6654            helpers::validate_pattern(
6655                val,
6656                "Ctry",
6657                "[A-Z]{2,2}",
6658                &helpers::child_path(path, "Ctry"),
6659                config,
6660                collector,
6661            );
6662        }
6663        if let Some(ref val) = self.cd {
6664            helpers::validate_length(
6665                val,
6666                "Cd",
6667                Some(1),
6668                Some(10),
6669                &helpers::child_path(path, "Cd"),
6670                config,
6671                collector,
6672            );
6673        }
6674        if let Some(ref val) = self.cd {
6675            helpers::validate_pattern(
6676                val,
6677                "Cd",
6678                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6679                &helpers::child_path(path, "Cd"),
6680                config,
6681                collector,
6682            );
6683        }
6684        if let Some(ref val) = self.amt
6685            && config.validate_optional_fields
6686        {
6687            val.validate(&helpers::child_path(path, "Amt"), config, collector);
6688        }
6689        if let Some(ref vec) = self.inf {
6690            for item in vec {
6691                helpers::validate_length(
6692                    item,
6693                    "Inf",
6694                    Some(1),
6695                    Some(35),
6696                    &helpers::child_path(path, "Inf"),
6697                    config,
6698                    collector,
6699                );
6700            }
6701        }
6702        if let Some(ref vec) = self.inf {
6703            for item in vec {
6704                helpers::validate_pattern(
6705                    item,
6706                    "Inf",
6707                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6708                    &helpers::child_path(path, "Inf"),
6709                    config,
6710                    collector,
6711                );
6712            }
6713        }
6714    }
6715}
6716
6717// StructuredRemittanceInformation161: Additional information, in free text form, to complement the structured remittance information.
6718#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6719pub struct StructuredRemittanceInformation161 {
6720    #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
6721    pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
6722    #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
6723    pub rfrd_doc_amt: Option<RemittanceAmount2>,
6724    #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
6725    pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
6726    #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
6727    pub invcr: Option<PartyIdentification1355>,
6728    #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
6729    pub invcee: Option<PartyIdentification1355>,
6730    #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
6731    pub tax_rmt: Option<TaxInformation71>,
6732    #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
6733    pub grnshmt_rmt: Option<Garnishment31>,
6734    #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
6735    pub addtl_rmt_inf: Option<Vec<String>>,
6736}
6737
6738impl Validate for StructuredRemittanceInformation161 {
6739    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6740        if let Some(ref vec) = self.rfrd_doc_inf
6741            && config.validate_optional_fields
6742        {
6743            for item in vec {
6744                item.validate(&helpers::child_path(path, "RfrdDocInf"), config, collector);
6745            }
6746        }
6747        if let Some(ref val) = self.rfrd_doc_amt
6748            && config.validate_optional_fields
6749        {
6750            val.validate(&helpers::child_path(path, "RfrdDocAmt"), config, collector);
6751        }
6752        if let Some(ref val) = self.cdtr_ref_inf
6753            && config.validate_optional_fields
6754        {
6755            val.validate(&helpers::child_path(path, "CdtrRefInf"), config, collector);
6756        }
6757        if let Some(ref val) = self.invcr
6758            && config.validate_optional_fields
6759        {
6760            val.validate(&helpers::child_path(path, "Invcr"), config, collector);
6761        }
6762        if let Some(ref val) = self.invcee
6763            && config.validate_optional_fields
6764        {
6765            val.validate(&helpers::child_path(path, "Invcee"), config, collector);
6766        }
6767        if let Some(ref val) = self.tax_rmt
6768            && config.validate_optional_fields
6769        {
6770            val.validate(&helpers::child_path(path, "TaxRmt"), config, collector);
6771        }
6772        if let Some(ref val) = self.grnshmt_rmt
6773            && config.validate_optional_fields
6774        {
6775            val.validate(&helpers::child_path(path, "GrnshmtRmt"), config, collector);
6776        }
6777        if let Some(ref vec) = self.addtl_rmt_inf {
6778            for item in vec {
6779                helpers::validate_length(
6780                    item,
6781                    "AddtlRmtInf",
6782                    Some(1),
6783                    Some(140),
6784                    &helpers::child_path(path, "AddtlRmtInf"),
6785                    config,
6786                    collector,
6787                );
6788            }
6789        }
6790        if let Some(ref vec) = self.addtl_rmt_inf {
6791            for item in vec {
6792                helpers::validate_pattern(
6793                    item,
6794                    "AddtlRmtInf",
6795                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6796                    &helpers::child_path(path, "AddtlRmtInf"),
6797                    config,
6798                    collector,
6799                );
6800            }
6801        }
6802    }
6803}
6804
6805// TaxAmount2: Set of elements used to provide details on the tax period and amount.
6806#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6807pub struct TaxAmount2 {
6808    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
6809    pub rate: Option<f64>,
6810    #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
6811    pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6812    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
6813    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6814    #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
6815    pub dtls: Option<Vec<TaxRecordDetails2>>,
6816}
6817
6818impl Validate for TaxAmount2 {
6819    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6820        if let Some(ref val) = self.taxbl_base_amt
6821            && config.validate_optional_fields
6822        {
6823            val.validate(
6824                &helpers::child_path(path, "TaxblBaseAmt"),
6825                config,
6826                collector,
6827            );
6828        }
6829        if let Some(ref val) = self.ttl_amt
6830            && config.validate_optional_fields
6831        {
6832            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
6833        }
6834        if let Some(ref vec) = self.dtls
6835            && config.validate_optional_fields
6836        {
6837            for item in vec {
6838                item.validate(&helpers::child_path(path, "Dtls"), config, collector);
6839            }
6840        }
6841    }
6842}
6843
6844// TaxAmountAndType1: Amount of money, which has been typed.
6845#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6846pub struct TaxAmountAndType1 {
6847    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
6848    pub tp: Option<TaxAmountType1Choice>,
6849    #[serde(rename = "Amt")]
6850    pub amt: ActiveOrHistoricCurrencyAndAmount,
6851}
6852
6853impl Validate for TaxAmountAndType1 {
6854    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6855        if let Some(ref val) = self.tp
6856            && config.validate_optional_fields
6857        {
6858            val.validate(&helpers::child_path(path, "Tp"), config, collector);
6859        }
6860        self.amt
6861            .validate(&helpers::child_path(path, "Amt"), config, collector);
6862    }
6863}
6864
6865// TaxAmountAndType11: Amount of money, which has been typed.
6866#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6867pub struct TaxAmountAndType11 {
6868    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
6869    pub tp: Option<TaxAmountType1Choice1>,
6870    #[serde(rename = "Amt")]
6871    pub amt: ActiveOrHistoricCurrencyAndAmount,
6872}
6873
6874impl Validate for TaxAmountAndType11 {
6875    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6876        if let Some(ref val) = self.tp
6877            && config.validate_optional_fields
6878        {
6879            val.validate(&helpers::child_path(path, "Tp"), config, collector);
6880        }
6881        self.amt
6882            .validate(&helpers::child_path(path, "Amt"), config, collector);
6883    }
6884}
6885
6886// TaxAmountType1Choice: Specifies the amount type, in a free-text form.
6887#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6888pub struct TaxAmountType1Choice {
6889    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6890    pub cd: Option<String>,
6891    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6892    pub prtry: Option<String>,
6893}
6894
6895impl Validate for TaxAmountType1Choice {
6896    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6897        if let Some(ref val) = self.cd {
6898            helpers::validate_length(
6899                val,
6900                "Cd",
6901                Some(1),
6902                Some(4),
6903                &helpers::child_path(path, "Cd"),
6904                config,
6905                collector,
6906            );
6907        }
6908        if let Some(ref val) = self.prtry {
6909            helpers::validate_length(
6910                val,
6911                "Prtry",
6912                Some(1),
6913                Some(35),
6914                &helpers::child_path(path, "Prtry"),
6915                config,
6916                collector,
6917            );
6918        }
6919    }
6920}
6921
6922// TaxAmountType1Choice1: Specifies the amount type, in a free-text form.
6923#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6924pub struct TaxAmountType1Choice1 {
6925    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6926    pub cd: Option<String>,
6927    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6928    pub prtry: Option<String>,
6929}
6930
6931impl Validate for TaxAmountType1Choice1 {
6932    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6933        if let Some(ref val) = self.cd {
6934            helpers::validate_length(
6935                val,
6936                "Cd",
6937                Some(1),
6938                Some(4),
6939                &helpers::child_path(path, "Cd"),
6940                config,
6941                collector,
6942            );
6943        }
6944        if let Some(ref val) = self.prtry {
6945            helpers::validate_length(
6946                val,
6947                "Prtry",
6948                Some(1),
6949                Some(35),
6950                &helpers::child_path(path, "Prtry"),
6951                config,
6952                collector,
6953            );
6954        }
6955        if let Some(ref val) = self.prtry {
6956            helpers::validate_pattern(
6957                val,
6958                "Prtry",
6959                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6960                &helpers::child_path(path, "Prtry"),
6961                config,
6962                collector,
6963            );
6964        }
6965    }
6966}
6967
6968// TaxAuthorisation11: Name of the debtor or the debtor's authorised representative.
6969#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6970pub struct TaxAuthorisation11 {
6971    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
6972    pub titl: Option<String>,
6973    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6974    pub nm: Option<String>,
6975}
6976
6977impl Validate for TaxAuthorisation11 {
6978    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6979        if let Some(ref val) = self.titl {
6980            helpers::validate_length(
6981                val,
6982                "Titl",
6983                Some(1),
6984                Some(35),
6985                &helpers::child_path(path, "Titl"),
6986                config,
6987                collector,
6988            );
6989        }
6990        if let Some(ref val) = self.titl {
6991            helpers::validate_pattern(
6992                val,
6993                "Titl",
6994                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6995                &helpers::child_path(path, "Titl"),
6996                config,
6997                collector,
6998            );
6999        }
7000        if let Some(ref val) = self.nm {
7001            helpers::validate_length(
7002                val,
7003                "Nm",
7004                Some(1),
7005                Some(140),
7006                &helpers::child_path(path, "Nm"),
7007                config,
7008                collector,
7009            );
7010        }
7011        if let Some(ref val) = self.nm {
7012            helpers::validate_pattern(
7013                val,
7014                "Nm",
7015                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7016                &helpers::child_path(path, "Nm"),
7017                config,
7018                collector,
7019            );
7020        }
7021    }
7022}
7023
7024// TaxInformation71: Record of tax details.
7025#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7026pub struct TaxInformation71 {
7027    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
7028    pub cdtr: Option<TaxParty11>,
7029    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
7030    pub dbtr: Option<TaxParty21>,
7031    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
7032    pub ultmt_dbtr: Option<TaxParty21>,
7033    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
7034    pub admstn_zone: Option<String>,
7035    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
7036    pub ref_nb: Option<String>,
7037    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
7038    pub mtd: Option<String>,
7039    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
7040    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
7041    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
7042    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
7043    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
7044    pub dt: Option<String>,
7045    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
7046    pub seq_nb: Option<f64>,
7047    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
7048    pub rcrd: Option<Vec<TaxRecord21>>,
7049}
7050
7051impl Validate for TaxInformation71 {
7052    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7053        if let Some(ref val) = self.cdtr
7054            && config.validate_optional_fields
7055        {
7056            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
7057        }
7058        if let Some(ref val) = self.dbtr
7059            && config.validate_optional_fields
7060        {
7061            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
7062        }
7063        if let Some(ref val) = self.ultmt_dbtr
7064            && config.validate_optional_fields
7065        {
7066            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
7067        }
7068        if let Some(ref val) = self.admstn_zone {
7069            helpers::validate_length(
7070                val,
7071                "AdmstnZone",
7072                Some(1),
7073                Some(35),
7074                &helpers::child_path(path, "AdmstnZone"),
7075                config,
7076                collector,
7077            );
7078        }
7079        if let Some(ref val) = self.admstn_zone {
7080            helpers::validate_pattern(
7081                val,
7082                "AdmstnZone",
7083                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7084                &helpers::child_path(path, "AdmstnZone"),
7085                config,
7086                collector,
7087            );
7088        }
7089        if let Some(ref val) = self.ref_nb {
7090            helpers::validate_length(
7091                val,
7092                "RefNb",
7093                Some(1),
7094                Some(140),
7095                &helpers::child_path(path, "RefNb"),
7096                config,
7097                collector,
7098            );
7099        }
7100        if let Some(ref val) = self.ref_nb {
7101            helpers::validate_pattern(
7102                val,
7103                "RefNb",
7104                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7105                &helpers::child_path(path, "RefNb"),
7106                config,
7107                collector,
7108            );
7109        }
7110        if let Some(ref val) = self.mtd {
7111            helpers::validate_length(
7112                val,
7113                "Mtd",
7114                Some(1),
7115                Some(35),
7116                &helpers::child_path(path, "Mtd"),
7117                config,
7118                collector,
7119            );
7120        }
7121        if let Some(ref val) = self.mtd {
7122            helpers::validate_pattern(
7123                val,
7124                "Mtd",
7125                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7126                &helpers::child_path(path, "Mtd"),
7127                config,
7128                collector,
7129            );
7130        }
7131        if let Some(ref val) = self.ttl_taxbl_base_amt
7132            && config.validate_optional_fields
7133        {
7134            val.validate(
7135                &helpers::child_path(path, "TtlTaxblBaseAmt"),
7136                config,
7137                collector,
7138            );
7139        }
7140        if let Some(ref val) = self.ttl_tax_amt
7141            && config.validate_optional_fields
7142        {
7143            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
7144        }
7145        if let Some(ref vec) = self.rcrd
7146            && config.validate_optional_fields
7147        {
7148            for item in vec {
7149                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
7150            }
7151        }
7152    }
7153}
7154
7155// TaxParty11: Type of tax payer.
7156#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7157pub struct TaxParty11 {
7158    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
7159    pub tax_id: Option<String>,
7160    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
7161    pub regn_id: Option<String>,
7162    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
7163    pub tax_tp: Option<String>,
7164}
7165
7166impl Validate for TaxParty11 {
7167    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7168        if let Some(ref val) = self.tax_id {
7169            helpers::validate_length(
7170                val,
7171                "TaxId",
7172                Some(1),
7173                Some(35),
7174                &helpers::child_path(path, "TaxId"),
7175                config,
7176                collector,
7177            );
7178        }
7179        if let Some(ref val) = self.tax_id {
7180            helpers::validate_pattern(
7181                val,
7182                "TaxId",
7183                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7184                &helpers::child_path(path, "TaxId"),
7185                config,
7186                collector,
7187            );
7188        }
7189        if let Some(ref val) = self.regn_id {
7190            helpers::validate_length(
7191                val,
7192                "RegnId",
7193                Some(1),
7194                Some(35),
7195                &helpers::child_path(path, "RegnId"),
7196                config,
7197                collector,
7198            );
7199        }
7200        if let Some(ref val) = self.regn_id {
7201            helpers::validate_pattern(
7202                val,
7203                "RegnId",
7204                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7205                &helpers::child_path(path, "RegnId"),
7206                config,
7207                collector,
7208            );
7209        }
7210        if let Some(ref val) = self.tax_tp {
7211            helpers::validate_length(
7212                val,
7213                "TaxTp",
7214                Some(1),
7215                Some(35),
7216                &helpers::child_path(path, "TaxTp"),
7217                config,
7218                collector,
7219            );
7220        }
7221        if let Some(ref val) = self.tax_tp {
7222            helpers::validate_pattern(
7223                val,
7224                "TaxTp",
7225                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7226                &helpers::child_path(path, "TaxTp"),
7227                config,
7228                collector,
7229            );
7230        }
7231    }
7232}
7233
7234// TaxParty21: Details of the authorised tax paying party.
7235#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7236pub struct TaxParty21 {
7237    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
7238    pub tax_id: Option<String>,
7239    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
7240    pub regn_id: Option<String>,
7241    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
7242    pub tax_tp: Option<String>,
7243    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
7244    pub authstn: Option<TaxAuthorisation11>,
7245}
7246
7247impl Validate for TaxParty21 {
7248    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7249        if let Some(ref val) = self.tax_id {
7250            helpers::validate_length(
7251                val,
7252                "TaxId",
7253                Some(1),
7254                Some(35),
7255                &helpers::child_path(path, "TaxId"),
7256                config,
7257                collector,
7258            );
7259        }
7260        if let Some(ref val) = self.tax_id {
7261            helpers::validate_pattern(
7262                val,
7263                "TaxId",
7264                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7265                &helpers::child_path(path, "TaxId"),
7266                config,
7267                collector,
7268            );
7269        }
7270        if let Some(ref val) = self.regn_id {
7271            helpers::validate_length(
7272                val,
7273                "RegnId",
7274                Some(1),
7275                Some(35),
7276                &helpers::child_path(path, "RegnId"),
7277                config,
7278                collector,
7279            );
7280        }
7281        if let Some(ref val) = self.regn_id {
7282            helpers::validate_pattern(
7283                val,
7284                "RegnId",
7285                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7286                &helpers::child_path(path, "RegnId"),
7287                config,
7288                collector,
7289            );
7290        }
7291        if let Some(ref val) = self.tax_tp {
7292            helpers::validate_length(
7293                val,
7294                "TaxTp",
7295                Some(1),
7296                Some(35),
7297                &helpers::child_path(path, "TaxTp"),
7298                config,
7299                collector,
7300            );
7301        }
7302        if let Some(ref val) = self.tax_tp {
7303            helpers::validate_pattern(
7304                val,
7305                "TaxTp",
7306                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7307                &helpers::child_path(path, "TaxTp"),
7308                config,
7309                collector,
7310            );
7311        }
7312        if let Some(ref val) = self.authstn
7313            && config.validate_optional_fields
7314        {
7315            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
7316        }
7317    }
7318}
7319
7320// TaxPeriod2: Range of time between a start date and an end date for which the tax report is provided.
7321#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7322pub struct TaxPeriod2 {
7323    #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
7324    pub yr: Option<String>,
7325    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
7326    pub tp: Option<TaxRecordPeriod1Code>,
7327    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
7328    pub fr_to_dt: Option<DatePeriod2>,
7329}
7330
7331impl Validate for TaxPeriod2 {
7332    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7333        if let Some(ref val) = self.tp
7334            && config.validate_optional_fields
7335        {
7336            val.validate(&helpers::child_path(path, "Tp"), config, collector);
7337        }
7338        if let Some(ref val) = self.fr_to_dt
7339            && config.validate_optional_fields
7340        {
7341            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
7342        }
7343    }
7344}
7345
7346// TaxRecord21: Further details of the tax record.
7347#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7348pub struct TaxRecord21 {
7349    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
7350    pub tp: Option<String>,
7351    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
7352    pub ctgy: Option<String>,
7353    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
7354    pub ctgy_dtls: Option<String>,
7355    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
7356    pub dbtr_sts: Option<String>,
7357    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
7358    pub cert_id: Option<String>,
7359    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
7360    pub frms_cd: Option<String>,
7361    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
7362    pub prd: Option<TaxPeriod2>,
7363    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
7364    pub tax_amt: Option<TaxAmount2>,
7365    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
7366    pub addtl_inf: Option<String>,
7367}
7368
7369impl Validate for TaxRecord21 {
7370    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7371        if let Some(ref val) = self.tp {
7372            helpers::validate_length(
7373                val,
7374                "Tp",
7375                Some(1),
7376                Some(35),
7377                &helpers::child_path(path, "Tp"),
7378                config,
7379                collector,
7380            );
7381        }
7382        if let Some(ref val) = self.tp {
7383            helpers::validate_pattern(
7384                val,
7385                "Tp",
7386                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7387                &helpers::child_path(path, "Tp"),
7388                config,
7389                collector,
7390            );
7391        }
7392        if let Some(ref val) = self.ctgy {
7393            helpers::validate_length(
7394                val,
7395                "Ctgy",
7396                Some(1),
7397                Some(35),
7398                &helpers::child_path(path, "Ctgy"),
7399                config,
7400                collector,
7401            );
7402        }
7403        if let Some(ref val) = self.ctgy {
7404            helpers::validate_pattern(
7405                val,
7406                "Ctgy",
7407                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7408                &helpers::child_path(path, "Ctgy"),
7409                config,
7410                collector,
7411            );
7412        }
7413        if let Some(ref val) = self.ctgy_dtls {
7414            helpers::validate_length(
7415                val,
7416                "CtgyDtls",
7417                Some(1),
7418                Some(35),
7419                &helpers::child_path(path, "CtgyDtls"),
7420                config,
7421                collector,
7422            );
7423        }
7424        if let Some(ref val) = self.ctgy_dtls {
7425            helpers::validate_pattern(
7426                val,
7427                "CtgyDtls",
7428                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7429                &helpers::child_path(path, "CtgyDtls"),
7430                config,
7431                collector,
7432            );
7433        }
7434        if let Some(ref val) = self.dbtr_sts {
7435            helpers::validate_length(
7436                val,
7437                "DbtrSts",
7438                Some(1),
7439                Some(35),
7440                &helpers::child_path(path, "DbtrSts"),
7441                config,
7442                collector,
7443            );
7444        }
7445        if let Some(ref val) = self.dbtr_sts {
7446            helpers::validate_pattern(
7447                val,
7448                "DbtrSts",
7449                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7450                &helpers::child_path(path, "DbtrSts"),
7451                config,
7452                collector,
7453            );
7454        }
7455        if let Some(ref val) = self.cert_id {
7456            helpers::validate_length(
7457                val,
7458                "CertId",
7459                Some(1),
7460                Some(35),
7461                &helpers::child_path(path, "CertId"),
7462                config,
7463                collector,
7464            );
7465        }
7466        if let Some(ref val) = self.cert_id {
7467            helpers::validate_pattern(
7468                val,
7469                "CertId",
7470                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7471                &helpers::child_path(path, "CertId"),
7472                config,
7473                collector,
7474            );
7475        }
7476        if let Some(ref val) = self.frms_cd {
7477            helpers::validate_length(
7478                val,
7479                "FrmsCd",
7480                Some(1),
7481                Some(35),
7482                &helpers::child_path(path, "FrmsCd"),
7483                config,
7484                collector,
7485            );
7486        }
7487        if let Some(ref val) = self.frms_cd {
7488            helpers::validate_pattern(
7489                val,
7490                "FrmsCd",
7491                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7492                &helpers::child_path(path, "FrmsCd"),
7493                config,
7494                collector,
7495            );
7496        }
7497        if let Some(ref val) = self.prd
7498            && config.validate_optional_fields
7499        {
7500            val.validate(&helpers::child_path(path, "Prd"), config, collector);
7501        }
7502        if let Some(ref val) = self.tax_amt
7503            && config.validate_optional_fields
7504        {
7505            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
7506        }
7507        if let Some(ref val) = self.addtl_inf {
7508            helpers::validate_length(
7509                val,
7510                "AddtlInf",
7511                Some(1),
7512                Some(140),
7513                &helpers::child_path(path, "AddtlInf"),
7514                config,
7515                collector,
7516            );
7517        }
7518        if let Some(ref val) = self.addtl_inf {
7519            helpers::validate_pattern(
7520                val,
7521                "AddtlInf",
7522                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7523                &helpers::child_path(path, "AddtlInf"),
7524                config,
7525                collector,
7526            );
7527        }
7528    }
7529}
7530
7531// TaxRecordDetails2: Underlying tax amount related to the specified period.
7532#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7533pub struct TaxRecordDetails2 {
7534    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
7535    pub prd: Option<TaxPeriod2>,
7536    #[serde(rename = "Amt")]
7537    pub amt: ActiveOrHistoricCurrencyAndAmount,
7538}
7539
7540impl Validate for TaxRecordDetails2 {
7541    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7542        if let Some(ref val) = self.prd
7543            && config.validate_optional_fields
7544        {
7545            val.validate(&helpers::child_path(path, "Prd"), config, collector);
7546        }
7547        self.amt
7548            .validate(&helpers::child_path(path, "Amt"), config, collector);
7549    }
7550}
7551
7552// TaxRecordPeriod1Code: Tax is related to the second half of the period.
7553#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7554pub enum TaxRecordPeriod1Code {
7555    #[default]
7556    #[serde(rename = "MM01")]
7557    CodeMM01,
7558    #[serde(rename = "MM02")]
7559    CodeMM02,
7560    #[serde(rename = "MM03")]
7561    CodeMM03,
7562    #[serde(rename = "MM04")]
7563    CodeMM04,
7564    #[serde(rename = "MM05")]
7565    CodeMM05,
7566    #[serde(rename = "MM06")]
7567    CodeMM06,
7568    #[serde(rename = "MM07")]
7569    CodeMM07,
7570    #[serde(rename = "MM08")]
7571    CodeMM08,
7572    #[serde(rename = "MM09")]
7573    CodeMM09,
7574    #[serde(rename = "MM10")]
7575    CodeMM10,
7576    #[serde(rename = "MM11")]
7577    CodeMM11,
7578    #[serde(rename = "MM12")]
7579    CodeMM12,
7580    #[serde(rename = "QTR1")]
7581    CodeQTR1,
7582    #[serde(rename = "QTR2")]
7583    CodeQTR2,
7584    #[serde(rename = "QTR3")]
7585    CodeQTR3,
7586    #[serde(rename = "QTR4")]
7587    CodeQTR4,
7588    #[serde(rename = "HLF1")]
7589    CodeHLF1,
7590    #[serde(rename = "HLF2")]
7591    CodeHLF2,
7592}
7593
7594impl Validate for TaxRecordPeriod1Code {
7595    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7596        // Enum validation is typically empty
7597    }
7598}