mx_message/document/
pacs_004_001_09.rs

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