mx_message/document/
pacs_008_001_08.rs

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