mx_message/document/
pacs_009_001_08_cov.rs

1// Plasmatic MX Message Parsing Library
2// https://github.com/GoPlasmatic/MXMessage
3//
4// Copyright (c) 2025 Plasmatic
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9//     http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// You may obtain a copy of this library at
18// https://github.com/GoPlasmatic/MXMessage
19use crate::parse_result::{ErrorCollector, ParserConfig};
20use crate::validation::{Validate, helpers};
21use serde::{Deserialize, Serialize};
22
23// AccountIdentification4Choice1: Unique identification of an account, as assigned by the account servicer, using an identification scheme.
24#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
25pub struct AccountIdentification4Choice1 {
26    #[serde(rename = "IBAN", skip_serializing_if = "Option::is_none")]
27    pub iban: Option<String>,
28    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
29    pub othr: Option<GenericAccountIdentification11>,
30}
31
32impl Validate for AccountIdentification4Choice1 {
33    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
34        if let Some(ref val) = self.iban {
35            helpers::validate_pattern(
36                val,
37                "IBAN",
38                "[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}",
39                &helpers::child_path(path, "IBAN"),
40                config,
41                collector,
42            );
43        }
44        if let Some(ref val) = self.othr
45            && config.validate_optional_fields
46        {
47            val.validate(&helpers::child_path(path, "Othr"), config, collector);
48        }
49    }
50}
51
52// AccountSchemeName1Choice1: Name of the identification scheme, in a free text form.
53#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
54pub struct AccountSchemeName1Choice1 {
55    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
56    pub cd: Option<String>,
57    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
58    pub prtry: Option<String>,
59}
60
61impl Validate for AccountSchemeName1Choice1 {
62    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
63        if let Some(ref val) = self.cd {
64            helpers::validate_length(
65                val,
66                "Cd",
67                Some(1),
68                Some(4),
69                &helpers::child_path(path, "Cd"),
70                config,
71                collector,
72            );
73        }
74        if let Some(ref val) = self.prtry {
75            helpers::validate_length(
76                val,
77                "Prtry",
78                Some(1),
79                Some(35),
80                &helpers::child_path(path, "Prtry"),
81                config,
82                collector,
83            );
84        }
85        if let Some(ref val) = self.prtry {
86            helpers::validate_pattern(
87                val,
88                "Prtry",
89                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
90                &helpers::child_path(path, "Prtry"),
91                config,
92                collector,
93            );
94        }
95    }
96}
97
98// 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.
99#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
100pub struct ActiveOrHistoricCurrencyAndAmount {
101    #[serde(rename = "@Ccy")]
102    pub ccy: String,
103    #[serde(rename = "$value")]
104    pub value: f64,
105}
106
107impl Validate for ActiveOrHistoricCurrencyAndAmount {
108    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
109}
110
111// BranchAndFinancialInstitutionIdentification61: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
112#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
113pub struct BranchAndFinancialInstitutionIdentification61 {
114    #[serde(rename = "FinInstnId")]
115    pub fin_instn_id: FinancialInstitutionIdentification181,
116}
117
118impl Validate for BranchAndFinancialInstitutionIdentification61 {
119    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
120        self.fin_instn_id
121            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
122    }
123}
124
125// BranchAndFinancialInstitutionIdentification62: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
126#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
127pub struct BranchAndFinancialInstitutionIdentification62 {
128    #[serde(rename = "FinInstnId")]
129    pub fin_instn_id: FinancialInstitutionIdentification182,
130}
131
132impl Validate for BranchAndFinancialInstitutionIdentification62 {
133    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
134        self.fin_instn_id
135            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
136    }
137}
138
139// BranchAndFinancialInstitutionIdentification63: Identifies a specific branch of a financial institution.
140//
141// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
142#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
143pub struct BranchAndFinancialInstitutionIdentification63 {
144    #[serde(rename = "FinInstnId")]
145    pub fin_instn_id: FinancialInstitutionIdentification181,
146    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
147    pub brnch_id: Option<BranchData31>,
148}
149
150impl Validate for BranchAndFinancialInstitutionIdentification63 {
151    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
152        self.fin_instn_id
153            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
154        if let Some(ref val) = self.brnch_id
155            && config.validate_optional_fields
156        {
157            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
158        }
159    }
160}
161
162// BranchData31: Unique and unambiguous identification of a branch of a financial institution.
163#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
164pub struct BranchData31 {
165    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
166    pub id: Option<String>,
167}
168
169impl Validate for BranchData31 {
170    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
171        if let Some(ref val) = self.id {
172            helpers::validate_length(
173                val,
174                "Id",
175                Some(1),
176                Some(35),
177                &helpers::child_path(path, "Id"),
178                config,
179                collector,
180            );
181        }
182        if let Some(ref val) = self.id {
183            helpers::validate_pattern(
184                val,
185                "Id",
186                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
187                &helpers::child_path(path, "Id"),
188                config,
189                collector,
190            );
191        }
192    }
193}
194
195// CBPRAmount1: CBPR_Amount__1
196#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
197pub struct CBPRAmount1 {
198    #[serde(rename = "@Ccy")]
199    pub ccy: String,
200    #[serde(rename = "$value")]
201    pub value: f64,
202}
203
204impl Validate for CBPRAmount1 {
205    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
206}
207
208// CashAccount381: Specifies an alternate assumed name for the identification of the account.
209#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
210pub struct CashAccount381 {
211    #[serde(rename = "Id")]
212    pub id: AccountIdentification4Choice1,
213    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
214    pub tp: Option<CashAccountType2Choice1>,
215    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
216    pub ccy: Option<String>,
217    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
218    pub nm: Option<String>,
219    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
220    pub prxy: Option<ProxyAccountIdentification11>,
221}
222
223impl Validate for CashAccount381 {
224    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
225        self.id
226            .validate(&helpers::child_path(path, "Id"), config, collector);
227        if let Some(ref val) = self.tp
228            && config.validate_optional_fields
229        {
230            val.validate(&helpers::child_path(path, "Tp"), config, collector);
231        }
232        if let Some(ref val) = self.ccy {
233            helpers::validate_pattern(
234                val,
235                "Ccy",
236                "[A-Z]{3,3}",
237                &helpers::child_path(path, "Ccy"),
238                config,
239                collector,
240            );
241        }
242        if let Some(ref val) = self.nm {
243            helpers::validate_length(
244                val,
245                "Nm",
246                Some(1),
247                Some(70),
248                &helpers::child_path(path, "Nm"),
249                config,
250                collector,
251            );
252        }
253        if let Some(ref val) = self.nm {
254            helpers::validate_pattern(
255                val,
256                "Nm",
257                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
258                &helpers::child_path(path, "Nm"),
259                config,
260                collector,
261            );
262        }
263        if let Some(ref val) = self.prxy
264            && config.validate_optional_fields
265        {
266            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
267        }
268    }
269}
270
271// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
272#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
273pub struct CashAccountType2Choice1 {
274    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
275    pub cd: Option<String>,
276    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
277    pub prtry: Option<String>,
278}
279
280impl Validate for CashAccountType2Choice1 {
281    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
282        if let Some(ref val) = self.cd {
283            helpers::validate_length(
284                val,
285                "Cd",
286                Some(1),
287                Some(4),
288                &helpers::child_path(path, "Cd"),
289                config,
290                collector,
291            );
292        }
293        if let Some(ref val) = self.prtry {
294            helpers::validate_length(
295                val,
296                "Prtry",
297                Some(1),
298                Some(35),
299                &helpers::child_path(path, "Prtry"),
300                config,
301                collector,
302            );
303        }
304        if let Some(ref val) = self.prtry {
305            helpers::validate_pattern(
306                val,
307                "Prtry",
308                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
309                &helpers::child_path(path, "Prtry"),
310                config,
311                collector,
312            );
313        }
314    }
315}
316
317// CategoryPurpose1Choice1: Category purpose, in a proprietary form.
318#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
319pub struct CategoryPurpose1Choice1 {
320    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
321    pub cd: Option<String>,
322    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
323    pub prtry: Option<String>,
324}
325
326impl Validate for CategoryPurpose1Choice1 {
327    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
328        if let Some(ref val) = self.cd {
329            helpers::validate_length(
330                val,
331                "Cd",
332                Some(1),
333                Some(4),
334                &helpers::child_path(path, "Cd"),
335                config,
336                collector,
337            );
338        }
339        if let Some(ref val) = self.prtry {
340            helpers::validate_length(
341                val,
342                "Prtry",
343                Some(1),
344                Some(35),
345                &helpers::child_path(path, "Prtry"),
346                config,
347                collector,
348            );
349        }
350        if let Some(ref val) = self.prtry {
351            helpers::validate_pattern(
352                val,
353                "Prtry",
354                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
355                &helpers::child_path(path, "Prtry"),
356                config,
357                collector,
358            );
359        }
360    }
361}
362
363// ClearingChannel2Code: Payment through internal book transfer.
364#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
365pub enum ClearingChannel2Code {
366    #[default]
367    #[serde(rename = "RTGS")]
368    CodeRTGS,
369    #[serde(rename = "RTNS")]
370    CodeRTNS,
371    #[serde(rename = "MPNS")]
372    CodeMPNS,
373    #[serde(rename = "BOOK")]
374    CodeBOOK,
375}
376
377impl Validate for ClearingChannel2Code {
378    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
379        // Enum validation is typically empty
380    }
381}
382
383// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
384#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
385pub struct ClearingSystemIdentification2Choice1 {
386    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
387    pub cd: Option<String>,
388}
389
390impl Validate for ClearingSystemIdentification2Choice1 {
391    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
392        if let Some(ref val) = self.cd {
393            helpers::validate_length(
394                val,
395                "Cd",
396                Some(1),
397                Some(5),
398                &helpers::child_path(path, "Cd"),
399                config,
400                collector,
401            );
402        }
403    }
404}
405
406// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
407#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
408pub struct ClearingSystemMemberIdentification21 {
409    #[serde(rename = "ClrSysId")]
410    pub clr_sys_id: ClearingSystemIdentification2Choice1,
411    #[serde(rename = "MmbId")]
412    pub mmb_id: String,
413}
414
415impl Validate for ClearingSystemMemberIdentification21 {
416    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
417        self.clr_sys_id
418            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
419        helpers::validate_length(
420            &self.mmb_id,
421            "MmbId",
422            Some(1),
423            Some(28),
424            &helpers::child_path(path, "MmbId"),
425            config,
426            collector,
427        );
428        helpers::validate_pattern(
429            &self.mmb_id,
430            "MmbId",
431            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
432            &helpers::child_path(path, "MmbId"),
433            config,
434            collector,
435        );
436    }
437}
438
439// CreditDebitCode: Operation is a decrease.
440#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
441pub enum CreditDebitCode {
442    #[default]
443    #[serde(rename = "CRDT")]
444    CodeCRDT,
445    #[serde(rename = "DBIT")]
446    CodeDBIT,
447}
448
449impl Validate for CreditDebitCode {
450    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
451        // Enum validation is typically empty
452    }
453}
454
455// CreditTransferTransaction361: Provides information on the underlying customer credit transfer for which cover is provided.
456#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
457pub struct CreditTransferTransaction361 {
458    #[serde(rename = "PmtId")]
459    pub pmt_id: PaymentIdentification71,
460    #[serde(rename = "PmtTpInf", skip_serializing_if = "Option::is_none")]
461    pub pmt_tp_inf: Option<PaymentTypeInformation281>,
462    #[serde(rename = "IntrBkSttlmAmt")]
463    pub intr_bk_sttlm_amt: CBPRAmount1,
464    #[serde(rename = "IntrBkSttlmDt")]
465    pub intr_bk_sttlm_dt: String,
466    #[serde(rename = "SttlmPrty", skip_serializing_if = "Option::is_none")]
467    pub sttlm_prty: Option<Priority3Code>,
468    #[serde(rename = "SttlmTmIndctn", skip_serializing_if = "Option::is_none")]
469    pub sttlm_tm_indctn: Option<SettlementDateTimeIndication11>,
470    #[serde(rename = "SttlmTmReq", skip_serializing_if = "Option::is_none")]
471    pub sttlm_tm_req: Option<SettlementTimeRequest21>,
472    #[serde(rename = "PrvsInstgAgt1", skip_serializing_if = "Option::is_none")]
473    pub prvs_instg_agt1: Option<BranchAndFinancialInstitutionIdentification61>,
474    #[serde(rename = "PrvsInstgAgt1Acct", skip_serializing_if = "Option::is_none")]
475    pub prvs_instg_agt1_acct: Option<CashAccount381>,
476    #[serde(rename = "PrvsInstgAgt2", skip_serializing_if = "Option::is_none")]
477    pub prvs_instg_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
478    #[serde(rename = "PrvsInstgAgt2Acct", skip_serializing_if = "Option::is_none")]
479    pub prvs_instg_agt2_acct: Option<CashAccount381>,
480    #[serde(rename = "PrvsInstgAgt3", skip_serializing_if = "Option::is_none")]
481    pub prvs_instg_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
482    #[serde(rename = "PrvsInstgAgt3Acct", skip_serializing_if = "Option::is_none")]
483    pub prvs_instg_agt3_acct: Option<CashAccount381>,
484    #[serde(rename = "InstgAgt")]
485    pub instg_agt: BranchAndFinancialInstitutionIdentification62,
486    #[serde(rename = "InstdAgt")]
487    pub instd_agt: BranchAndFinancialInstitutionIdentification62,
488    #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
489    pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification61>,
490    #[serde(rename = "IntrmyAgt1Acct", skip_serializing_if = "Option::is_none")]
491    pub intrmy_agt1_acct: Option<CashAccount381>,
492    #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
493    pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
494    #[serde(rename = "IntrmyAgt2Acct", skip_serializing_if = "Option::is_none")]
495    pub intrmy_agt2_acct: Option<CashAccount381>,
496    #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
497    pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
498    #[serde(rename = "IntrmyAgt3Acct", skip_serializing_if = "Option::is_none")]
499    pub intrmy_agt3_acct: Option<CashAccount381>,
500    #[serde(rename = "Dbtr")]
501    pub dbtr: BranchAndFinancialInstitutionIdentification61,
502    #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
503    pub dbtr_acct: Option<CashAccount381>,
504    #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
505    pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
506    #[serde(rename = "DbtrAgtAcct", skip_serializing_if = "Option::is_none")]
507    pub dbtr_agt_acct: Option<CashAccount381>,
508    #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
509    pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
510    #[serde(rename = "CdtrAgtAcct", skip_serializing_if = "Option::is_none")]
511    pub cdtr_agt_acct: Option<CashAccount381>,
512    #[serde(rename = "Cdtr")]
513    pub cdtr: BranchAndFinancialInstitutionIdentification61,
514    #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
515    pub cdtr_acct: Option<CashAccount381>,
516    #[serde(rename = "InstrForCdtrAgt", skip_serializing_if = "Option::is_none")]
517    pub instr_for_cdtr_agt: Option<Vec<InstructionForCreditorAgent21>>,
518    #[serde(rename = "InstrForNxtAgt", skip_serializing_if = "Option::is_none")]
519    pub instr_for_nxt_agt: Option<Vec<InstructionForNextAgent11>>,
520    #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
521    pub purp: Option<Purpose2Choice1>,
522    #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
523    pub rmt_inf: Option<RemittanceInformation21>,
524    #[serde(rename = "UndrlygCstmrCdtTrf")]
525    pub undrlyg_cstmr_cdt_trf: CreditTransferTransaction371,
526}
527
528impl Validate for CreditTransferTransaction361 {
529    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
530        self.pmt_id
531            .validate(&helpers::child_path(path, "PmtId"), config, collector);
532        if let Some(ref val) = self.pmt_tp_inf
533            && config.validate_optional_fields
534        {
535            val.validate(&helpers::child_path(path, "PmtTpInf"), config, collector);
536        }
537        self.intr_bk_sttlm_amt.validate(
538            &helpers::child_path(path, "IntrBkSttlmAmt"),
539            config,
540            collector,
541        );
542        if let Some(ref val) = self.sttlm_prty
543            && config.validate_optional_fields
544        {
545            val.validate(&helpers::child_path(path, "SttlmPrty"), config, collector);
546        }
547        if let Some(ref val) = self.sttlm_tm_indctn
548            && config.validate_optional_fields
549        {
550            val.validate(
551                &helpers::child_path(path, "SttlmTmIndctn"),
552                config,
553                collector,
554            );
555        }
556        if let Some(ref val) = self.sttlm_tm_req
557            && config.validate_optional_fields
558        {
559            val.validate(&helpers::child_path(path, "SttlmTmReq"), config, collector);
560        }
561        if let Some(ref val) = self.prvs_instg_agt1
562            && config.validate_optional_fields
563        {
564            val.validate(
565                &helpers::child_path(path, "PrvsInstgAgt1"),
566                config,
567                collector,
568            );
569        }
570        if let Some(ref val) = self.prvs_instg_agt1_acct
571            && config.validate_optional_fields
572        {
573            val.validate(
574                &helpers::child_path(path, "PrvsInstgAgt1Acct"),
575                config,
576                collector,
577            );
578        }
579        if let Some(ref val) = self.prvs_instg_agt2
580            && config.validate_optional_fields
581        {
582            val.validate(
583                &helpers::child_path(path, "PrvsInstgAgt2"),
584                config,
585                collector,
586            );
587        }
588        if let Some(ref val) = self.prvs_instg_agt2_acct
589            && config.validate_optional_fields
590        {
591            val.validate(
592                &helpers::child_path(path, "PrvsInstgAgt2Acct"),
593                config,
594                collector,
595            );
596        }
597        if let Some(ref val) = self.prvs_instg_agt3
598            && config.validate_optional_fields
599        {
600            val.validate(
601                &helpers::child_path(path, "PrvsInstgAgt3"),
602                config,
603                collector,
604            );
605        }
606        if let Some(ref val) = self.prvs_instg_agt3_acct
607            && config.validate_optional_fields
608        {
609            val.validate(
610                &helpers::child_path(path, "PrvsInstgAgt3Acct"),
611                config,
612                collector,
613            );
614        }
615        self.instg_agt
616            .validate(&helpers::child_path(path, "InstgAgt"), config, collector);
617        self.instd_agt
618            .validate(&helpers::child_path(path, "InstdAgt"), config, collector);
619        if let Some(ref val) = self.intrmy_agt1
620            && config.validate_optional_fields
621        {
622            val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
623        }
624        if let Some(ref val) = self.intrmy_agt1_acct
625            && config.validate_optional_fields
626        {
627            val.validate(
628                &helpers::child_path(path, "IntrmyAgt1Acct"),
629                config,
630                collector,
631            );
632        }
633        if let Some(ref val) = self.intrmy_agt2
634            && config.validate_optional_fields
635        {
636            val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
637        }
638        if let Some(ref val) = self.intrmy_agt2_acct
639            && config.validate_optional_fields
640        {
641            val.validate(
642                &helpers::child_path(path, "IntrmyAgt2Acct"),
643                config,
644                collector,
645            );
646        }
647        if let Some(ref val) = self.intrmy_agt3
648            && config.validate_optional_fields
649        {
650            val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
651        }
652        if let Some(ref val) = self.intrmy_agt3_acct
653            && config.validate_optional_fields
654        {
655            val.validate(
656                &helpers::child_path(path, "IntrmyAgt3Acct"),
657                config,
658                collector,
659            );
660        }
661        self.dbtr
662            .validate(&helpers::child_path(path, "Dbtr"), config, collector);
663        if let Some(ref val) = self.dbtr_acct
664            && config.validate_optional_fields
665        {
666            val.validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
667        }
668        if let Some(ref val) = self.dbtr_agt
669            && config.validate_optional_fields
670        {
671            val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
672        }
673        if let Some(ref val) = self.dbtr_agt_acct
674            && config.validate_optional_fields
675        {
676            val.validate(&helpers::child_path(path, "DbtrAgtAcct"), config, collector);
677        }
678        if let Some(ref val) = self.cdtr_agt
679            && config.validate_optional_fields
680        {
681            val.validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
682        }
683        if let Some(ref val) = self.cdtr_agt_acct
684            && config.validate_optional_fields
685        {
686            val.validate(&helpers::child_path(path, "CdtrAgtAcct"), config, collector);
687        }
688        self.cdtr
689            .validate(&helpers::child_path(path, "Cdtr"), config, collector);
690        if let Some(ref val) = self.cdtr_acct
691            && config.validate_optional_fields
692        {
693            val.validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
694        }
695        if let Some(ref vec) = self.instr_for_cdtr_agt
696            && config.validate_optional_fields
697        {
698            for item in vec {
699                item.validate(
700                    &helpers::child_path(path, "InstrForCdtrAgt"),
701                    config,
702                    collector,
703                );
704            }
705        }
706        if let Some(ref vec) = self.instr_for_nxt_agt
707            && config.validate_optional_fields
708        {
709            for item in vec {
710                item.validate(
711                    &helpers::child_path(path, "InstrForNxtAgt"),
712                    config,
713                    collector,
714                );
715            }
716        }
717        if let Some(ref val) = self.purp
718            && config.validate_optional_fields
719        {
720            val.validate(&helpers::child_path(path, "Purp"), config, collector);
721        }
722        if let Some(ref val) = self.rmt_inf
723            && config.validate_optional_fields
724        {
725            val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
726        }
727        self.undrlyg_cstmr_cdt_trf.validate(
728            &helpers::child_path(path, "UndrlygCstmrCdtTrf"),
729            config,
730            collector,
731        );
732    }
733}
734
735// CreditTransferTransaction371: Amount of money to be moved between the debtor and creditor, before deduction of charges, expressed in the currency as ordered by the initiating party.
736// Usage: This amount has to be transported unchanged through the transaction chain.
737#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
738pub struct CreditTransferTransaction371 {
739    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
740    pub ultmt_dbtr: Option<PartyIdentification1351>,
741    #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
742    pub initg_pty: Option<PartyIdentification1351>,
743    #[serde(rename = "Dbtr")]
744    pub dbtr: PartyIdentification1352,
745    #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
746    pub dbtr_acct: Option<CashAccount381>,
747    #[serde(rename = "DbtrAgt")]
748    pub dbtr_agt: BranchAndFinancialInstitutionIdentification61,
749    #[serde(rename = "DbtrAgtAcct", skip_serializing_if = "Option::is_none")]
750    pub dbtr_agt_acct: Option<CashAccount381>,
751    #[serde(rename = "PrvsInstgAgt1", skip_serializing_if = "Option::is_none")]
752    pub prvs_instg_agt1: Option<BranchAndFinancialInstitutionIdentification61>,
753    #[serde(rename = "PrvsInstgAgt1Acct", skip_serializing_if = "Option::is_none")]
754    pub prvs_instg_agt1_acct: Option<CashAccount381>,
755    #[serde(rename = "PrvsInstgAgt2", skip_serializing_if = "Option::is_none")]
756    pub prvs_instg_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
757    #[serde(rename = "PrvsInstgAgt2Acct", skip_serializing_if = "Option::is_none")]
758    pub prvs_instg_agt2_acct: Option<CashAccount381>,
759    #[serde(rename = "PrvsInstgAgt3", skip_serializing_if = "Option::is_none")]
760    pub prvs_instg_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
761    #[serde(rename = "PrvsInstgAgt3Acct", skip_serializing_if = "Option::is_none")]
762    pub prvs_instg_agt3_acct: Option<CashAccount381>,
763    #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
764    pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification61>,
765    #[serde(rename = "IntrmyAgt1Acct", skip_serializing_if = "Option::is_none")]
766    pub intrmy_agt1_acct: Option<CashAccount381>,
767    #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
768    pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
769    #[serde(rename = "IntrmyAgt2Acct", skip_serializing_if = "Option::is_none")]
770    pub intrmy_agt2_acct: Option<CashAccount381>,
771    #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
772    pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
773    #[serde(rename = "IntrmyAgt3Acct", skip_serializing_if = "Option::is_none")]
774    pub intrmy_agt3_acct: Option<CashAccount381>,
775    #[serde(rename = "CdtrAgt")]
776    pub cdtr_agt: BranchAndFinancialInstitutionIdentification63,
777    #[serde(rename = "CdtrAgtAcct", skip_serializing_if = "Option::is_none")]
778    pub cdtr_agt_acct: Option<CashAccount381>,
779    #[serde(rename = "Cdtr")]
780    pub cdtr: PartyIdentification1353,
781    #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
782    pub cdtr_acct: Option<CashAccount381>,
783    #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
784    pub ultmt_cdtr: Option<PartyIdentification1351>,
785    #[serde(rename = "InstrForCdtrAgt", skip_serializing_if = "Option::is_none")]
786    pub instr_for_cdtr_agt: Option<Vec<InstructionForCreditorAgent11>>,
787    #[serde(rename = "InstrForNxtAgt", skip_serializing_if = "Option::is_none")]
788    pub instr_for_nxt_agt: Option<Vec<InstructionForNextAgent11>>,
789    #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
790    pub rmt_inf: Option<RemittanceInformation161>,
791    #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
792    pub instd_amt: Option<CBPRAmount1>,
793}
794
795impl Validate for CreditTransferTransaction371 {
796    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
797        if let Some(ref val) = self.ultmt_dbtr
798            && config.validate_optional_fields
799        {
800            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
801        }
802        if let Some(ref val) = self.initg_pty
803            && config.validate_optional_fields
804        {
805            val.validate(&helpers::child_path(path, "InitgPty"), config, collector);
806        }
807        self.dbtr
808            .validate(&helpers::child_path(path, "Dbtr"), config, collector);
809        if let Some(ref val) = self.dbtr_acct
810            && config.validate_optional_fields
811        {
812            val.validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
813        }
814        self.dbtr_agt
815            .validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
816        if let Some(ref val) = self.dbtr_agt_acct
817            && config.validate_optional_fields
818        {
819            val.validate(&helpers::child_path(path, "DbtrAgtAcct"), config, collector);
820        }
821        if let Some(ref val) = self.prvs_instg_agt1
822            && config.validate_optional_fields
823        {
824            val.validate(
825                &helpers::child_path(path, "PrvsInstgAgt1"),
826                config,
827                collector,
828            );
829        }
830        if let Some(ref val) = self.prvs_instg_agt1_acct
831            && config.validate_optional_fields
832        {
833            val.validate(
834                &helpers::child_path(path, "PrvsInstgAgt1Acct"),
835                config,
836                collector,
837            );
838        }
839        if let Some(ref val) = self.prvs_instg_agt2
840            && config.validate_optional_fields
841        {
842            val.validate(
843                &helpers::child_path(path, "PrvsInstgAgt2"),
844                config,
845                collector,
846            );
847        }
848        if let Some(ref val) = self.prvs_instg_agt2_acct
849            && config.validate_optional_fields
850        {
851            val.validate(
852                &helpers::child_path(path, "PrvsInstgAgt2Acct"),
853                config,
854                collector,
855            );
856        }
857        if let Some(ref val) = self.prvs_instg_agt3
858            && config.validate_optional_fields
859        {
860            val.validate(
861                &helpers::child_path(path, "PrvsInstgAgt3"),
862                config,
863                collector,
864            );
865        }
866        if let Some(ref val) = self.prvs_instg_agt3_acct
867            && config.validate_optional_fields
868        {
869            val.validate(
870                &helpers::child_path(path, "PrvsInstgAgt3Acct"),
871                config,
872                collector,
873            );
874        }
875        if let Some(ref val) = self.intrmy_agt1
876            && config.validate_optional_fields
877        {
878            val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
879        }
880        if let Some(ref val) = self.intrmy_agt1_acct
881            && config.validate_optional_fields
882        {
883            val.validate(
884                &helpers::child_path(path, "IntrmyAgt1Acct"),
885                config,
886                collector,
887            );
888        }
889        if let Some(ref val) = self.intrmy_agt2
890            && config.validate_optional_fields
891        {
892            val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
893        }
894        if let Some(ref val) = self.intrmy_agt2_acct
895            && config.validate_optional_fields
896        {
897            val.validate(
898                &helpers::child_path(path, "IntrmyAgt2Acct"),
899                config,
900                collector,
901            );
902        }
903        if let Some(ref val) = self.intrmy_agt3
904            && config.validate_optional_fields
905        {
906            val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
907        }
908        if let Some(ref val) = self.intrmy_agt3_acct
909            && config.validate_optional_fields
910        {
911            val.validate(
912                &helpers::child_path(path, "IntrmyAgt3Acct"),
913                config,
914                collector,
915            );
916        }
917        self.cdtr_agt
918            .validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
919        if let Some(ref val) = self.cdtr_agt_acct
920            && config.validate_optional_fields
921        {
922            val.validate(&helpers::child_path(path, "CdtrAgtAcct"), config, collector);
923        }
924        self.cdtr
925            .validate(&helpers::child_path(path, "Cdtr"), config, collector);
926        if let Some(ref val) = self.cdtr_acct
927            && config.validate_optional_fields
928        {
929            val.validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
930        }
931        if let Some(ref val) = self.ultmt_cdtr
932            && config.validate_optional_fields
933        {
934            val.validate(&helpers::child_path(path, "UltmtCdtr"), config, collector);
935        }
936        if let Some(ref vec) = self.instr_for_cdtr_agt
937            && config.validate_optional_fields
938        {
939            for item in vec {
940                item.validate(
941                    &helpers::child_path(path, "InstrForCdtrAgt"),
942                    config,
943                    collector,
944                );
945            }
946        }
947        if let Some(ref vec) = self.instr_for_nxt_agt
948            && config.validate_optional_fields
949        {
950            for item in vec {
951                item.validate(
952                    &helpers::child_path(path, "InstrForNxtAgt"),
953                    config,
954                    collector,
955                );
956            }
957        }
958        if let Some(ref val) = self.rmt_inf
959            && config.validate_optional_fields
960        {
961            val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
962        }
963        if let Some(ref val) = self.instd_amt
964            && config.validate_optional_fields
965        {
966            val.validate(&helpers::child_path(path, "InstdAmt"), config, collector);
967        }
968    }
969}
970
971// CreditorReferenceInformation21: Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction.
972//
973// 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.
974//
975// 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.
976#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
977pub struct CreditorReferenceInformation21 {
978    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
979    pub tp: Option<CreditorReferenceType21>,
980    #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
981    pub ref_attr: Option<String>,
982}
983
984impl Validate for CreditorReferenceInformation21 {
985    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
986        if let Some(ref val) = self.tp
987            && config.validate_optional_fields
988        {
989            val.validate(&helpers::child_path(path, "Tp"), config, collector);
990        }
991        if let Some(ref val) = self.ref_attr {
992            helpers::validate_length(
993                val,
994                "Ref",
995                Some(1),
996                Some(35),
997                &helpers::child_path(path, "Ref"),
998                config,
999                collector,
1000            );
1001        }
1002        if let Some(ref val) = self.ref_attr {
1003            helpers::validate_pattern(
1004                val,
1005                "Ref",
1006                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1007                &helpers::child_path(path, "Ref"),
1008                config,
1009                collector,
1010            );
1011        }
1012    }
1013}
1014
1015// CreditorReferenceType1Choice1: Creditor reference type, in a proprietary form.
1016#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1017pub struct CreditorReferenceType1Choice1 {
1018    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1019    pub cd: Option<DocumentType3Code>,
1020    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1021    pub prtry: Option<String>,
1022}
1023
1024impl Validate for CreditorReferenceType1Choice1 {
1025    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1026        if let Some(ref val) = self.cd
1027            && config.validate_optional_fields
1028        {
1029            val.validate(&helpers::child_path(path, "Cd"), config, collector);
1030        }
1031        if let Some(ref val) = self.prtry {
1032            helpers::validate_length(
1033                val,
1034                "Prtry",
1035                Some(1),
1036                Some(35),
1037                &helpers::child_path(path, "Prtry"),
1038                config,
1039                collector,
1040            );
1041        }
1042        if let Some(ref val) = self.prtry {
1043            helpers::validate_pattern(
1044                val,
1045                "Prtry",
1046                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1047                &helpers::child_path(path, "Prtry"),
1048                config,
1049                collector,
1050            );
1051        }
1052    }
1053}
1054
1055// CreditorReferenceType21: Entity that assigns the credit reference type.
1056#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1057pub struct CreditorReferenceType21 {
1058    #[serde(rename = "CdOrPrtry")]
1059    pub cd_or_prtry: CreditorReferenceType1Choice1,
1060    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1061    pub issr: Option<String>,
1062}
1063
1064impl Validate for CreditorReferenceType21 {
1065    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1066        self.cd_or_prtry
1067            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
1068        if let Some(ref val) = self.issr {
1069            helpers::validate_length(
1070                val,
1071                "Issr",
1072                Some(1),
1073                Some(35),
1074                &helpers::child_path(path, "Issr"),
1075                config,
1076                collector,
1077            );
1078        }
1079        if let Some(ref val) = self.issr {
1080            helpers::validate_pattern(
1081                val,
1082                "Issr",
1083                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1084                &helpers::child_path(path, "Issr"),
1085                config,
1086                collector,
1087            );
1088        }
1089    }
1090}
1091
1092// DateAndPlaceOfBirth11: Country where a person was born.
1093#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1094pub struct DateAndPlaceOfBirth11 {
1095    #[serde(rename = "BirthDt")]
1096    pub birth_dt: String,
1097    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
1098    pub prvc_of_birth: Option<String>,
1099    #[serde(rename = "CityOfBirth")]
1100    pub city_of_birth: String,
1101    #[serde(rename = "CtryOfBirth")]
1102    pub ctry_of_birth: String,
1103}
1104
1105impl Validate for DateAndPlaceOfBirth11 {
1106    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1107        if let Some(ref val) = self.prvc_of_birth {
1108            helpers::validate_length(
1109                val,
1110                "PrvcOfBirth",
1111                Some(1),
1112                Some(35),
1113                &helpers::child_path(path, "PrvcOfBirth"),
1114                config,
1115                collector,
1116            );
1117        }
1118        if let Some(ref val) = self.prvc_of_birth {
1119            helpers::validate_pattern(
1120                val,
1121                "PrvcOfBirth",
1122                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1123                &helpers::child_path(path, "PrvcOfBirth"),
1124                config,
1125                collector,
1126            );
1127        }
1128        helpers::validate_length(
1129            &self.city_of_birth,
1130            "CityOfBirth",
1131            Some(1),
1132            Some(35),
1133            &helpers::child_path(path, "CityOfBirth"),
1134            config,
1135            collector,
1136        );
1137        helpers::validate_pattern(
1138            &self.city_of_birth,
1139            "CityOfBirth",
1140            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1141            &helpers::child_path(path, "CityOfBirth"),
1142            config,
1143            collector,
1144        );
1145        helpers::validate_pattern(
1146            &self.ctry_of_birth,
1147            "CtryOfBirth",
1148            "[A-Z]{2,2}",
1149            &helpers::child_path(path, "CtryOfBirth"),
1150            config,
1151            collector,
1152        );
1153    }
1154}
1155
1156// DatePeriod2: End date of the range.
1157#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1158pub struct DatePeriod2 {
1159    #[serde(rename = "FrDt")]
1160    pub fr_dt: String,
1161    #[serde(rename = "ToDt")]
1162    pub to_dt: String,
1163}
1164
1165impl Validate for DatePeriod2 {
1166    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
1167}
1168
1169// DiscountAmountAndType11: Amount of money, which has been typed.
1170#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1171pub struct DiscountAmountAndType11 {
1172    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1173    pub tp: Option<DiscountAmountType1Choice1>,
1174    #[serde(rename = "Amt")]
1175    pub amt: ActiveOrHistoricCurrencyAndAmount,
1176}
1177
1178impl Validate for DiscountAmountAndType11 {
1179    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1180        if let Some(ref val) = self.tp
1181            && config.validate_optional_fields
1182        {
1183            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1184        }
1185        self.amt
1186            .validate(&helpers::child_path(path, "Amt"), config, collector);
1187    }
1188}
1189
1190// DiscountAmountType1Choice1: Specifies the amount type, in a free-text form.
1191#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1192pub struct DiscountAmountType1Choice1 {
1193    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1194    pub cd: Option<String>,
1195    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1196    pub prtry: Option<String>,
1197}
1198
1199impl Validate for DiscountAmountType1Choice1 {
1200    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1201        if let Some(ref val) = self.cd {
1202            helpers::validate_length(
1203                val,
1204                "Cd",
1205                Some(1),
1206                Some(4),
1207                &helpers::child_path(path, "Cd"),
1208                config,
1209                collector,
1210            );
1211        }
1212        if let Some(ref val) = self.prtry {
1213            helpers::validate_length(
1214                val,
1215                "Prtry",
1216                Some(1),
1217                Some(35),
1218                &helpers::child_path(path, "Prtry"),
1219                config,
1220                collector,
1221            );
1222        }
1223        if let Some(ref val) = self.prtry {
1224            helpers::validate_pattern(
1225                val,
1226                "Prtry",
1227                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1228                &helpers::child_path(path, "Prtry"),
1229                config,
1230                collector,
1231            );
1232        }
1233    }
1234}
1235
1236// DocumentAdjustment11: Provides further details on the document adjustment.
1237#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1238pub struct DocumentAdjustment11 {
1239    #[serde(rename = "Amt")]
1240    pub amt: ActiveOrHistoricCurrencyAndAmount,
1241    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
1242    pub cdt_dbt_ind: Option<CreditDebitCode>,
1243    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
1244    pub rsn: Option<String>,
1245    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
1246    pub addtl_inf: Option<String>,
1247}
1248
1249impl Validate for DocumentAdjustment11 {
1250    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1251        self.amt
1252            .validate(&helpers::child_path(path, "Amt"), config, collector);
1253        if let Some(ref val) = self.cdt_dbt_ind
1254            && config.validate_optional_fields
1255        {
1256            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
1257        }
1258        if let Some(ref val) = self.rsn {
1259            helpers::validate_length(
1260                val,
1261                "Rsn",
1262                Some(1),
1263                Some(4),
1264                &helpers::child_path(path, "Rsn"),
1265                config,
1266                collector,
1267            );
1268        }
1269        if let Some(ref val) = self.rsn {
1270            helpers::validate_pattern(
1271                val,
1272                "Rsn",
1273                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1274                &helpers::child_path(path, "Rsn"),
1275                config,
1276                collector,
1277            );
1278        }
1279        if let Some(ref val) = self.addtl_inf {
1280            helpers::validate_length(
1281                val,
1282                "AddtlInf",
1283                Some(1),
1284                Some(140),
1285                &helpers::child_path(path, "AddtlInf"),
1286                config,
1287                collector,
1288            );
1289        }
1290        if let Some(ref val) = self.addtl_inf {
1291            helpers::validate_pattern(
1292                val,
1293                "AddtlInf",
1294                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1295                &helpers::child_path(path, "AddtlInf"),
1296                config,
1297                collector,
1298            );
1299        }
1300    }
1301}
1302
1303// DocumentLineIdentification11: Date associated with the referred document line.
1304#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1305pub struct DocumentLineIdentification11 {
1306    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1307    pub tp: Option<DocumentLineType11>,
1308    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
1309    pub nb: Option<String>,
1310    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
1311    pub rltd_dt: Option<String>,
1312}
1313
1314impl Validate for DocumentLineIdentification11 {
1315    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1316        if let Some(ref val) = self.tp
1317            && config.validate_optional_fields
1318        {
1319            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1320        }
1321        if let Some(ref val) = self.nb {
1322            helpers::validate_length(
1323                val,
1324                "Nb",
1325                Some(1),
1326                Some(35),
1327                &helpers::child_path(path, "Nb"),
1328                config,
1329                collector,
1330            );
1331        }
1332        if let Some(ref val) = self.nb {
1333            helpers::validate_pattern(
1334                val,
1335                "Nb",
1336                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1337                &helpers::child_path(path, "Nb"),
1338                config,
1339                collector,
1340            );
1341        }
1342    }
1343}
1344
1345// DocumentLineInformation11: Provides details on the amounts of the document line.
1346#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1347pub struct DocumentLineInformation11 {
1348    #[serde(rename = "Id")]
1349    pub id: Vec<DocumentLineIdentification11>,
1350    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
1351    pub desc: Option<String>,
1352    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
1353    pub amt: Option<RemittanceAmount31>,
1354}
1355
1356impl Validate for DocumentLineInformation11 {
1357    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1358        for item in &self.id {
1359            item.validate(&helpers::child_path(path, "Id"), config, collector);
1360        }
1361        if let Some(ref val) = self.desc {
1362            helpers::validate_length(
1363                val,
1364                "Desc",
1365                Some(1),
1366                Some(35),
1367                &helpers::child_path(path, "Desc"),
1368                config,
1369                collector,
1370            );
1371        }
1372        if let Some(ref val) = self.desc {
1373            helpers::validate_pattern(
1374                val,
1375                "Desc",
1376                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1377                &helpers::child_path(path, "Desc"),
1378                config,
1379                collector,
1380            );
1381        }
1382        if let Some(ref val) = self.amt
1383            && config.validate_optional_fields
1384        {
1385            val.validate(&helpers::child_path(path, "Amt"), config, collector);
1386        }
1387    }
1388}
1389
1390// DocumentLineType1Choice1: Proprietary identification of the type of the remittance document.
1391#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1392pub struct DocumentLineType1Choice1 {
1393    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1394    pub cd: Option<String>,
1395    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1396    pub prtry: Option<String>,
1397}
1398
1399impl Validate for DocumentLineType1Choice1 {
1400    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1401        if let Some(ref val) = self.cd {
1402            helpers::validate_length(
1403                val,
1404                "Cd",
1405                Some(1),
1406                Some(4),
1407                &helpers::child_path(path, "Cd"),
1408                config,
1409                collector,
1410            );
1411        }
1412        if let Some(ref val) = self.prtry {
1413            helpers::validate_length(
1414                val,
1415                "Prtry",
1416                Some(1),
1417                Some(35),
1418                &helpers::child_path(path, "Prtry"),
1419                config,
1420                collector,
1421            );
1422        }
1423        if let Some(ref val) = self.prtry {
1424            helpers::validate_pattern(
1425                val,
1426                "Prtry",
1427                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1428                &helpers::child_path(path, "Prtry"),
1429                config,
1430                collector,
1431            );
1432        }
1433    }
1434}
1435
1436// DocumentLineType11: Identification of the issuer of the reference document line identificationtype.
1437#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1438pub struct DocumentLineType11 {
1439    #[serde(rename = "CdOrPrtry")]
1440    pub cd_or_prtry: DocumentLineType1Choice1,
1441    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1442    pub issr: Option<String>,
1443}
1444
1445impl Validate for DocumentLineType11 {
1446    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1447        self.cd_or_prtry
1448            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
1449        if let Some(ref val) = self.issr {
1450            helpers::validate_length(
1451                val,
1452                "Issr",
1453                Some(1),
1454                Some(35),
1455                &helpers::child_path(path, "Issr"),
1456                config,
1457                collector,
1458            );
1459        }
1460        if let Some(ref val) = self.issr {
1461            helpers::validate_pattern(
1462                val,
1463                "Issr",
1464                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1465                &helpers::child_path(path, "Issr"),
1466                config,
1467                collector,
1468            );
1469        }
1470    }
1471}
1472
1473// DocumentType3Code: Document is a structured communication reference provided by the creditor to identify the referred transaction.
1474#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1475pub enum DocumentType3Code {
1476    #[default]
1477    #[serde(rename = "RADM")]
1478    CodeRADM,
1479    #[serde(rename = "RPIN")]
1480    CodeRPIN,
1481    #[serde(rename = "FXDR")]
1482    CodeFXDR,
1483    #[serde(rename = "DISP")]
1484    CodeDISP,
1485    #[serde(rename = "PUOR")]
1486    CodePUOR,
1487    #[serde(rename = "SCOR")]
1488    CodeSCOR,
1489}
1490
1491impl Validate for DocumentType3Code {
1492    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1493        // Enum validation is typically empty
1494    }
1495}
1496
1497// DocumentType6Code: Document is a purchase order.
1498#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1499pub enum DocumentType6Code {
1500    #[default]
1501    #[serde(rename = "MSIN")]
1502    CodeMSIN,
1503    #[serde(rename = "CNFA")]
1504    CodeCNFA,
1505    #[serde(rename = "DNFA")]
1506    CodeDNFA,
1507    #[serde(rename = "CINV")]
1508    CodeCINV,
1509    #[serde(rename = "CREN")]
1510    CodeCREN,
1511    #[serde(rename = "DEBN")]
1512    CodeDEBN,
1513    #[serde(rename = "HIRI")]
1514    CodeHIRI,
1515    #[serde(rename = "SBIN")]
1516    CodeSBIN,
1517    #[serde(rename = "CMCN")]
1518    CodeCMCN,
1519    #[serde(rename = "SOAC")]
1520    CodeSOAC,
1521    #[serde(rename = "DISP")]
1522    CodeDISP,
1523    #[serde(rename = "BOLD")]
1524    CodeBOLD,
1525    #[serde(rename = "VCHR")]
1526    CodeVCHR,
1527    #[serde(rename = "AROI")]
1528    CodeAROI,
1529    #[serde(rename = "TSUT")]
1530    CodeTSUT,
1531    #[serde(rename = "PUOR")]
1532    CodePUOR,
1533}
1534
1535impl Validate for DocumentType6Code {
1536    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1537        // Enum validation is typically empty
1538    }
1539}
1540
1541// FinancialInstitutionCreditTransferV08: Set of elements providing information specific to the individual credit transfer(s).
1542#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1543pub struct FinancialInstitutionCreditTransferV08 {
1544    #[serde(rename = "GrpHdr")]
1545    pub grp_hdr: GroupHeader931,
1546    #[serde(rename = "CdtTrfTxInf")]
1547    pub cdt_trf_tx_inf: CreditTransferTransaction361,
1548}
1549
1550impl Validate for FinancialInstitutionCreditTransferV08 {
1551    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1552        self.grp_hdr
1553            .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
1554        self.cdt_trf_tx_inf
1555            .validate(&helpers::child_path(path, "CdtTrfTxInf"), config, collector);
1556    }
1557}
1558
1559// FinancialInstitutionIdentification181: Information that locates and identifies a specific address, as defined by postal services.
1560#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1561pub struct FinancialInstitutionIdentification181 {
1562    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1563    pub bicfi: Option<String>,
1564    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1565    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1566    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1567    pub lei: Option<String>,
1568    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1569    pub nm: Option<String>,
1570    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1571    pub pstl_adr: Option<PostalAddress241>,
1572}
1573
1574impl Validate for FinancialInstitutionIdentification181 {
1575    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1576        if let Some(ref val) = self.bicfi {
1577            helpers::validate_pattern(
1578                val,
1579                "BICFI",
1580                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1581                &helpers::child_path(path, "BICFI"),
1582                config,
1583                collector,
1584            );
1585        }
1586        if let Some(ref val) = self.clr_sys_mmb_id
1587            && config.validate_optional_fields
1588        {
1589            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
1590        }
1591        if let Some(ref val) = self.lei {
1592            helpers::validate_pattern(
1593                val,
1594                "LEI",
1595                "[A-Z0-9]{18,18}[0-9]{2,2}",
1596                &helpers::child_path(path, "LEI"),
1597                config,
1598                collector,
1599            );
1600        }
1601        if let Some(ref val) = self.nm {
1602            helpers::validate_length(
1603                val,
1604                "Nm",
1605                Some(1),
1606                Some(140),
1607                &helpers::child_path(path, "Nm"),
1608                config,
1609                collector,
1610            );
1611        }
1612        if let Some(ref val) = self.nm {
1613            helpers::validate_pattern(
1614                val,
1615                "Nm",
1616                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1617                &helpers::child_path(path, "Nm"),
1618                config,
1619                collector,
1620            );
1621        }
1622        if let Some(ref val) = self.pstl_adr
1623            && config.validate_optional_fields
1624        {
1625            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1626        }
1627    }
1628}
1629
1630// FinancialInstitutionIdentification182: Legal entity identifier of the financial institution.
1631#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1632pub struct FinancialInstitutionIdentification182 {
1633    #[serde(rename = "BICFI")]
1634    pub bicfi: String,
1635    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1636    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1637    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1638    pub lei: Option<String>,
1639}
1640
1641impl Validate for FinancialInstitutionIdentification182 {
1642    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1643        helpers::validate_pattern(
1644            &self.bicfi,
1645            "BICFI",
1646            "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1647            &helpers::child_path(path, "BICFI"),
1648            config,
1649            collector,
1650        );
1651        if let Some(ref val) = self.clr_sys_mmb_id
1652            && config.validate_optional_fields
1653        {
1654            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
1655        }
1656        if let Some(ref val) = self.lei {
1657            helpers::validate_pattern(
1658                val,
1659                "LEI",
1660                "[A-Z0-9]{18,18}[0-9]{2,2}",
1661                &helpers::child_path(path, "LEI"),
1662                config,
1663                collector,
1664            );
1665        }
1666    }
1667}
1668
1669// Garnishment31: Indicates if the employment of the person to whom the garnishment applies (that is, the ultimate debtor) has been terminated.
1670#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1671pub struct Garnishment31 {
1672    #[serde(rename = "Tp")]
1673    pub tp: GarnishmentType11,
1674    #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
1675    pub grnshee: Option<PartyIdentification1354>,
1676    #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
1677    pub grnshmt_admstr: Option<PartyIdentification1354>,
1678    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
1679    pub ref_nb: Option<String>,
1680    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
1681    pub dt: Option<String>,
1682    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
1683    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
1684    #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
1685    pub fmly_mdcl_insrnc_ind: Option<bool>,
1686    #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
1687    pub mplyee_termntn_ind: Option<bool>,
1688}
1689
1690impl Validate for Garnishment31 {
1691    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1692        self.tp
1693            .validate(&helpers::child_path(path, "Tp"), config, collector);
1694        if let Some(ref val) = self.grnshee
1695            && config.validate_optional_fields
1696        {
1697            val.validate(&helpers::child_path(path, "Grnshee"), config, collector);
1698        }
1699        if let Some(ref val) = self.grnshmt_admstr
1700            && config.validate_optional_fields
1701        {
1702            val.validate(
1703                &helpers::child_path(path, "GrnshmtAdmstr"),
1704                config,
1705                collector,
1706            );
1707        }
1708        if let Some(ref val) = self.ref_nb {
1709            helpers::validate_length(
1710                val,
1711                "RefNb",
1712                Some(1),
1713                Some(140),
1714                &helpers::child_path(path, "RefNb"),
1715                config,
1716                collector,
1717            );
1718        }
1719        if let Some(ref val) = self.ref_nb {
1720            helpers::validate_pattern(
1721                val,
1722                "RefNb",
1723                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1724                &helpers::child_path(path, "RefNb"),
1725                config,
1726                collector,
1727            );
1728        }
1729        if let Some(ref val) = self.rmtd_amt
1730            && config.validate_optional_fields
1731        {
1732            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
1733        }
1734    }
1735}
1736
1737// GarnishmentType1Choice1: Proprietary identification of the type of garnishment.
1738#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1739pub struct GarnishmentType1Choice1 {
1740    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1741    pub cd: Option<String>,
1742    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1743    pub prtry: Option<String>,
1744}
1745
1746impl Validate for GarnishmentType1Choice1 {
1747    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1748        if let Some(ref val) = self.cd {
1749            helpers::validate_length(
1750                val,
1751                "Cd",
1752                Some(1),
1753                Some(4),
1754                &helpers::child_path(path, "Cd"),
1755                config,
1756                collector,
1757            );
1758        }
1759        if let Some(ref val) = self.prtry {
1760            helpers::validate_length(
1761                val,
1762                "Prtry",
1763                Some(1),
1764                Some(35),
1765                &helpers::child_path(path, "Prtry"),
1766                config,
1767                collector,
1768            );
1769        }
1770        if let Some(ref val) = self.prtry {
1771            helpers::validate_pattern(
1772                val,
1773                "Prtry",
1774                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1775                &helpers::child_path(path, "Prtry"),
1776                config,
1777                collector,
1778            );
1779        }
1780    }
1781}
1782
1783// GarnishmentType11: Identification of the issuer of the garnishment type.
1784#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1785pub struct GarnishmentType11 {
1786    #[serde(rename = "CdOrPrtry")]
1787    pub cd_or_prtry: GarnishmentType1Choice1,
1788    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1789    pub issr: Option<String>,
1790}
1791
1792impl Validate for GarnishmentType11 {
1793    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1794        self.cd_or_prtry
1795            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
1796        if let Some(ref val) = self.issr {
1797            helpers::validate_length(
1798                val,
1799                "Issr",
1800                Some(1),
1801                Some(35),
1802                &helpers::child_path(path, "Issr"),
1803                config,
1804                collector,
1805            );
1806        }
1807        if let Some(ref val) = self.issr {
1808            helpers::validate_pattern(
1809                val,
1810                "Issr",
1811                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1812                &helpers::child_path(path, "Issr"),
1813                config,
1814                collector,
1815            );
1816        }
1817    }
1818}
1819
1820// GenericAccountIdentification11: Entity that assigns the identification.
1821#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1822pub struct GenericAccountIdentification11 {
1823    #[serde(rename = "Id")]
1824    pub id: String,
1825    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
1826    pub schme_nm: Option<AccountSchemeName1Choice1>,
1827    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1828    pub issr: Option<String>,
1829}
1830
1831impl Validate for GenericAccountIdentification11 {
1832    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1833        helpers::validate_length(
1834            &self.id,
1835            "Id",
1836            Some(1),
1837            Some(34),
1838            &helpers::child_path(path, "Id"),
1839            config,
1840            collector,
1841        );
1842        helpers::validate_pattern(
1843            &self.id,
1844            "Id",
1845            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
1846            &helpers::child_path(path, "Id"),
1847            config,
1848            collector,
1849        );
1850        if let Some(ref val) = self.schme_nm
1851            && config.validate_optional_fields
1852        {
1853            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
1854        }
1855        if let Some(ref val) = self.issr {
1856            helpers::validate_length(
1857                val,
1858                "Issr",
1859                Some(1),
1860                Some(35),
1861                &helpers::child_path(path, "Issr"),
1862                config,
1863                collector,
1864            );
1865        }
1866        if let Some(ref val) = self.issr {
1867            helpers::validate_pattern(
1868                val,
1869                "Issr",
1870                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1871                &helpers::child_path(path, "Issr"),
1872                config,
1873                collector,
1874            );
1875        }
1876    }
1877}
1878
1879// GenericOrganisationIdentification11: Entity that assigns the identification.
1880#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1881pub struct GenericOrganisationIdentification11 {
1882    #[serde(rename = "Id")]
1883    pub id: String,
1884    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
1885    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
1886    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1887    pub issr: Option<String>,
1888}
1889
1890impl Validate for GenericOrganisationIdentification11 {
1891    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1892        helpers::validate_length(
1893            &self.id,
1894            "Id",
1895            Some(1),
1896            Some(35),
1897            &helpers::child_path(path, "Id"),
1898            config,
1899            collector,
1900        );
1901        helpers::validate_pattern(
1902            &self.id,
1903            "Id",
1904            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1905            &helpers::child_path(path, "Id"),
1906            config,
1907            collector,
1908        );
1909        if let Some(ref val) = self.schme_nm
1910            && config.validate_optional_fields
1911        {
1912            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
1913        }
1914        if let Some(ref val) = self.issr {
1915            helpers::validate_length(
1916                val,
1917                "Issr",
1918                Some(1),
1919                Some(35),
1920                &helpers::child_path(path, "Issr"),
1921                config,
1922                collector,
1923            );
1924        }
1925        if let Some(ref val) = self.issr {
1926            helpers::validate_pattern(
1927                val,
1928                "Issr",
1929                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1930                &helpers::child_path(path, "Issr"),
1931                config,
1932                collector,
1933            );
1934        }
1935    }
1936}
1937
1938// GenericOrganisationIdentification12: Entity that assigns the identification.
1939#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1940pub struct GenericOrganisationIdentification12 {
1941    #[serde(rename = "Id")]
1942    pub id: String,
1943    #[serde(rename = "SchmeNm")]
1944    pub schme_nm: OrganisationIdentificationSchemeName1Choice2,
1945    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1946    pub issr: Option<String>,
1947}
1948
1949impl Validate for GenericOrganisationIdentification12 {
1950    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1951        helpers::validate_length(
1952            &self.id,
1953            "Id",
1954            Some(1),
1955            Some(35),
1956            &helpers::child_path(path, "Id"),
1957            config,
1958            collector,
1959        );
1960        helpers::validate_pattern(
1961            &self.id,
1962            "Id",
1963            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1964            &helpers::child_path(path, "Id"),
1965            config,
1966            collector,
1967        );
1968        self.schme_nm
1969            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
1970        if let Some(ref val) = self.issr {
1971            helpers::validate_length(
1972                val,
1973                "Issr",
1974                Some(1),
1975                Some(35),
1976                &helpers::child_path(path, "Issr"),
1977                config,
1978                collector,
1979            );
1980        }
1981        if let Some(ref val) = self.issr {
1982            helpers::validate_pattern(
1983                val,
1984                "Issr",
1985                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1986                &helpers::child_path(path, "Issr"),
1987                config,
1988                collector,
1989            );
1990        }
1991    }
1992}
1993
1994// GenericOrganisationIdentification13: Entity that assigns the identification.
1995#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1996pub struct GenericOrganisationIdentification13 {
1997    #[serde(rename = "Id")]
1998    pub id: String,
1999    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2000    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice3>,
2001    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2002    pub issr: Option<String>,
2003}
2004
2005impl Validate for GenericOrganisationIdentification13 {
2006    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2007        helpers::validate_length(
2008            &self.id,
2009            "Id",
2010            Some(1),
2011            Some(35),
2012            &helpers::child_path(path, "Id"),
2013            config,
2014            collector,
2015        );
2016        helpers::validate_pattern(
2017            &self.id,
2018            "Id",
2019            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2020            &helpers::child_path(path, "Id"),
2021            config,
2022            collector,
2023        );
2024        if let Some(ref val) = self.schme_nm
2025            && config.validate_optional_fields
2026        {
2027            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2028        }
2029        if let Some(ref val) = self.issr {
2030            helpers::validate_length(
2031                val,
2032                "Issr",
2033                Some(1),
2034                Some(35),
2035                &helpers::child_path(path, "Issr"),
2036                config,
2037                collector,
2038            );
2039        }
2040        if let Some(ref val) = self.issr {
2041            helpers::validate_pattern(
2042                val,
2043                "Issr",
2044                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2045                &helpers::child_path(path, "Issr"),
2046                config,
2047                collector,
2048            );
2049        }
2050    }
2051}
2052
2053// GenericPersonIdentification11: Entity that assigns the identification.
2054#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2055pub struct GenericPersonIdentification11 {
2056    #[serde(rename = "Id")]
2057    pub id: String,
2058    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2059    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
2060    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2061    pub issr: Option<String>,
2062}
2063
2064impl Validate for GenericPersonIdentification11 {
2065    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2066        helpers::validate_length(
2067            &self.id,
2068            "Id",
2069            Some(1),
2070            Some(35),
2071            &helpers::child_path(path, "Id"),
2072            config,
2073            collector,
2074        );
2075        helpers::validate_pattern(
2076            &self.id,
2077            "Id",
2078            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2079            &helpers::child_path(path, "Id"),
2080            config,
2081            collector,
2082        );
2083        if let Some(ref val) = self.schme_nm
2084            && config.validate_optional_fields
2085        {
2086            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2087        }
2088        if let Some(ref val) = self.issr {
2089            helpers::validate_length(
2090                val,
2091                "Issr",
2092                Some(1),
2093                Some(35),
2094                &helpers::child_path(path, "Issr"),
2095                config,
2096                collector,
2097            );
2098        }
2099        if let Some(ref val) = self.issr {
2100            helpers::validate_pattern(
2101                val,
2102                "Issr",
2103                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2104                &helpers::child_path(path, "Issr"),
2105                config,
2106                collector,
2107            );
2108        }
2109    }
2110}
2111
2112// GenericPersonIdentification12: Entity that assigns the identification.
2113#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2114pub struct GenericPersonIdentification12 {
2115    #[serde(rename = "Id")]
2116    pub id: String,
2117    #[serde(rename = "SchmeNm")]
2118    pub schme_nm: PersonIdentificationSchemeName1Choice2,
2119    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2120    pub issr: Option<String>,
2121}
2122
2123impl Validate for GenericPersonIdentification12 {
2124    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2125        helpers::validate_length(
2126            &self.id,
2127            "Id",
2128            Some(1),
2129            Some(35),
2130            &helpers::child_path(path, "Id"),
2131            config,
2132            collector,
2133        );
2134        helpers::validate_pattern(
2135            &self.id,
2136            "Id",
2137            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2138            &helpers::child_path(path, "Id"),
2139            config,
2140            collector,
2141        );
2142        self.schme_nm
2143            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2144        if let Some(ref val) = self.issr {
2145            helpers::validate_length(
2146                val,
2147                "Issr",
2148                Some(1),
2149                Some(35),
2150                &helpers::child_path(path, "Issr"),
2151                config,
2152                collector,
2153            );
2154        }
2155        if let Some(ref val) = self.issr {
2156            helpers::validate_pattern(
2157                val,
2158                "Issr",
2159                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2160                &helpers::child_path(path, "Issr"),
2161                config,
2162                collector,
2163            );
2164        }
2165    }
2166}
2167
2168// GenericPersonIdentification13: Entity that assigns the identification.
2169#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2170pub struct GenericPersonIdentification13 {
2171    #[serde(rename = "Id")]
2172    pub id: String,
2173    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2174    pub schme_nm: Option<PersonIdentificationSchemeName1Choice3>,
2175    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2176    pub issr: Option<String>,
2177}
2178
2179impl Validate for GenericPersonIdentification13 {
2180    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2181        helpers::validate_length(
2182            &self.id,
2183            "Id",
2184            Some(1),
2185            Some(35),
2186            &helpers::child_path(path, "Id"),
2187            config,
2188            collector,
2189        );
2190        helpers::validate_pattern(
2191            &self.id,
2192            "Id",
2193            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2194            &helpers::child_path(path, "Id"),
2195            config,
2196            collector,
2197        );
2198        if let Some(ref val) = self.schme_nm
2199            && config.validate_optional_fields
2200        {
2201            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
2202        }
2203        if let Some(ref val) = self.issr {
2204            helpers::validate_length(
2205                val,
2206                "Issr",
2207                Some(1),
2208                Some(35),
2209                &helpers::child_path(path, "Issr"),
2210                config,
2211                collector,
2212            );
2213        }
2214        if let Some(ref val) = self.issr {
2215            helpers::validate_pattern(
2216                val,
2217                "Issr",
2218                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2219                &helpers::child_path(path, "Issr"),
2220                config,
2221                collector,
2222            );
2223        }
2224    }
2225}
2226
2227// GroupHeader931: Specifies the details on how the settlement of the transaction(s) between the instructing agent and the instructed agent is completed.
2228#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2229pub struct GroupHeader931 {
2230    #[serde(rename = "MsgId")]
2231    pub msg_id: String,
2232    #[serde(rename = "CreDtTm")]
2233    pub cre_dt_tm: String,
2234    #[serde(rename = "NbOfTxs")]
2235    pub nb_of_txs: Max15NumericTextfixed,
2236    #[serde(rename = "SttlmInf")]
2237    pub sttlm_inf: SettlementInstruction71,
2238}
2239
2240impl Validate for GroupHeader931 {
2241    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2242        helpers::validate_length(
2243            &self.msg_id,
2244            "MsgId",
2245            Some(1),
2246            Some(35),
2247            &helpers::child_path(path, "MsgId"),
2248            config,
2249            collector,
2250        );
2251        helpers::validate_pattern(
2252            &self.msg_id,
2253            "MsgId",
2254            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2255            &helpers::child_path(path, "MsgId"),
2256            config,
2257            collector,
2258        );
2259        helpers::validate_pattern(
2260            &self.cre_dt_tm,
2261            "CreDtTm",
2262            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
2263            &helpers::child_path(path, "CreDtTm"),
2264            config,
2265            collector,
2266        );
2267        self.nb_of_txs
2268            .validate(&helpers::child_path(path, "NbOfTxs"), config, collector);
2269        self.sttlm_inf
2270            .validate(&helpers::child_path(path, "SttlmInf"), config, collector);
2271    }
2272}
2273
2274// Instruction5Code: Please advise/contact (ultimate) creditor/claimant by the most efficient means of telecommunication.
2275#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2276pub enum Instruction5Code {
2277    #[default]
2278    #[serde(rename = "PHOB")]
2279    CodePHOB,
2280    #[serde(rename = "TELB")]
2281    CodeTELB,
2282}
2283
2284impl Validate for Instruction5Code {
2285    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2286        // Enum validation is typically empty
2287    }
2288}
2289
2290// InstructionForCreditorAgent11: Further information complementing the coded instruction or instruction to the creditor's agent that is bilaterally agreed or specific to a user community.
2291#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2292pub struct InstructionForCreditorAgent11 {
2293    #[serde(rename = "InstrInf", skip_serializing_if = "Option::is_none")]
2294    pub instr_inf: Option<String>,
2295}
2296
2297impl Validate for InstructionForCreditorAgent11 {
2298    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2299        if let Some(ref val) = self.instr_inf {
2300            helpers::validate_length(
2301                val,
2302                "InstrInf",
2303                Some(1),
2304                Some(140),
2305                &helpers::child_path(path, "InstrInf"),
2306                config,
2307                collector,
2308            );
2309        }
2310        if let Some(ref val) = self.instr_inf {
2311            helpers::validate_pattern(
2312                val,
2313                "InstrInf",
2314                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2315                &helpers::child_path(path, "InstrInf"),
2316                config,
2317                collector,
2318            );
2319        }
2320    }
2321}
2322
2323// InstructionForCreditorAgent21: Further information complementing the coded instruction or instruction to the creditor's agent that is bilaterally agreed or specific to a user community.
2324#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2325pub struct InstructionForCreditorAgent21 {
2326    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2327    pub cd: Option<Instruction5Code>,
2328    #[serde(rename = "InstrInf", skip_serializing_if = "Option::is_none")]
2329    pub instr_inf: Option<String>,
2330}
2331
2332impl Validate for InstructionForCreditorAgent21 {
2333    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2334        if let Some(ref val) = self.cd
2335            && config.validate_optional_fields
2336        {
2337            val.validate(&helpers::child_path(path, "Cd"), config, collector);
2338        }
2339        if let Some(ref val) = self.instr_inf {
2340            helpers::validate_length(
2341                val,
2342                "InstrInf",
2343                Some(1),
2344                Some(140),
2345                &helpers::child_path(path, "InstrInf"),
2346                config,
2347                collector,
2348            );
2349        }
2350        if let Some(ref val) = self.instr_inf {
2351            helpers::validate_pattern(
2352                val,
2353                "InstrInf",
2354                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2355                &helpers::child_path(path, "InstrInf"),
2356                config,
2357                collector,
2358            );
2359        }
2360    }
2361}
2362
2363// InstructionForNextAgent11: Further information complementing the coded instruction or instruction to the next agent that is bilaterally agreed or specific to a user community.
2364#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2365pub struct InstructionForNextAgent11 {
2366    #[serde(rename = "InstrInf", skip_serializing_if = "Option::is_none")]
2367    pub instr_inf: Option<String>,
2368}
2369
2370impl Validate for InstructionForNextAgent11 {
2371    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2372        if let Some(ref val) = self.instr_inf {
2373            helpers::validate_length(
2374                val,
2375                "InstrInf",
2376                Some(1),
2377                Some(35),
2378                &helpers::child_path(path, "InstrInf"),
2379                config,
2380                collector,
2381            );
2382        }
2383        if let Some(ref val) = self.instr_inf {
2384            helpers::validate_pattern(
2385                val,
2386                "InstrInf",
2387                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2388                &helpers::child_path(path, "InstrInf"),
2389                config,
2390                collector,
2391            );
2392        }
2393    }
2394}
2395
2396// LocalInstrument2Choice1: Specifies the local instrument, as a proprietary code.
2397#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2398pub struct LocalInstrument2Choice1 {
2399    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2400    pub cd: Option<String>,
2401    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2402    pub prtry: Option<String>,
2403}
2404
2405impl Validate for LocalInstrument2Choice1 {
2406    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2407        if let Some(ref val) = self.cd {
2408            helpers::validate_length(
2409                val,
2410                "Cd",
2411                Some(1),
2412                Some(35),
2413                &helpers::child_path(path, "Cd"),
2414                config,
2415                collector,
2416            );
2417        }
2418        if let Some(ref val) = self.prtry {
2419            helpers::validate_length(
2420                val,
2421                "Prtry",
2422                Some(1),
2423                Some(35),
2424                &helpers::child_path(path, "Prtry"),
2425                config,
2426                collector,
2427            );
2428        }
2429        if let Some(ref val) = self.prtry {
2430            helpers::validate_pattern(
2431                val,
2432                "Prtry",
2433                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2434                &helpers::child_path(path, "Prtry"),
2435                config,
2436                collector,
2437            );
2438        }
2439    }
2440}
2441
2442// Max15NumericText_fixed: 1
2443#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2444pub enum Max15NumericTextfixed {
2445    #[default]
2446    #[serde(rename = "1")]
2447    Code1,
2448}
2449
2450impl Validate for Max15NumericTextfixed {
2451    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2452        // Enum validation is typically empty
2453    }
2454}
2455
2456// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
2457#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2458pub struct OrganisationIdentification291 {
2459    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2460    pub any_bic: Option<String>,
2461    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2462    pub lei: Option<String>,
2463    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2464    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
2465}
2466
2467impl Validate for OrganisationIdentification291 {
2468    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2469        if let Some(ref val) = self.any_bic {
2470            helpers::validate_pattern(
2471                val,
2472                "AnyBIC",
2473                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
2474                &helpers::child_path(path, "AnyBIC"),
2475                config,
2476                collector,
2477            );
2478        }
2479        if let Some(ref val) = self.lei {
2480            helpers::validate_pattern(
2481                val,
2482                "LEI",
2483                "[A-Z0-9]{18,18}[0-9]{2,2}",
2484                &helpers::child_path(path, "LEI"),
2485                config,
2486                collector,
2487            );
2488        }
2489        if let Some(ref vec) = self.othr
2490            && config.validate_optional_fields
2491        {
2492            for item in vec {
2493                item.validate(&helpers::child_path(path, "Othr"), config, collector);
2494            }
2495        }
2496    }
2497}
2498
2499// OrganisationIdentification292: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
2500#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2501pub struct OrganisationIdentification292 {
2502    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2503    pub any_bic: Option<String>,
2504    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2505    pub lei: Option<String>,
2506    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2507    pub othr: Option<Vec<GenericOrganisationIdentification12>>,
2508}
2509
2510impl Validate for OrganisationIdentification292 {
2511    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2512        if let Some(ref val) = self.any_bic {
2513            helpers::validate_pattern(
2514                val,
2515                "AnyBIC",
2516                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
2517                &helpers::child_path(path, "AnyBIC"),
2518                config,
2519                collector,
2520            );
2521        }
2522        if let Some(ref val) = self.lei {
2523            helpers::validate_pattern(
2524                val,
2525                "LEI",
2526                "[A-Z0-9]{18,18}[0-9]{2,2}",
2527                &helpers::child_path(path, "LEI"),
2528                config,
2529                collector,
2530            );
2531        }
2532        if let Some(ref vec) = self.othr
2533            && config.validate_optional_fields
2534        {
2535            for item in vec {
2536                item.validate(&helpers::child_path(path, "Othr"), config, collector);
2537            }
2538        }
2539    }
2540}
2541
2542// OrganisationIdentification293: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
2543#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2544pub struct OrganisationIdentification293 {
2545    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2546    pub any_bic: Option<String>,
2547    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2548    pub lei: Option<String>,
2549    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2550    pub othr: Option<Vec<GenericOrganisationIdentification13>>,
2551}
2552
2553impl Validate for OrganisationIdentification293 {
2554    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2555        if let Some(ref val) = self.any_bic {
2556            helpers::validate_pattern(
2557                val,
2558                "AnyBIC",
2559                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
2560                &helpers::child_path(path, "AnyBIC"),
2561                config,
2562                collector,
2563            );
2564        }
2565        if let Some(ref val) = self.lei {
2566            helpers::validate_pattern(
2567                val,
2568                "LEI",
2569                "[A-Z0-9]{18,18}[0-9]{2,2}",
2570                &helpers::child_path(path, "LEI"),
2571                config,
2572                collector,
2573            );
2574        }
2575        if let Some(ref vec) = self.othr
2576            && config.validate_optional_fields
2577        {
2578            for item in vec {
2579                item.validate(&helpers::child_path(path, "Othr"), config, collector);
2580            }
2581        }
2582    }
2583}
2584
2585// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
2586#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2587pub struct OrganisationIdentificationSchemeName1Choice1 {
2588    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2589    pub cd: Option<String>,
2590    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2591    pub prtry: Option<String>,
2592}
2593
2594impl Validate for OrganisationIdentificationSchemeName1Choice1 {
2595    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2596        if let Some(ref val) = self.cd {
2597            helpers::validate_length(
2598                val,
2599                "Cd",
2600                Some(1),
2601                Some(4),
2602                &helpers::child_path(path, "Cd"),
2603                config,
2604                collector,
2605            );
2606        }
2607        if let Some(ref val) = self.prtry {
2608            helpers::validate_length(
2609                val,
2610                "Prtry",
2611                Some(1),
2612                Some(35),
2613                &helpers::child_path(path, "Prtry"),
2614                config,
2615                collector,
2616            );
2617        }
2618        if let Some(ref val) = self.prtry {
2619            helpers::validate_pattern(
2620                val,
2621                "Prtry",
2622                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2623                &helpers::child_path(path, "Prtry"),
2624                config,
2625                collector,
2626            );
2627        }
2628    }
2629}
2630
2631// OrganisationIdentificationSchemeName1Choice2: Name of the identification scheme, in a coded form as published in an external list.
2632#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2633pub struct OrganisationIdentificationSchemeName1Choice2 {
2634    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2635    pub cd: Option<String>,
2636}
2637
2638impl Validate for OrganisationIdentificationSchemeName1Choice2 {
2639    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2640        if let Some(ref val) = self.cd {
2641            helpers::validate_length(
2642                val,
2643                "Cd",
2644                Some(1),
2645                Some(4),
2646                &helpers::child_path(path, "Cd"),
2647                config,
2648                collector,
2649            );
2650        }
2651    }
2652}
2653
2654// OrganisationIdentificationSchemeName1Choice3: Name of the identification scheme, in a free text form.
2655#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2656pub struct OrganisationIdentificationSchemeName1Choice3 {
2657    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2658    pub cd: Option<String>,
2659    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2660    pub prtry: Option<String>,
2661}
2662
2663impl Validate for OrganisationIdentificationSchemeName1Choice3 {
2664    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2665        if let Some(ref val) = self.cd {
2666            helpers::validate_length(
2667                val,
2668                "Cd",
2669                Some(1),
2670                Some(4),
2671                &helpers::child_path(path, "Cd"),
2672                config,
2673                collector,
2674            );
2675        }
2676        if let Some(ref val) = self.prtry {
2677            helpers::validate_length(
2678                val,
2679                "Prtry",
2680                Some(1),
2681                Some(35),
2682                &helpers::child_path(path, "Prtry"),
2683                config,
2684                collector,
2685            );
2686        }
2687        if let Some(ref val) = self.prtry {
2688            helpers::validate_pattern(
2689                val,
2690                "Prtry",
2691                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2692                &helpers::child_path(path, "Prtry"),
2693                config,
2694                collector,
2695            );
2696        }
2697    }
2698}
2699
2700// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
2701#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2702pub struct Party38Choice1 {
2703    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
2704    pub org_id: Option<OrganisationIdentification291>,
2705    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
2706    pub prvt_id: Option<PersonIdentification131>,
2707}
2708
2709impl Validate for Party38Choice1 {
2710    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2711        if let Some(ref val) = self.org_id
2712            && config.validate_optional_fields
2713        {
2714            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
2715        }
2716        if let Some(ref val) = self.prvt_id
2717            && config.validate_optional_fields
2718        {
2719            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
2720        }
2721    }
2722}
2723
2724// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
2725#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2726pub struct Party38Choice2 {
2727    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
2728    pub org_id: Option<OrganisationIdentification292>,
2729    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
2730    pub prvt_id: Option<PersonIdentification132>,
2731}
2732
2733impl Validate for Party38Choice2 {
2734    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2735        if let Some(ref val) = self.org_id
2736            && config.validate_optional_fields
2737        {
2738            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
2739        }
2740        if let Some(ref val) = self.prvt_id
2741            && config.validate_optional_fields
2742        {
2743            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
2744        }
2745    }
2746}
2747
2748// Party38Choice3: Unique and unambiguous identification of a person, for example a passport.
2749#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2750pub struct Party38Choice3 {
2751    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
2752    pub org_id: Option<OrganisationIdentification293>,
2753    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
2754    pub prvt_id: Option<PersonIdentification133>,
2755}
2756
2757impl Validate for Party38Choice3 {
2758    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2759        if let Some(ref val) = self.org_id
2760            && config.validate_optional_fields
2761        {
2762            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
2763        }
2764        if let Some(ref val) = self.prvt_id
2765            && config.validate_optional_fields
2766        {
2767            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
2768        }
2769    }
2770}
2771
2772// 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.
2773#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2774pub struct PartyIdentification1351 {
2775    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2776    pub nm: Option<String>,
2777    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2778    pub pstl_adr: Option<PostalAddress242>,
2779    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2780    pub id: Option<Party38Choice1>,
2781    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2782    pub ctry_of_res: Option<String>,
2783}
2784
2785impl Validate for PartyIdentification1351 {
2786    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2787        if let Some(ref val) = self.nm {
2788            helpers::validate_length(
2789                val,
2790                "Nm",
2791                Some(1),
2792                Some(140),
2793                &helpers::child_path(path, "Nm"),
2794                config,
2795                collector,
2796            );
2797        }
2798        if let Some(ref val) = self.nm {
2799            helpers::validate_pattern(
2800                val,
2801                "Nm",
2802                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2803                &helpers::child_path(path, "Nm"),
2804                config,
2805                collector,
2806            );
2807        }
2808        if let Some(ref val) = self.pstl_adr
2809            && config.validate_optional_fields
2810        {
2811            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
2812        }
2813        if let Some(ref val) = self.id
2814            && config.validate_optional_fields
2815        {
2816            val.validate(&helpers::child_path(path, "Id"), config, collector);
2817        }
2818        if let Some(ref val) = self.ctry_of_res {
2819            helpers::validate_pattern(
2820                val,
2821                "CtryOfRes",
2822                "[A-Z]{2,2}",
2823                &helpers::child_path(path, "CtryOfRes"),
2824                config,
2825                collector,
2826            );
2827        }
2828    }
2829}
2830
2831// 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.
2832#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2833pub struct PartyIdentification1352 {
2834    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2835    pub nm: Option<String>,
2836    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2837    pub pstl_adr: Option<PostalAddress241>,
2838    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2839    pub id: Option<Party38Choice2>,
2840    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2841    pub ctry_of_res: Option<String>,
2842}
2843
2844impl Validate for PartyIdentification1352 {
2845    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2846        if let Some(ref val) = self.nm {
2847            helpers::validate_length(
2848                val,
2849                "Nm",
2850                Some(1),
2851                Some(140),
2852                &helpers::child_path(path, "Nm"),
2853                config,
2854                collector,
2855            );
2856        }
2857        if let Some(ref val) = self.nm {
2858            helpers::validate_pattern(
2859                val,
2860                "Nm",
2861                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2862                &helpers::child_path(path, "Nm"),
2863                config,
2864                collector,
2865            );
2866        }
2867        if let Some(ref val) = self.pstl_adr
2868            && config.validate_optional_fields
2869        {
2870            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
2871        }
2872        if let Some(ref val) = self.id
2873            && config.validate_optional_fields
2874        {
2875            val.validate(&helpers::child_path(path, "Id"), config, collector);
2876        }
2877        if let Some(ref val) = self.ctry_of_res {
2878            helpers::validate_pattern(
2879                val,
2880                "CtryOfRes",
2881                "[A-Z]{2,2}",
2882                &helpers::child_path(path, "CtryOfRes"),
2883                config,
2884                collector,
2885            );
2886        }
2887    }
2888}
2889
2890// 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.
2891#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2892pub struct PartyIdentification1353 {
2893    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2894    pub nm: Option<String>,
2895    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2896    pub pstl_adr: Option<PostalAddress241>,
2897    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2898    pub id: Option<Party38Choice1>,
2899    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2900    pub ctry_of_res: Option<String>,
2901}
2902
2903impl Validate for PartyIdentification1353 {
2904    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2905        if let Some(ref val) = self.nm {
2906            helpers::validate_length(
2907                val,
2908                "Nm",
2909                Some(1),
2910                Some(140),
2911                &helpers::child_path(path, "Nm"),
2912                config,
2913                collector,
2914            );
2915        }
2916        if let Some(ref val) = self.nm {
2917            helpers::validate_pattern(
2918                val,
2919                "Nm",
2920                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2921                &helpers::child_path(path, "Nm"),
2922                config,
2923                collector,
2924            );
2925        }
2926        if let Some(ref val) = self.pstl_adr
2927            && config.validate_optional_fields
2928        {
2929            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
2930        }
2931        if let Some(ref val) = self.id
2932            && config.validate_optional_fields
2933        {
2934            val.validate(&helpers::child_path(path, "Id"), config, collector);
2935        }
2936        if let Some(ref val) = self.ctry_of_res {
2937            helpers::validate_pattern(
2938                val,
2939                "CtryOfRes",
2940                "[A-Z]{2,2}",
2941                &helpers::child_path(path, "CtryOfRes"),
2942                config,
2943                collector,
2944            );
2945        }
2946    }
2947}
2948
2949// 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.
2950#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2951pub struct PartyIdentification1354 {
2952    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2953    pub nm: Option<String>,
2954    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2955    pub pstl_adr: Option<PostalAddress242>,
2956    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2957    pub id: Option<Party38Choice3>,
2958    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2959    pub ctry_of_res: Option<String>,
2960}
2961
2962impl Validate for PartyIdentification1354 {
2963    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2964        if let Some(ref val) = self.nm {
2965            helpers::validate_length(
2966                val,
2967                "Nm",
2968                Some(1),
2969                Some(140),
2970                &helpers::child_path(path, "Nm"),
2971                config,
2972                collector,
2973            );
2974        }
2975        if let Some(ref val) = self.nm {
2976            helpers::validate_pattern(
2977                val,
2978                "Nm",
2979                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2980                &helpers::child_path(path, "Nm"),
2981                config,
2982                collector,
2983            );
2984        }
2985        if let Some(ref val) = self.pstl_adr
2986            && config.validate_optional_fields
2987        {
2988            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
2989        }
2990        if let Some(ref val) = self.id
2991            && config.validate_optional_fields
2992        {
2993            val.validate(&helpers::child_path(path, "Id"), config, collector);
2994        }
2995        if let Some(ref val) = self.ctry_of_res {
2996            helpers::validate_pattern(
2997                val,
2998                "CtryOfRes",
2999                "[A-Z]{2,2}",
3000                &helpers::child_path(path, "CtryOfRes"),
3001                config,
3002                collector,
3003            );
3004        }
3005    }
3006}
3007
3008// PaymentIdentification71: Unique reference, as assigned by a clearing system, to unambiguously identify the instruction.
3009#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3010pub struct PaymentIdentification71 {
3011    #[serde(rename = "InstrId")]
3012    pub instr_id: String,
3013    #[serde(rename = "EndToEndId")]
3014    pub end_to_end_id: String,
3015    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
3016    pub tx_id: Option<String>,
3017    #[serde(rename = "UETR")]
3018    pub uetr: String,
3019    #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
3020    pub clr_sys_ref: Option<String>,
3021}
3022
3023impl Validate for PaymentIdentification71 {
3024    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3025        helpers::validate_length(
3026            &self.instr_id,
3027            "InstrId",
3028            Some(1),
3029            Some(16),
3030            &helpers::child_path(path, "InstrId"),
3031            config,
3032            collector,
3033        );
3034        helpers::validate_pattern(
3035            &self.instr_id,
3036            "InstrId",
3037            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3038            &helpers::child_path(path, "InstrId"),
3039            config,
3040            collector,
3041        );
3042        helpers::validate_length(
3043            &self.end_to_end_id,
3044            "EndToEndId",
3045            Some(1),
3046            Some(35),
3047            &helpers::child_path(path, "EndToEndId"),
3048            config,
3049            collector,
3050        );
3051        helpers::validate_pattern(
3052            &self.end_to_end_id,
3053            "EndToEndId",
3054            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3055            &helpers::child_path(path, "EndToEndId"),
3056            config,
3057            collector,
3058        );
3059        if let Some(ref val) = self.tx_id {
3060            helpers::validate_length(
3061                val,
3062                "TxId",
3063                Some(1),
3064                Some(35),
3065                &helpers::child_path(path, "TxId"),
3066                config,
3067                collector,
3068            );
3069        }
3070        if let Some(ref val) = self.tx_id {
3071            helpers::validate_pattern(
3072                val,
3073                "TxId",
3074                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3075                &helpers::child_path(path, "TxId"),
3076                config,
3077                collector,
3078            );
3079        }
3080        helpers::validate_pattern(
3081            &self.uetr,
3082            "UETR",
3083            "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
3084            &helpers::child_path(path, "UETR"),
3085            config,
3086            collector,
3087        );
3088        if let Some(ref val) = self.clr_sys_ref {
3089            helpers::validate_length(
3090                val,
3091                "ClrSysRef",
3092                Some(1),
3093                Some(35),
3094                &helpers::child_path(path, "ClrSysRef"),
3095                config,
3096                collector,
3097            );
3098        }
3099        if let Some(ref val) = self.clr_sys_ref {
3100            helpers::validate_pattern(
3101                val,
3102                "ClrSysRef",
3103                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3104                &helpers::child_path(path, "ClrSysRef"),
3105                config,
3106                collector,
3107            );
3108        }
3109    }
3110}
3111
3112// PaymentTypeInformation281: Specifies the high level purpose of the instruction based on a set of pre-defined categories.
3113// 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.
3114#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3115pub struct PaymentTypeInformation281 {
3116    #[serde(rename = "InstrPrty", skip_serializing_if = "Option::is_none")]
3117    pub instr_prty: Option<Priority2Code>,
3118    #[serde(rename = "ClrChanl", skip_serializing_if = "Option::is_none")]
3119    pub clr_chanl: Option<ClearingChannel2Code>,
3120    #[serde(rename = "SvcLvl", skip_serializing_if = "Option::is_none")]
3121    pub svc_lvl: Option<Vec<ServiceLevel8Choice1>>,
3122    #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3123    pub lcl_instrm: Option<LocalInstrument2Choice1>,
3124    #[serde(rename = "CtgyPurp", skip_serializing_if = "Option::is_none")]
3125    pub ctgy_purp: Option<CategoryPurpose1Choice1>,
3126}
3127
3128impl Validate for PaymentTypeInformation281 {
3129    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3130        if let Some(ref val) = self.instr_prty
3131            && config.validate_optional_fields
3132        {
3133            val.validate(&helpers::child_path(path, "InstrPrty"), config, collector);
3134        }
3135        if let Some(ref val) = self.clr_chanl
3136            && config.validate_optional_fields
3137        {
3138            val.validate(&helpers::child_path(path, "ClrChanl"), config, collector);
3139        }
3140        if let Some(ref vec) = self.svc_lvl
3141            && config.validate_optional_fields
3142        {
3143            for item in vec {
3144                item.validate(&helpers::child_path(path, "SvcLvl"), config, collector);
3145            }
3146        }
3147        if let Some(ref val) = self.lcl_instrm
3148            && config.validate_optional_fields
3149        {
3150            val.validate(&helpers::child_path(path, "LclInstrm"), config, collector);
3151        }
3152        if let Some(ref val) = self.ctgy_purp
3153            && config.validate_optional_fields
3154        {
3155            val.validate(&helpers::child_path(path, "CtgyPurp"), config, collector);
3156        }
3157    }
3158}
3159
3160// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
3161#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3162pub struct PersonIdentification131 {
3163    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3164    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
3165    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3166    pub othr: Option<Vec<GenericPersonIdentification11>>,
3167}
3168
3169impl Validate for PersonIdentification131 {
3170    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3171        if let Some(ref val) = self.dt_and_plc_of_birth
3172            && config.validate_optional_fields
3173        {
3174            val.validate(
3175                &helpers::child_path(path, "DtAndPlcOfBirth"),
3176                config,
3177                collector,
3178            );
3179        }
3180        if let Some(ref vec) = self.othr
3181            && config.validate_optional_fields
3182        {
3183            for item in vec {
3184                item.validate(&helpers::child_path(path, "Othr"), config, collector);
3185            }
3186        }
3187    }
3188}
3189
3190// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
3191#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3192pub struct PersonIdentification132 {
3193    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3194    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
3195    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3196    pub othr: Option<Vec<GenericPersonIdentification12>>,
3197}
3198
3199impl Validate for PersonIdentification132 {
3200    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3201        if let Some(ref val) = self.dt_and_plc_of_birth
3202            && config.validate_optional_fields
3203        {
3204            val.validate(
3205                &helpers::child_path(path, "DtAndPlcOfBirth"),
3206                config,
3207                collector,
3208            );
3209        }
3210        if let Some(ref vec) = self.othr
3211            && config.validate_optional_fields
3212        {
3213            for item in vec {
3214                item.validate(&helpers::child_path(path, "Othr"), config, collector);
3215            }
3216        }
3217    }
3218}
3219
3220// PersonIdentification133: Unique identification of a person, as assigned by an institution, using an identification scheme.
3221#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3222pub struct PersonIdentification133 {
3223    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3224    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
3225    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3226    pub othr: Option<Vec<GenericPersonIdentification13>>,
3227}
3228
3229impl Validate for PersonIdentification133 {
3230    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3231        if let Some(ref val) = self.dt_and_plc_of_birth
3232            && config.validate_optional_fields
3233        {
3234            val.validate(
3235                &helpers::child_path(path, "DtAndPlcOfBirth"),
3236                config,
3237                collector,
3238            );
3239        }
3240        if let Some(ref vec) = self.othr
3241            && config.validate_optional_fields
3242        {
3243            for item in vec {
3244                item.validate(&helpers::child_path(path, "Othr"), config, collector);
3245            }
3246        }
3247    }
3248}
3249
3250// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
3251#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3252pub struct PersonIdentificationSchemeName1Choice1 {
3253    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3254    pub cd: Option<String>,
3255    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3256    pub prtry: Option<String>,
3257}
3258
3259impl Validate for PersonIdentificationSchemeName1Choice1 {
3260    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3261        if let Some(ref val) = self.cd {
3262            helpers::validate_length(
3263                val,
3264                "Cd",
3265                Some(1),
3266                Some(4),
3267                &helpers::child_path(path, "Cd"),
3268                config,
3269                collector,
3270            );
3271        }
3272        if let Some(ref val) = self.prtry {
3273            helpers::validate_length(
3274                val,
3275                "Prtry",
3276                Some(1),
3277                Some(35),
3278                &helpers::child_path(path, "Prtry"),
3279                config,
3280                collector,
3281            );
3282        }
3283        if let Some(ref val) = self.prtry {
3284            helpers::validate_pattern(
3285                val,
3286                "Prtry",
3287                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3288                &helpers::child_path(path, "Prtry"),
3289                config,
3290                collector,
3291            );
3292        }
3293    }
3294}
3295
3296// PersonIdentificationSchemeName1Choice2: Name of the identification scheme, in a coded form as published in an external list.
3297#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3298pub struct PersonIdentificationSchemeName1Choice2 {
3299    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3300    pub cd: Option<String>,
3301}
3302
3303impl Validate for PersonIdentificationSchemeName1Choice2 {
3304    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3305        if let Some(ref val) = self.cd {
3306            helpers::validate_length(
3307                val,
3308                "Cd",
3309                Some(1),
3310                Some(4),
3311                &helpers::child_path(path, "Cd"),
3312                config,
3313                collector,
3314            );
3315        }
3316    }
3317}
3318
3319// PersonIdentificationSchemeName1Choice3: Name of the identification scheme, in a free text form.
3320#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3321pub struct PersonIdentificationSchemeName1Choice3 {
3322    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3323    pub cd: Option<String>,
3324    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3325    pub prtry: Option<String>,
3326}
3327
3328impl Validate for PersonIdentificationSchemeName1Choice3 {
3329    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3330        if let Some(ref val) = self.cd {
3331            helpers::validate_length(
3332                val,
3333                "Cd",
3334                Some(1),
3335                Some(4),
3336                &helpers::child_path(path, "Cd"),
3337                config,
3338                collector,
3339            );
3340        }
3341        if let Some(ref val) = self.prtry {
3342            helpers::validate_length(
3343                val,
3344                "Prtry",
3345                Some(1),
3346                Some(35),
3347                &helpers::child_path(path, "Prtry"),
3348                config,
3349                collector,
3350            );
3351        }
3352        if let Some(ref val) = self.prtry {
3353            helpers::validate_pattern(
3354                val,
3355                "Prtry",
3356                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3357                &helpers::child_path(path, "Prtry"),
3358                config,
3359                collector,
3360            );
3361        }
3362    }
3363}
3364
3365// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
3366#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3367pub struct PostalAddress241 {
3368    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
3369    pub dept: Option<String>,
3370    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
3371    pub sub_dept: Option<String>,
3372    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
3373    pub strt_nm: Option<String>,
3374    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
3375    pub bldg_nb: Option<String>,
3376    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
3377    pub bldg_nm: Option<String>,
3378    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
3379    pub flr: Option<String>,
3380    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
3381    pub pst_bx: Option<String>,
3382    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
3383    pub room: Option<String>,
3384    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
3385    pub pst_cd: Option<String>,
3386    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
3387    pub twn_nm: Option<String>,
3388    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
3389    pub twn_lctn_nm: Option<String>,
3390    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
3391    pub dstrct_nm: Option<String>,
3392    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
3393    pub ctry_sub_dvsn: Option<String>,
3394    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
3395    pub ctry: Option<String>,
3396    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
3397    pub adr_line: Option<Vec<String>>,
3398}
3399
3400impl Validate for PostalAddress241 {
3401    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3402        if let Some(ref val) = self.dept {
3403            helpers::validate_length(
3404                val,
3405                "Dept",
3406                Some(1),
3407                Some(70),
3408                &helpers::child_path(path, "Dept"),
3409                config,
3410                collector,
3411            );
3412        }
3413        if let Some(ref val) = self.dept {
3414            helpers::validate_pattern(
3415                val,
3416                "Dept",
3417                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3418                &helpers::child_path(path, "Dept"),
3419                config,
3420                collector,
3421            );
3422        }
3423        if let Some(ref val) = self.sub_dept {
3424            helpers::validate_length(
3425                val,
3426                "SubDept",
3427                Some(1),
3428                Some(70),
3429                &helpers::child_path(path, "SubDept"),
3430                config,
3431                collector,
3432            );
3433        }
3434        if let Some(ref val) = self.sub_dept {
3435            helpers::validate_pattern(
3436                val,
3437                "SubDept",
3438                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3439                &helpers::child_path(path, "SubDept"),
3440                config,
3441                collector,
3442            );
3443        }
3444        if let Some(ref val) = self.strt_nm {
3445            helpers::validate_length(
3446                val,
3447                "StrtNm",
3448                Some(1),
3449                Some(70),
3450                &helpers::child_path(path, "StrtNm"),
3451                config,
3452                collector,
3453            );
3454        }
3455        if let Some(ref val) = self.strt_nm {
3456            helpers::validate_pattern(
3457                val,
3458                "StrtNm",
3459                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3460                &helpers::child_path(path, "StrtNm"),
3461                config,
3462                collector,
3463            );
3464        }
3465        if let Some(ref val) = self.bldg_nb {
3466            helpers::validate_length(
3467                val,
3468                "BldgNb",
3469                Some(1),
3470                Some(16),
3471                &helpers::child_path(path, "BldgNb"),
3472                config,
3473                collector,
3474            );
3475        }
3476        if let Some(ref val) = self.bldg_nb {
3477            helpers::validate_pattern(
3478                val,
3479                "BldgNb",
3480                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3481                &helpers::child_path(path, "BldgNb"),
3482                config,
3483                collector,
3484            );
3485        }
3486        if let Some(ref val) = self.bldg_nm {
3487            helpers::validate_length(
3488                val,
3489                "BldgNm",
3490                Some(1),
3491                Some(35),
3492                &helpers::child_path(path, "BldgNm"),
3493                config,
3494                collector,
3495            );
3496        }
3497        if let Some(ref val) = self.bldg_nm {
3498            helpers::validate_pattern(
3499                val,
3500                "BldgNm",
3501                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3502                &helpers::child_path(path, "BldgNm"),
3503                config,
3504                collector,
3505            );
3506        }
3507        if let Some(ref val) = self.flr {
3508            helpers::validate_length(
3509                val,
3510                "Flr",
3511                Some(1),
3512                Some(70),
3513                &helpers::child_path(path, "Flr"),
3514                config,
3515                collector,
3516            );
3517        }
3518        if let Some(ref val) = self.flr {
3519            helpers::validate_pattern(
3520                val,
3521                "Flr",
3522                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3523                &helpers::child_path(path, "Flr"),
3524                config,
3525                collector,
3526            );
3527        }
3528        if let Some(ref val) = self.pst_bx {
3529            helpers::validate_length(
3530                val,
3531                "PstBx",
3532                Some(1),
3533                Some(16),
3534                &helpers::child_path(path, "PstBx"),
3535                config,
3536                collector,
3537            );
3538        }
3539        if let Some(ref val) = self.pst_bx {
3540            helpers::validate_pattern(
3541                val,
3542                "PstBx",
3543                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3544                &helpers::child_path(path, "PstBx"),
3545                config,
3546                collector,
3547            );
3548        }
3549        if let Some(ref val) = self.room {
3550            helpers::validate_length(
3551                val,
3552                "Room",
3553                Some(1),
3554                Some(70),
3555                &helpers::child_path(path, "Room"),
3556                config,
3557                collector,
3558            );
3559        }
3560        if let Some(ref val) = self.room {
3561            helpers::validate_pattern(
3562                val,
3563                "Room",
3564                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3565                &helpers::child_path(path, "Room"),
3566                config,
3567                collector,
3568            );
3569        }
3570        if let Some(ref val) = self.pst_cd {
3571            helpers::validate_length(
3572                val,
3573                "PstCd",
3574                Some(1),
3575                Some(16),
3576                &helpers::child_path(path, "PstCd"),
3577                config,
3578                collector,
3579            );
3580        }
3581        if let Some(ref val) = self.pst_cd {
3582            helpers::validate_pattern(
3583                val,
3584                "PstCd",
3585                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3586                &helpers::child_path(path, "PstCd"),
3587                config,
3588                collector,
3589            );
3590        }
3591        if let Some(ref val) = self.twn_nm {
3592            helpers::validate_length(
3593                val,
3594                "TwnNm",
3595                Some(1),
3596                Some(35),
3597                &helpers::child_path(path, "TwnNm"),
3598                config,
3599                collector,
3600            );
3601        }
3602        if let Some(ref val) = self.twn_nm {
3603            helpers::validate_pattern(
3604                val,
3605                "TwnNm",
3606                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3607                &helpers::child_path(path, "TwnNm"),
3608                config,
3609                collector,
3610            );
3611        }
3612        if let Some(ref val) = self.twn_lctn_nm {
3613            helpers::validate_length(
3614                val,
3615                "TwnLctnNm",
3616                Some(1),
3617                Some(35),
3618                &helpers::child_path(path, "TwnLctnNm"),
3619                config,
3620                collector,
3621            );
3622        }
3623        if let Some(ref val) = self.twn_lctn_nm {
3624            helpers::validate_pattern(
3625                val,
3626                "TwnLctnNm",
3627                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3628                &helpers::child_path(path, "TwnLctnNm"),
3629                config,
3630                collector,
3631            );
3632        }
3633        if let Some(ref val) = self.dstrct_nm {
3634            helpers::validate_length(
3635                val,
3636                "DstrctNm",
3637                Some(1),
3638                Some(35),
3639                &helpers::child_path(path, "DstrctNm"),
3640                config,
3641                collector,
3642            );
3643        }
3644        if let Some(ref val) = self.dstrct_nm {
3645            helpers::validate_pattern(
3646                val,
3647                "DstrctNm",
3648                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3649                &helpers::child_path(path, "DstrctNm"),
3650                config,
3651                collector,
3652            );
3653        }
3654        if let Some(ref val) = self.ctry_sub_dvsn {
3655            helpers::validate_length(
3656                val,
3657                "CtrySubDvsn",
3658                Some(1),
3659                Some(35),
3660                &helpers::child_path(path, "CtrySubDvsn"),
3661                config,
3662                collector,
3663            );
3664        }
3665        if let Some(ref val) = self.ctry_sub_dvsn {
3666            helpers::validate_pattern(
3667                val,
3668                "CtrySubDvsn",
3669                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3670                &helpers::child_path(path, "CtrySubDvsn"),
3671                config,
3672                collector,
3673            );
3674        }
3675        if let Some(ref val) = self.ctry {
3676            helpers::validate_pattern(
3677                val,
3678                "Ctry",
3679                "[A-Z]{2,2}",
3680                &helpers::child_path(path, "Ctry"),
3681                config,
3682                collector,
3683            );
3684        }
3685        if let Some(ref vec) = self.adr_line {
3686            for item in vec {
3687                helpers::validate_length(
3688                    item,
3689                    "AdrLine",
3690                    Some(1),
3691                    Some(70),
3692                    &helpers::child_path(path, "AdrLine"),
3693                    config,
3694                    collector,
3695                );
3696            }
3697        }
3698        if let Some(ref vec) = self.adr_line {
3699            for item in vec {
3700                helpers::validate_pattern(
3701                    item,
3702                    "AdrLine",
3703                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3704                    &helpers::child_path(path, "AdrLine"),
3705                    config,
3706                    collector,
3707                );
3708            }
3709        }
3710    }
3711}
3712
3713// PostalAddress242: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
3714#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3715pub struct PostalAddress242 {
3716    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
3717    pub dept: Option<String>,
3718    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
3719    pub sub_dept: Option<String>,
3720    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
3721    pub strt_nm: Option<String>,
3722    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
3723    pub bldg_nb: Option<String>,
3724    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
3725    pub bldg_nm: Option<String>,
3726    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
3727    pub flr: Option<String>,
3728    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
3729    pub pst_bx: Option<String>,
3730    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
3731    pub room: Option<String>,
3732    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
3733    pub pst_cd: Option<String>,
3734    #[serde(rename = "TwnNm")]
3735    pub twn_nm: String,
3736    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
3737    pub twn_lctn_nm: Option<String>,
3738    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
3739    pub dstrct_nm: Option<String>,
3740    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
3741    pub ctry_sub_dvsn: Option<String>,
3742    #[serde(rename = "Ctry")]
3743    pub ctry: String,
3744    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
3745    pub adr_line: Option<Vec<String>>,
3746}
3747
3748impl Validate for PostalAddress242 {
3749    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3750        if let Some(ref val) = self.dept {
3751            helpers::validate_length(
3752                val,
3753                "Dept",
3754                Some(1),
3755                Some(70),
3756                &helpers::child_path(path, "Dept"),
3757                config,
3758                collector,
3759            );
3760        }
3761        if let Some(ref val) = self.dept {
3762            helpers::validate_pattern(
3763                val,
3764                "Dept",
3765                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3766                &helpers::child_path(path, "Dept"),
3767                config,
3768                collector,
3769            );
3770        }
3771        if let Some(ref val) = self.sub_dept {
3772            helpers::validate_length(
3773                val,
3774                "SubDept",
3775                Some(1),
3776                Some(70),
3777                &helpers::child_path(path, "SubDept"),
3778                config,
3779                collector,
3780            );
3781        }
3782        if let Some(ref val) = self.sub_dept {
3783            helpers::validate_pattern(
3784                val,
3785                "SubDept",
3786                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3787                &helpers::child_path(path, "SubDept"),
3788                config,
3789                collector,
3790            );
3791        }
3792        if let Some(ref val) = self.strt_nm {
3793            helpers::validate_length(
3794                val,
3795                "StrtNm",
3796                Some(1),
3797                Some(70),
3798                &helpers::child_path(path, "StrtNm"),
3799                config,
3800                collector,
3801            );
3802        }
3803        if let Some(ref val) = self.strt_nm {
3804            helpers::validate_pattern(
3805                val,
3806                "StrtNm",
3807                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3808                &helpers::child_path(path, "StrtNm"),
3809                config,
3810                collector,
3811            );
3812        }
3813        if let Some(ref val) = self.bldg_nb {
3814            helpers::validate_length(
3815                val,
3816                "BldgNb",
3817                Some(1),
3818                Some(16),
3819                &helpers::child_path(path, "BldgNb"),
3820                config,
3821                collector,
3822            );
3823        }
3824        if let Some(ref val) = self.bldg_nb {
3825            helpers::validate_pattern(
3826                val,
3827                "BldgNb",
3828                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3829                &helpers::child_path(path, "BldgNb"),
3830                config,
3831                collector,
3832            );
3833        }
3834        if let Some(ref val) = self.bldg_nm {
3835            helpers::validate_length(
3836                val,
3837                "BldgNm",
3838                Some(1),
3839                Some(35),
3840                &helpers::child_path(path, "BldgNm"),
3841                config,
3842                collector,
3843            );
3844        }
3845        if let Some(ref val) = self.bldg_nm {
3846            helpers::validate_pattern(
3847                val,
3848                "BldgNm",
3849                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3850                &helpers::child_path(path, "BldgNm"),
3851                config,
3852                collector,
3853            );
3854        }
3855        if let Some(ref val) = self.flr {
3856            helpers::validate_length(
3857                val,
3858                "Flr",
3859                Some(1),
3860                Some(70),
3861                &helpers::child_path(path, "Flr"),
3862                config,
3863                collector,
3864            );
3865        }
3866        if let Some(ref val) = self.flr {
3867            helpers::validate_pattern(
3868                val,
3869                "Flr",
3870                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3871                &helpers::child_path(path, "Flr"),
3872                config,
3873                collector,
3874            );
3875        }
3876        if let Some(ref val) = self.pst_bx {
3877            helpers::validate_length(
3878                val,
3879                "PstBx",
3880                Some(1),
3881                Some(16),
3882                &helpers::child_path(path, "PstBx"),
3883                config,
3884                collector,
3885            );
3886        }
3887        if let Some(ref val) = self.pst_bx {
3888            helpers::validate_pattern(
3889                val,
3890                "PstBx",
3891                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3892                &helpers::child_path(path, "PstBx"),
3893                config,
3894                collector,
3895            );
3896        }
3897        if let Some(ref val) = self.room {
3898            helpers::validate_length(
3899                val,
3900                "Room",
3901                Some(1),
3902                Some(70),
3903                &helpers::child_path(path, "Room"),
3904                config,
3905                collector,
3906            );
3907        }
3908        if let Some(ref val) = self.room {
3909            helpers::validate_pattern(
3910                val,
3911                "Room",
3912                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3913                &helpers::child_path(path, "Room"),
3914                config,
3915                collector,
3916            );
3917        }
3918        if let Some(ref val) = self.pst_cd {
3919            helpers::validate_length(
3920                val,
3921                "PstCd",
3922                Some(1),
3923                Some(16),
3924                &helpers::child_path(path, "PstCd"),
3925                config,
3926                collector,
3927            );
3928        }
3929        if let Some(ref val) = self.pst_cd {
3930            helpers::validate_pattern(
3931                val,
3932                "PstCd",
3933                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3934                &helpers::child_path(path, "PstCd"),
3935                config,
3936                collector,
3937            );
3938        }
3939        helpers::validate_length(
3940            &self.twn_nm,
3941            "TwnNm",
3942            Some(1),
3943            Some(35),
3944            &helpers::child_path(path, "TwnNm"),
3945            config,
3946            collector,
3947        );
3948        helpers::validate_pattern(
3949            &self.twn_nm,
3950            "TwnNm",
3951            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3952            &helpers::child_path(path, "TwnNm"),
3953            config,
3954            collector,
3955        );
3956        if let Some(ref val) = self.twn_lctn_nm {
3957            helpers::validate_length(
3958                val,
3959                "TwnLctnNm",
3960                Some(1),
3961                Some(35),
3962                &helpers::child_path(path, "TwnLctnNm"),
3963                config,
3964                collector,
3965            );
3966        }
3967        if let Some(ref val) = self.twn_lctn_nm {
3968            helpers::validate_pattern(
3969                val,
3970                "TwnLctnNm",
3971                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3972                &helpers::child_path(path, "TwnLctnNm"),
3973                config,
3974                collector,
3975            );
3976        }
3977        if let Some(ref val) = self.dstrct_nm {
3978            helpers::validate_length(
3979                val,
3980                "DstrctNm",
3981                Some(1),
3982                Some(35),
3983                &helpers::child_path(path, "DstrctNm"),
3984                config,
3985                collector,
3986            );
3987        }
3988        if let Some(ref val) = self.dstrct_nm {
3989            helpers::validate_pattern(
3990                val,
3991                "DstrctNm",
3992                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3993                &helpers::child_path(path, "DstrctNm"),
3994                config,
3995                collector,
3996            );
3997        }
3998        if let Some(ref val) = self.ctry_sub_dvsn {
3999            helpers::validate_length(
4000                val,
4001                "CtrySubDvsn",
4002                Some(1),
4003                Some(35),
4004                &helpers::child_path(path, "CtrySubDvsn"),
4005                config,
4006                collector,
4007            );
4008        }
4009        if let Some(ref val) = self.ctry_sub_dvsn {
4010            helpers::validate_pattern(
4011                val,
4012                "CtrySubDvsn",
4013                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4014                &helpers::child_path(path, "CtrySubDvsn"),
4015                config,
4016                collector,
4017            );
4018        }
4019        helpers::validate_pattern(
4020            &self.ctry,
4021            "Ctry",
4022            "[A-Z]{2,2}",
4023            &helpers::child_path(path, "Ctry"),
4024            config,
4025            collector,
4026        );
4027        if let Some(ref vec) = self.adr_line {
4028            for item in vec {
4029                helpers::validate_length(
4030                    item,
4031                    "AdrLine",
4032                    Some(1),
4033                    Some(70),
4034                    &helpers::child_path(path, "AdrLine"),
4035                    config,
4036                    collector,
4037                );
4038            }
4039        }
4040        if let Some(ref vec) = self.adr_line {
4041            for item in vec {
4042                helpers::validate_pattern(
4043                    item,
4044                    "AdrLine",
4045                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4046                    &helpers::child_path(path, "AdrLine"),
4047                    config,
4048                    collector,
4049                );
4050            }
4051        }
4052    }
4053}
4054
4055// Priority2Code: Priority level is normal.
4056#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4057pub enum Priority2Code {
4058    #[default]
4059    #[serde(rename = "HIGH")]
4060    CodeHIGH,
4061    #[serde(rename = "NORM")]
4062    CodeNORM,
4063}
4064
4065impl Validate for Priority2Code {
4066    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
4067        // Enum validation is typically empty
4068    }
4069}
4070
4071// Priority3Code: Priority level is normal.
4072#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4073pub enum Priority3Code {
4074    #[default]
4075    #[serde(rename = "URGT")]
4076    CodeURGT,
4077    #[serde(rename = "HIGH")]
4078    CodeHIGH,
4079    #[serde(rename = "NORM")]
4080    CodeNORM,
4081}
4082
4083impl Validate for Priority3Code {
4084    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
4085        // Enum validation is typically empty
4086    }
4087}
4088
4089// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
4090#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4091pub struct ProxyAccountIdentification11 {
4092    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4093    pub tp: Option<ProxyAccountType1Choice1>,
4094    #[serde(rename = "Id")]
4095    pub id: String,
4096}
4097
4098impl Validate for ProxyAccountIdentification11 {
4099    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4100        if let Some(ref val) = self.tp
4101            && config.validate_optional_fields
4102        {
4103            val.validate(&helpers::child_path(path, "Tp"), config, collector);
4104        }
4105        helpers::validate_length(
4106            &self.id,
4107            "Id",
4108            Some(1),
4109            Some(320),
4110            &helpers::child_path(path, "Id"),
4111            config,
4112            collector,
4113        );
4114        helpers::validate_pattern(
4115            &self.id,
4116            "Id",
4117            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4118            &helpers::child_path(path, "Id"),
4119            config,
4120            collector,
4121        );
4122    }
4123}
4124
4125// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
4126#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4127pub struct ProxyAccountType1Choice1 {
4128    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4129    pub cd: Option<String>,
4130    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4131    pub prtry: Option<String>,
4132}
4133
4134impl Validate for ProxyAccountType1Choice1 {
4135    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4136        if let Some(ref val) = self.cd {
4137            helpers::validate_length(
4138                val,
4139                "Cd",
4140                Some(1),
4141                Some(4),
4142                &helpers::child_path(path, "Cd"),
4143                config,
4144                collector,
4145            );
4146        }
4147        if let Some(ref val) = self.prtry {
4148            helpers::validate_length(
4149                val,
4150                "Prtry",
4151                Some(1),
4152                Some(35),
4153                &helpers::child_path(path, "Prtry"),
4154                config,
4155                collector,
4156            );
4157        }
4158        if let Some(ref val) = self.prtry {
4159            helpers::validate_pattern(
4160                val,
4161                "Prtry",
4162                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4163                &helpers::child_path(path, "Prtry"),
4164                config,
4165                collector,
4166            );
4167        }
4168    }
4169}
4170
4171// Purpose2Choice1: Purpose, in a proprietary form.
4172#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4173pub struct Purpose2Choice1 {
4174    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4175    pub cd: Option<String>,
4176    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4177    pub prtry: Option<String>,
4178}
4179
4180impl Validate for Purpose2Choice1 {
4181    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4182        if let Some(ref val) = self.cd {
4183            helpers::validate_length(
4184                val,
4185                "Cd",
4186                Some(1),
4187                Some(4),
4188                &helpers::child_path(path, "Cd"),
4189                config,
4190                collector,
4191            );
4192        }
4193        if let Some(ref val) = self.prtry {
4194            helpers::validate_length(
4195                val,
4196                "Prtry",
4197                Some(1),
4198                Some(35),
4199                &helpers::child_path(path, "Prtry"),
4200                config,
4201                collector,
4202            );
4203        }
4204        if let Some(ref val) = self.prtry {
4205            helpers::validate_pattern(
4206                val,
4207                "Prtry",
4208                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4209                &helpers::child_path(path, "Prtry"),
4210                config,
4211                collector,
4212            );
4213        }
4214    }
4215}
4216
4217// ReferredDocumentInformation71: Set of elements used to provide the content of the referred document line.
4218#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4219pub struct ReferredDocumentInformation71 {
4220    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4221    pub tp: Option<ReferredDocumentType41>,
4222    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
4223    pub nb: Option<String>,
4224    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
4225    pub rltd_dt: Option<String>,
4226    #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
4227    pub line_dtls: Option<Vec<DocumentLineInformation11>>,
4228}
4229
4230impl Validate for ReferredDocumentInformation71 {
4231    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4232        if let Some(ref val) = self.tp
4233            && config.validate_optional_fields
4234        {
4235            val.validate(&helpers::child_path(path, "Tp"), config, collector);
4236        }
4237        if let Some(ref val) = self.nb {
4238            helpers::validate_length(
4239                val,
4240                "Nb",
4241                Some(1),
4242                Some(35),
4243                &helpers::child_path(path, "Nb"),
4244                config,
4245                collector,
4246            );
4247        }
4248        if let Some(ref val) = self.nb {
4249            helpers::validate_pattern(
4250                val,
4251                "Nb",
4252                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4253                &helpers::child_path(path, "Nb"),
4254                config,
4255                collector,
4256            );
4257        }
4258        if let Some(ref vec) = self.line_dtls
4259            && config.validate_optional_fields
4260        {
4261            for item in vec {
4262                item.validate(&helpers::child_path(path, "LineDtls"), config, collector);
4263            }
4264        }
4265    }
4266}
4267
4268// ReferredDocumentType3Choice1: Proprietary identification of the type of the remittance document.
4269#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4270pub struct ReferredDocumentType3Choice1 {
4271    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4272    pub cd: Option<DocumentType6Code>,
4273    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4274    pub prtry: Option<String>,
4275}
4276
4277impl Validate for ReferredDocumentType3Choice1 {
4278    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4279        if let Some(ref val) = self.cd
4280            && config.validate_optional_fields
4281        {
4282            val.validate(&helpers::child_path(path, "Cd"), config, collector);
4283        }
4284        if let Some(ref val) = self.prtry {
4285            helpers::validate_length(
4286                val,
4287                "Prtry",
4288                Some(1),
4289                Some(35),
4290                &helpers::child_path(path, "Prtry"),
4291                config,
4292                collector,
4293            );
4294        }
4295        if let Some(ref val) = self.prtry {
4296            helpers::validate_pattern(
4297                val,
4298                "Prtry",
4299                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4300                &helpers::child_path(path, "Prtry"),
4301                config,
4302                collector,
4303            );
4304        }
4305    }
4306}
4307
4308// ReferredDocumentType41: Identification of the issuer of the reference document type.
4309#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4310pub struct ReferredDocumentType41 {
4311    #[serde(rename = "CdOrPrtry")]
4312    pub cd_or_prtry: ReferredDocumentType3Choice1,
4313    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4314    pub issr: Option<String>,
4315}
4316
4317impl Validate for ReferredDocumentType41 {
4318    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4319        self.cd_or_prtry
4320            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
4321        if let Some(ref val) = self.issr {
4322            helpers::validate_length(
4323                val,
4324                "Issr",
4325                Some(1),
4326                Some(35),
4327                &helpers::child_path(path, "Issr"),
4328                config,
4329                collector,
4330            );
4331        }
4332        if let Some(ref val) = self.issr {
4333            helpers::validate_pattern(
4334                val,
4335                "Issr",
4336                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4337                &helpers::child_path(path, "Issr"),
4338                config,
4339                collector,
4340            );
4341        }
4342    }
4343}
4344
4345// RemittanceAmount21: Amount of money remitted for the referred document.
4346#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4347pub struct RemittanceAmount21 {
4348    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
4349    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4350    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
4351    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
4352    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
4353    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4354    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
4355    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
4356    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
4357    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
4358    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4359    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4360}
4361
4362impl Validate for RemittanceAmount21 {
4363    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4364        if let Some(ref val) = self.due_pybl_amt
4365            && config.validate_optional_fields
4366        {
4367            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
4368        }
4369        if let Some(ref vec) = self.dscnt_apld_amt
4370            && config.validate_optional_fields
4371        {
4372            for item in vec {
4373                item.validate(
4374                    &helpers::child_path(path, "DscntApldAmt"),
4375                    config,
4376                    collector,
4377                );
4378            }
4379        }
4380        if let Some(ref val) = self.cdt_note_amt
4381            && config.validate_optional_fields
4382        {
4383            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
4384        }
4385        if let Some(ref vec) = self.tax_amt
4386            && config.validate_optional_fields
4387        {
4388            for item in vec {
4389                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
4390            }
4391        }
4392        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
4393            && config.validate_optional_fields
4394        {
4395            for item in vec {
4396                item.validate(
4397                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
4398                    config,
4399                    collector,
4400                );
4401            }
4402        }
4403        if let Some(ref val) = self.rmtd_amt
4404            && config.validate_optional_fields
4405        {
4406            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
4407        }
4408    }
4409}
4410
4411// RemittanceAmount31: Amount of money remitted.
4412#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4413pub struct RemittanceAmount31 {
4414    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
4415    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4416    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
4417    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
4418    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
4419    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4420    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
4421    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
4422    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
4423    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
4424    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4425    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4426}
4427
4428impl Validate for RemittanceAmount31 {
4429    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4430        if let Some(ref val) = self.due_pybl_amt
4431            && config.validate_optional_fields
4432        {
4433            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
4434        }
4435        if let Some(ref vec) = self.dscnt_apld_amt
4436            && config.validate_optional_fields
4437        {
4438            for item in vec {
4439                item.validate(
4440                    &helpers::child_path(path, "DscntApldAmt"),
4441                    config,
4442                    collector,
4443                );
4444            }
4445        }
4446        if let Some(ref val) = self.cdt_note_amt
4447            && config.validate_optional_fields
4448        {
4449            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
4450        }
4451        if let Some(ref vec) = self.tax_amt
4452            && config.validate_optional_fields
4453        {
4454            for item in vec {
4455                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
4456            }
4457        }
4458        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
4459            && config.validate_optional_fields
4460        {
4461            for item in vec {
4462                item.validate(
4463                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
4464                    config,
4465                    collector,
4466                );
4467            }
4468        }
4469        if let Some(ref val) = self.rmtd_amt
4470            && config.validate_optional_fields
4471        {
4472            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
4473        }
4474    }
4475}
4476
4477// 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.
4478#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4479pub struct RemittanceInformation161 {
4480    #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
4481    pub ustrd: Option<String>,
4482    #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
4483    pub strd: Option<Vec<StructuredRemittanceInformation161>>,
4484}
4485
4486impl Validate for RemittanceInformation161 {
4487    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4488        if let Some(ref val) = self.ustrd {
4489            helpers::validate_length(
4490                val,
4491                "Ustrd",
4492                Some(1),
4493                Some(140),
4494                &helpers::child_path(path, "Ustrd"),
4495                config,
4496                collector,
4497            );
4498        }
4499        if let Some(ref val) = self.ustrd {
4500            helpers::validate_pattern(
4501                val,
4502                "Ustrd",
4503                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4504                &helpers::child_path(path, "Ustrd"),
4505                config,
4506                collector,
4507            );
4508        }
4509        if let Some(ref vec) = self.strd
4510            && config.validate_optional_fields
4511        {
4512            for item in vec {
4513                item.validate(&helpers::child_path(path, "Strd"), config, collector);
4514            }
4515        }
4516    }
4517}
4518
4519// RemittanceInformation21: Information supplied to enable the matching of an entry with the items that the transfer is intended to settle, for example, commercial invoices in an accounts' receivable system in an unstructured form.
4520#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4521pub struct RemittanceInformation21 {
4522    #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
4523    pub ustrd: Option<String>,
4524}
4525
4526impl Validate for RemittanceInformation21 {
4527    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4528        if let Some(ref val) = self.ustrd {
4529            helpers::validate_length(
4530                val,
4531                "Ustrd",
4532                Some(1),
4533                Some(140),
4534                &helpers::child_path(path, "Ustrd"),
4535                config,
4536                collector,
4537            );
4538        }
4539        if let Some(ref val) = self.ustrd {
4540            helpers::validate_pattern(
4541                val,
4542                "Ustrd",
4543                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4544                &helpers::child_path(path, "Ustrd"),
4545                config,
4546                collector,
4547            );
4548        }
4549    }
4550}
4551
4552// ServiceLevel8Choice1: Specifies a pre-agreed service or level of service between the parties, as a proprietary code.
4553#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4554pub struct ServiceLevel8Choice1 {
4555    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4556    pub cd: Option<String>,
4557    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4558    pub prtry: Option<String>,
4559}
4560
4561impl Validate for ServiceLevel8Choice1 {
4562    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4563        if let Some(ref val) = self.cd {
4564            helpers::validate_length(
4565                val,
4566                "Cd",
4567                Some(1),
4568                Some(4),
4569                &helpers::child_path(path, "Cd"),
4570                config,
4571                collector,
4572            );
4573        }
4574        if let Some(ref val) = self.prtry {
4575            helpers::validate_length(
4576                val,
4577                "Prtry",
4578                Some(1),
4579                Some(35),
4580                &helpers::child_path(path, "Prtry"),
4581                config,
4582                collector,
4583            );
4584        }
4585        if let Some(ref val) = self.prtry {
4586            helpers::validate_pattern(
4587                val,
4588                "Prtry",
4589                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4590                &helpers::child_path(path, "Prtry"),
4591                config,
4592                collector,
4593            );
4594        }
4595    }
4596}
4597
4598// 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).
4599#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4600pub struct SettlementDateTimeIndication11 {
4601    #[serde(rename = "DbtDtTm", skip_serializing_if = "Option::is_none")]
4602    pub dbt_dt_tm: Option<String>,
4603    #[serde(rename = "CdtDtTm", skip_serializing_if = "Option::is_none")]
4604    pub cdt_dt_tm: Option<String>,
4605}
4606
4607impl Validate for SettlementDateTimeIndication11 {
4608    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4609        if let Some(ref val) = self.dbt_dt_tm {
4610            helpers::validate_pattern(
4611                val,
4612                "DbtDtTm",
4613                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
4614                &helpers::child_path(path, "DbtDtTm"),
4615                config,
4616                collector,
4617            );
4618        }
4619        if let Some(ref val) = self.cdt_dt_tm {
4620            helpers::validate_pattern(
4621                val,
4622                "CdtDtTm",
4623                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
4624                &helpers::child_path(path, "CdtDtTm"),
4625                config,
4626                collector,
4627            );
4628        }
4629    }
4630}
4631
4632// SettlementInstruction71: A specific purpose account used to post debit and credit entries as a result of the transaction.
4633#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4634pub struct SettlementInstruction71 {
4635    #[serde(rename = "SttlmMtd")]
4636    pub sttlm_mtd: SettlementMethod1Code1,
4637    #[serde(rename = "SttlmAcct", skip_serializing_if = "Option::is_none")]
4638    pub sttlm_acct: Option<CashAccount381>,
4639}
4640
4641impl Validate for SettlementInstruction71 {
4642    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4643        self.sttlm_mtd
4644            .validate(&helpers::child_path(path, "SttlmMtd"), config, collector);
4645        if let Some(ref val) = self.sttlm_acct
4646            && config.validate_optional_fields
4647        {
4648            val.validate(&helpers::child_path(path, "SttlmAcct"), config, collector);
4649        }
4650    }
4651}
4652
4653// SettlementMethod1Code__1: Settlement is done by the agent instructing and forwarding the payment to the next party in the payment chain.
4654#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4655pub enum SettlementMethod1Code1 {
4656    #[default]
4657    #[serde(rename = "INDA")]
4658    CodeINDA,
4659    #[serde(rename = "INGA")]
4660    CodeINGA,
4661}
4662
4663impl Validate for SettlementMethod1Code1 {
4664    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
4665        // Enum validation is typically empty
4666    }
4667}
4668
4669// SettlementTimeRequest21: Time by when the payment must be settled to avoid rejection.
4670#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4671pub struct SettlementTimeRequest21 {
4672    #[serde(rename = "CLSTm", skip_serializing_if = "Option::is_none")]
4673    pub cls_tm: Option<String>,
4674    #[serde(rename = "TillTm", skip_serializing_if = "Option::is_none")]
4675    pub till_tm: Option<String>,
4676    #[serde(rename = "FrTm", skip_serializing_if = "Option::is_none")]
4677    pub fr_tm: Option<String>,
4678    #[serde(rename = "RjctTm", skip_serializing_if = "Option::is_none")]
4679    pub rjct_tm: Option<String>,
4680}
4681
4682impl Validate for SettlementTimeRequest21 {
4683    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4684        if let Some(ref val) = self.cls_tm {
4685            helpers::validate_pattern(
4686                val,
4687                "CLSTm",
4688                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
4689                &helpers::child_path(path, "CLSTm"),
4690                config,
4691                collector,
4692            );
4693        }
4694        if let Some(ref val) = self.till_tm {
4695            helpers::validate_pattern(
4696                val,
4697                "TillTm",
4698                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
4699                &helpers::child_path(path, "TillTm"),
4700                config,
4701                collector,
4702            );
4703        }
4704        if let Some(ref val) = self.fr_tm {
4705            helpers::validate_pattern(
4706                val,
4707                "FrTm",
4708                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
4709                &helpers::child_path(path, "FrTm"),
4710                config,
4711                collector,
4712            );
4713        }
4714        if let Some(ref val) = self.rjct_tm {
4715            helpers::validate_pattern(
4716                val,
4717                "RjctTm",
4718                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
4719                &helpers::child_path(path, "RjctTm"),
4720                config,
4721                collector,
4722            );
4723        }
4724    }
4725}
4726
4727// StructuredRemittanceInformation161: Additional information, in free text form, to complement the structured remittance information.
4728#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4729pub struct StructuredRemittanceInformation161 {
4730    #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
4731    pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
4732    #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
4733    pub rfrd_doc_amt: Option<RemittanceAmount21>,
4734    #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
4735    pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
4736    #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
4737    pub invcr: Option<PartyIdentification1354>,
4738    #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
4739    pub invcee: Option<PartyIdentification1354>,
4740    #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
4741    pub tax_rmt: Option<TaxInformation71>,
4742    #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
4743    pub grnshmt_rmt: Option<Garnishment31>,
4744    #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
4745    pub addtl_rmt_inf: Option<Vec<String>>,
4746}
4747
4748impl Validate for StructuredRemittanceInformation161 {
4749    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4750        if let Some(ref vec) = self.rfrd_doc_inf
4751            && config.validate_optional_fields
4752        {
4753            for item in vec {
4754                item.validate(&helpers::child_path(path, "RfrdDocInf"), config, collector);
4755            }
4756        }
4757        if let Some(ref val) = self.rfrd_doc_amt
4758            && config.validate_optional_fields
4759        {
4760            val.validate(&helpers::child_path(path, "RfrdDocAmt"), config, collector);
4761        }
4762        if let Some(ref val) = self.cdtr_ref_inf
4763            && config.validate_optional_fields
4764        {
4765            val.validate(&helpers::child_path(path, "CdtrRefInf"), config, collector);
4766        }
4767        if let Some(ref val) = self.invcr
4768            && config.validate_optional_fields
4769        {
4770            val.validate(&helpers::child_path(path, "Invcr"), config, collector);
4771        }
4772        if let Some(ref val) = self.invcee
4773            && config.validate_optional_fields
4774        {
4775            val.validate(&helpers::child_path(path, "Invcee"), config, collector);
4776        }
4777        if let Some(ref val) = self.tax_rmt
4778            && config.validate_optional_fields
4779        {
4780            val.validate(&helpers::child_path(path, "TaxRmt"), config, collector);
4781        }
4782        if let Some(ref val) = self.grnshmt_rmt
4783            && config.validate_optional_fields
4784        {
4785            val.validate(&helpers::child_path(path, "GrnshmtRmt"), config, collector);
4786        }
4787        if let Some(ref vec) = self.addtl_rmt_inf {
4788            for item in vec {
4789                helpers::validate_length(
4790                    item,
4791                    "AddtlRmtInf",
4792                    Some(1),
4793                    Some(140),
4794                    &helpers::child_path(path, "AddtlRmtInf"),
4795                    config,
4796                    collector,
4797                );
4798            }
4799        }
4800        if let Some(ref vec) = self.addtl_rmt_inf {
4801            for item in vec {
4802                helpers::validate_pattern(
4803                    item,
4804                    "AddtlRmtInf",
4805                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4806                    &helpers::child_path(path, "AddtlRmtInf"),
4807                    config,
4808                    collector,
4809                );
4810            }
4811        }
4812    }
4813}
4814
4815// TaxAmount2: Set of elements used to provide details on the tax period and amount.
4816#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4817pub struct TaxAmount2 {
4818    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
4819    pub rate: Option<f64>,
4820    #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
4821    pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4822    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
4823    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4824    #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
4825    pub dtls: Option<Vec<TaxRecordDetails2>>,
4826}
4827
4828impl Validate for TaxAmount2 {
4829    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4830        if let Some(ref val) = self.taxbl_base_amt
4831            && config.validate_optional_fields
4832        {
4833            val.validate(
4834                &helpers::child_path(path, "TaxblBaseAmt"),
4835                config,
4836                collector,
4837            );
4838        }
4839        if let Some(ref val) = self.ttl_amt
4840            && config.validate_optional_fields
4841        {
4842            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
4843        }
4844        if let Some(ref vec) = self.dtls
4845            && config.validate_optional_fields
4846        {
4847            for item in vec {
4848                item.validate(&helpers::child_path(path, "Dtls"), config, collector);
4849            }
4850        }
4851    }
4852}
4853
4854// TaxAmountAndType11: Amount of money, which has been typed.
4855#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4856pub struct TaxAmountAndType11 {
4857    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4858    pub tp: Option<TaxAmountType1Choice1>,
4859    #[serde(rename = "Amt")]
4860    pub amt: ActiveOrHistoricCurrencyAndAmount,
4861}
4862
4863impl Validate for TaxAmountAndType11 {
4864    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4865        if let Some(ref val) = self.tp
4866            && config.validate_optional_fields
4867        {
4868            val.validate(&helpers::child_path(path, "Tp"), config, collector);
4869        }
4870        self.amt
4871            .validate(&helpers::child_path(path, "Amt"), config, collector);
4872    }
4873}
4874
4875// TaxAmountType1Choice1: Specifies the amount type, in a free-text form.
4876#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4877pub struct TaxAmountType1Choice1 {
4878    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4879    pub cd: Option<String>,
4880    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4881    pub prtry: Option<String>,
4882}
4883
4884impl Validate for TaxAmountType1Choice1 {
4885    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4886        if let Some(ref val) = self.cd {
4887            helpers::validate_length(
4888                val,
4889                "Cd",
4890                Some(1),
4891                Some(4),
4892                &helpers::child_path(path, "Cd"),
4893                config,
4894                collector,
4895            );
4896        }
4897        if let Some(ref val) = self.prtry {
4898            helpers::validate_length(
4899                val,
4900                "Prtry",
4901                Some(1),
4902                Some(35),
4903                &helpers::child_path(path, "Prtry"),
4904                config,
4905                collector,
4906            );
4907        }
4908        if let Some(ref val) = self.prtry {
4909            helpers::validate_pattern(
4910                val,
4911                "Prtry",
4912                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4913                &helpers::child_path(path, "Prtry"),
4914                config,
4915                collector,
4916            );
4917        }
4918    }
4919}
4920
4921// TaxAuthorisation11: Name of the debtor or the debtor's authorised representative.
4922#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4923pub struct TaxAuthorisation11 {
4924    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
4925    pub titl: Option<String>,
4926    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4927    pub nm: Option<String>,
4928}
4929
4930impl Validate for TaxAuthorisation11 {
4931    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4932        if let Some(ref val) = self.titl {
4933            helpers::validate_length(
4934                val,
4935                "Titl",
4936                Some(1),
4937                Some(35),
4938                &helpers::child_path(path, "Titl"),
4939                config,
4940                collector,
4941            );
4942        }
4943        if let Some(ref val) = self.titl {
4944            helpers::validate_pattern(
4945                val,
4946                "Titl",
4947                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4948                &helpers::child_path(path, "Titl"),
4949                config,
4950                collector,
4951            );
4952        }
4953        if let Some(ref val) = self.nm {
4954            helpers::validate_length(
4955                val,
4956                "Nm",
4957                Some(1),
4958                Some(140),
4959                &helpers::child_path(path, "Nm"),
4960                config,
4961                collector,
4962            );
4963        }
4964        if let Some(ref val) = self.nm {
4965            helpers::validate_pattern(
4966                val,
4967                "Nm",
4968                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4969                &helpers::child_path(path, "Nm"),
4970                config,
4971                collector,
4972            );
4973        }
4974    }
4975}
4976
4977// TaxInformation71: Record of tax details.
4978#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4979pub struct TaxInformation71 {
4980    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
4981    pub cdtr: Option<TaxParty11>,
4982    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
4983    pub dbtr: Option<TaxParty21>,
4984    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
4985    pub ultmt_dbtr: Option<TaxParty21>,
4986    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
4987    pub admstn_zone: Option<String>,
4988    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4989    pub ref_nb: Option<String>,
4990    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
4991    pub mtd: Option<String>,
4992    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
4993    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4994    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
4995    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4996    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4997    pub dt: Option<String>,
4998    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
4999    pub seq_nb: Option<f64>,
5000    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
5001    pub rcrd: Option<Vec<TaxRecord21>>,
5002}
5003
5004impl Validate for TaxInformation71 {
5005    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5006        if let Some(ref val) = self.cdtr
5007            && config.validate_optional_fields
5008        {
5009            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
5010        }
5011        if let Some(ref val) = self.dbtr
5012            && config.validate_optional_fields
5013        {
5014            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
5015        }
5016        if let Some(ref val) = self.ultmt_dbtr
5017            && config.validate_optional_fields
5018        {
5019            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
5020        }
5021        if let Some(ref val) = self.admstn_zone {
5022            helpers::validate_length(
5023                val,
5024                "AdmstnZone",
5025                Some(1),
5026                Some(35),
5027                &helpers::child_path(path, "AdmstnZone"),
5028                config,
5029                collector,
5030            );
5031        }
5032        if let Some(ref val) = self.admstn_zone {
5033            helpers::validate_pattern(
5034                val,
5035                "AdmstnZone",
5036                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5037                &helpers::child_path(path, "AdmstnZone"),
5038                config,
5039                collector,
5040            );
5041        }
5042        if let Some(ref val) = self.ref_nb {
5043            helpers::validate_length(
5044                val,
5045                "RefNb",
5046                Some(1),
5047                Some(140),
5048                &helpers::child_path(path, "RefNb"),
5049                config,
5050                collector,
5051            );
5052        }
5053        if let Some(ref val) = self.ref_nb {
5054            helpers::validate_pattern(
5055                val,
5056                "RefNb",
5057                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5058                &helpers::child_path(path, "RefNb"),
5059                config,
5060                collector,
5061            );
5062        }
5063        if let Some(ref val) = self.mtd {
5064            helpers::validate_length(
5065                val,
5066                "Mtd",
5067                Some(1),
5068                Some(35),
5069                &helpers::child_path(path, "Mtd"),
5070                config,
5071                collector,
5072            );
5073        }
5074        if let Some(ref val) = self.mtd {
5075            helpers::validate_pattern(
5076                val,
5077                "Mtd",
5078                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5079                &helpers::child_path(path, "Mtd"),
5080                config,
5081                collector,
5082            );
5083        }
5084        if let Some(ref val) = self.ttl_taxbl_base_amt
5085            && config.validate_optional_fields
5086        {
5087            val.validate(
5088                &helpers::child_path(path, "TtlTaxblBaseAmt"),
5089                config,
5090                collector,
5091            );
5092        }
5093        if let Some(ref val) = self.ttl_tax_amt
5094            && config.validate_optional_fields
5095        {
5096            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
5097        }
5098        if let Some(ref vec) = self.rcrd
5099            && config.validate_optional_fields
5100        {
5101            for item in vec {
5102                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
5103            }
5104        }
5105    }
5106}
5107
5108// TaxParty11: Type of tax payer.
5109#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5110pub struct TaxParty11 {
5111    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
5112    pub tax_id: Option<String>,
5113    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
5114    pub regn_id: Option<String>,
5115    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
5116    pub tax_tp: Option<String>,
5117}
5118
5119impl Validate for TaxParty11 {
5120    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5121        if let Some(ref val) = self.tax_id {
5122            helpers::validate_length(
5123                val,
5124                "TaxId",
5125                Some(1),
5126                Some(35),
5127                &helpers::child_path(path, "TaxId"),
5128                config,
5129                collector,
5130            );
5131        }
5132        if let Some(ref val) = self.tax_id {
5133            helpers::validate_pattern(
5134                val,
5135                "TaxId",
5136                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5137                &helpers::child_path(path, "TaxId"),
5138                config,
5139                collector,
5140            );
5141        }
5142        if let Some(ref val) = self.regn_id {
5143            helpers::validate_length(
5144                val,
5145                "RegnId",
5146                Some(1),
5147                Some(35),
5148                &helpers::child_path(path, "RegnId"),
5149                config,
5150                collector,
5151            );
5152        }
5153        if let Some(ref val) = self.regn_id {
5154            helpers::validate_pattern(
5155                val,
5156                "RegnId",
5157                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5158                &helpers::child_path(path, "RegnId"),
5159                config,
5160                collector,
5161            );
5162        }
5163        if let Some(ref val) = self.tax_tp {
5164            helpers::validate_length(
5165                val,
5166                "TaxTp",
5167                Some(1),
5168                Some(35),
5169                &helpers::child_path(path, "TaxTp"),
5170                config,
5171                collector,
5172            );
5173        }
5174        if let Some(ref val) = self.tax_tp {
5175            helpers::validate_pattern(
5176                val,
5177                "TaxTp",
5178                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5179                &helpers::child_path(path, "TaxTp"),
5180                config,
5181                collector,
5182            );
5183        }
5184    }
5185}
5186
5187// TaxParty21: Details of the authorised tax paying party.
5188#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5189pub struct TaxParty21 {
5190    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
5191    pub tax_id: Option<String>,
5192    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
5193    pub regn_id: Option<String>,
5194    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
5195    pub tax_tp: Option<String>,
5196    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
5197    pub authstn: Option<TaxAuthorisation11>,
5198}
5199
5200impl Validate for TaxParty21 {
5201    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5202        if let Some(ref val) = self.tax_id {
5203            helpers::validate_length(
5204                val,
5205                "TaxId",
5206                Some(1),
5207                Some(35),
5208                &helpers::child_path(path, "TaxId"),
5209                config,
5210                collector,
5211            );
5212        }
5213        if let Some(ref val) = self.tax_id {
5214            helpers::validate_pattern(
5215                val,
5216                "TaxId",
5217                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5218                &helpers::child_path(path, "TaxId"),
5219                config,
5220                collector,
5221            );
5222        }
5223        if let Some(ref val) = self.regn_id {
5224            helpers::validate_length(
5225                val,
5226                "RegnId",
5227                Some(1),
5228                Some(35),
5229                &helpers::child_path(path, "RegnId"),
5230                config,
5231                collector,
5232            );
5233        }
5234        if let Some(ref val) = self.regn_id {
5235            helpers::validate_pattern(
5236                val,
5237                "RegnId",
5238                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5239                &helpers::child_path(path, "RegnId"),
5240                config,
5241                collector,
5242            );
5243        }
5244        if let Some(ref val) = self.tax_tp {
5245            helpers::validate_length(
5246                val,
5247                "TaxTp",
5248                Some(1),
5249                Some(35),
5250                &helpers::child_path(path, "TaxTp"),
5251                config,
5252                collector,
5253            );
5254        }
5255        if let Some(ref val) = self.tax_tp {
5256            helpers::validate_pattern(
5257                val,
5258                "TaxTp",
5259                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5260                &helpers::child_path(path, "TaxTp"),
5261                config,
5262                collector,
5263            );
5264        }
5265        if let Some(ref val) = self.authstn
5266            && config.validate_optional_fields
5267        {
5268            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
5269        }
5270    }
5271}
5272
5273// TaxPeriod2: Range of time between a start date and an end date for which the tax report is provided.
5274#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5275pub struct TaxPeriod2 {
5276    #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
5277    pub yr: Option<String>,
5278    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5279    pub tp: Option<TaxRecordPeriod1Code>,
5280    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5281    pub fr_to_dt: Option<DatePeriod2>,
5282}
5283
5284impl Validate for TaxPeriod2 {
5285    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5286        if let Some(ref val) = self.tp
5287            && config.validate_optional_fields
5288        {
5289            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5290        }
5291        if let Some(ref val) = self.fr_to_dt
5292            && config.validate_optional_fields
5293        {
5294            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
5295        }
5296    }
5297}
5298
5299// TaxRecord21: Further details of the tax record.
5300#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5301pub struct TaxRecord21 {
5302    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5303    pub tp: Option<String>,
5304    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
5305    pub ctgy: Option<String>,
5306    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
5307    pub ctgy_dtls: Option<String>,
5308    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
5309    pub dbtr_sts: Option<String>,
5310    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
5311    pub cert_id: Option<String>,
5312    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
5313    pub frms_cd: Option<String>,
5314    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
5315    pub prd: Option<TaxPeriod2>,
5316    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
5317    pub tax_amt: Option<TaxAmount2>,
5318    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
5319    pub addtl_inf: Option<String>,
5320}
5321
5322impl Validate for TaxRecord21 {
5323    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5324        if let Some(ref val) = self.tp {
5325            helpers::validate_length(
5326                val,
5327                "Tp",
5328                Some(1),
5329                Some(35),
5330                &helpers::child_path(path, "Tp"),
5331                config,
5332                collector,
5333            );
5334        }
5335        if let Some(ref val) = self.tp {
5336            helpers::validate_pattern(
5337                val,
5338                "Tp",
5339                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5340                &helpers::child_path(path, "Tp"),
5341                config,
5342                collector,
5343            );
5344        }
5345        if let Some(ref val) = self.ctgy {
5346            helpers::validate_length(
5347                val,
5348                "Ctgy",
5349                Some(1),
5350                Some(35),
5351                &helpers::child_path(path, "Ctgy"),
5352                config,
5353                collector,
5354            );
5355        }
5356        if let Some(ref val) = self.ctgy {
5357            helpers::validate_pattern(
5358                val,
5359                "Ctgy",
5360                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5361                &helpers::child_path(path, "Ctgy"),
5362                config,
5363                collector,
5364            );
5365        }
5366        if let Some(ref val) = self.ctgy_dtls {
5367            helpers::validate_length(
5368                val,
5369                "CtgyDtls",
5370                Some(1),
5371                Some(35),
5372                &helpers::child_path(path, "CtgyDtls"),
5373                config,
5374                collector,
5375            );
5376        }
5377        if let Some(ref val) = self.ctgy_dtls {
5378            helpers::validate_pattern(
5379                val,
5380                "CtgyDtls",
5381                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5382                &helpers::child_path(path, "CtgyDtls"),
5383                config,
5384                collector,
5385            );
5386        }
5387        if let Some(ref val) = self.dbtr_sts {
5388            helpers::validate_length(
5389                val,
5390                "DbtrSts",
5391                Some(1),
5392                Some(35),
5393                &helpers::child_path(path, "DbtrSts"),
5394                config,
5395                collector,
5396            );
5397        }
5398        if let Some(ref val) = self.dbtr_sts {
5399            helpers::validate_pattern(
5400                val,
5401                "DbtrSts",
5402                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5403                &helpers::child_path(path, "DbtrSts"),
5404                config,
5405                collector,
5406            );
5407        }
5408        if let Some(ref val) = self.cert_id {
5409            helpers::validate_length(
5410                val,
5411                "CertId",
5412                Some(1),
5413                Some(35),
5414                &helpers::child_path(path, "CertId"),
5415                config,
5416                collector,
5417            );
5418        }
5419        if let Some(ref val) = self.cert_id {
5420            helpers::validate_pattern(
5421                val,
5422                "CertId",
5423                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5424                &helpers::child_path(path, "CertId"),
5425                config,
5426                collector,
5427            );
5428        }
5429        if let Some(ref val) = self.frms_cd {
5430            helpers::validate_length(
5431                val,
5432                "FrmsCd",
5433                Some(1),
5434                Some(35),
5435                &helpers::child_path(path, "FrmsCd"),
5436                config,
5437                collector,
5438            );
5439        }
5440        if let Some(ref val) = self.frms_cd {
5441            helpers::validate_pattern(
5442                val,
5443                "FrmsCd",
5444                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5445                &helpers::child_path(path, "FrmsCd"),
5446                config,
5447                collector,
5448            );
5449        }
5450        if let Some(ref val) = self.prd
5451            && config.validate_optional_fields
5452        {
5453            val.validate(&helpers::child_path(path, "Prd"), config, collector);
5454        }
5455        if let Some(ref val) = self.tax_amt
5456            && config.validate_optional_fields
5457        {
5458            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
5459        }
5460        if let Some(ref val) = self.addtl_inf {
5461            helpers::validate_length(
5462                val,
5463                "AddtlInf",
5464                Some(1),
5465                Some(140),
5466                &helpers::child_path(path, "AddtlInf"),
5467                config,
5468                collector,
5469            );
5470        }
5471        if let Some(ref val) = self.addtl_inf {
5472            helpers::validate_pattern(
5473                val,
5474                "AddtlInf",
5475                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5476                &helpers::child_path(path, "AddtlInf"),
5477                config,
5478                collector,
5479            );
5480        }
5481    }
5482}
5483
5484// TaxRecordDetails2: Underlying tax amount related to the specified period.
5485#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5486pub struct TaxRecordDetails2 {
5487    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
5488    pub prd: Option<TaxPeriod2>,
5489    #[serde(rename = "Amt")]
5490    pub amt: ActiveOrHistoricCurrencyAndAmount,
5491}
5492
5493impl Validate for TaxRecordDetails2 {
5494    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5495        if let Some(ref val) = self.prd
5496            && config.validate_optional_fields
5497        {
5498            val.validate(&helpers::child_path(path, "Prd"), config, collector);
5499        }
5500        self.amt
5501            .validate(&helpers::child_path(path, "Amt"), config, collector);
5502    }
5503}
5504
5505// TaxRecordPeriod1Code: Tax is related to the second half of the period.
5506#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5507pub enum TaxRecordPeriod1Code {
5508    #[default]
5509    #[serde(rename = "MM01")]
5510    CodeMM01,
5511    #[serde(rename = "MM02")]
5512    CodeMM02,
5513    #[serde(rename = "MM03")]
5514    CodeMM03,
5515    #[serde(rename = "MM04")]
5516    CodeMM04,
5517    #[serde(rename = "MM05")]
5518    CodeMM05,
5519    #[serde(rename = "MM06")]
5520    CodeMM06,
5521    #[serde(rename = "MM07")]
5522    CodeMM07,
5523    #[serde(rename = "MM08")]
5524    CodeMM08,
5525    #[serde(rename = "MM09")]
5526    CodeMM09,
5527    #[serde(rename = "MM10")]
5528    CodeMM10,
5529    #[serde(rename = "MM11")]
5530    CodeMM11,
5531    #[serde(rename = "MM12")]
5532    CodeMM12,
5533    #[serde(rename = "QTR1")]
5534    CodeQTR1,
5535    #[serde(rename = "QTR2")]
5536    CodeQTR2,
5537    #[serde(rename = "QTR3")]
5538    CodeQTR3,
5539    #[serde(rename = "QTR4")]
5540    CodeQTR4,
5541    #[serde(rename = "HLF1")]
5542    CodeHLF1,
5543    #[serde(rename = "HLF2")]
5544    CodeHLF2,
5545}
5546
5547impl Validate for TaxRecordPeriod1Code {
5548    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5549        // Enum validation is typically empty
5550    }
5551}