mx_message/document/
camt_052_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// AccountInterest41: Provides details on the tax applied to charges.
53#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
54pub struct AccountInterest41 {
55    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
56    pub tp: Option<InterestType1Choice1>,
57    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
58    pub rate: Option<Vec<Rate41>>,
59    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
60    pub fr_to_dt: Option<DateTimePeriod11>,
61    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
62    pub rsn: Option<String>,
63    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
64    pub tax: Option<TaxCharges21>,
65}
66
67impl Validate for AccountInterest41 {
68    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
69        if let Some(ref val) = self.tp
70            && config.validate_optional_fields
71        {
72            val.validate(&helpers::child_path(path, "Tp"), config, collector);
73        }
74        if let Some(ref vec) = self.rate
75            && config.validate_optional_fields
76        {
77            for item in vec {
78                item.validate(&helpers::child_path(path, "Rate"), config, collector);
79            }
80        }
81        if let Some(ref val) = self.fr_to_dt
82            && config.validate_optional_fields
83        {
84            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
85        }
86        if let Some(ref val) = self.rsn {
87            helpers::validate_length(
88                val,
89                "Rsn",
90                Some(1),
91                Some(35),
92                &helpers::child_path(path, "Rsn"),
93                config,
94                collector,
95            );
96        }
97        if let Some(ref val) = self.rsn {
98            helpers::validate_pattern(
99                val,
100                "Rsn",
101                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
102                &helpers::child_path(path, "Rsn"),
103                config,
104                collector,
105            );
106        }
107        if let Some(ref val) = self.tax
108            && config.validate_optional_fields
109        {
110            val.validate(&helpers::child_path(path, "Tax"), config, collector);
111        }
112    }
113}
114
115// AccountReport251: Further details of the account report.
116#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
117pub struct AccountReport251 {
118    #[serde(rename = "Id")]
119    pub id: String,
120    #[serde(rename = "RptPgntn")]
121    pub rpt_pgntn: Pagination1,
122    #[serde(rename = "ElctrncSeqNb", skip_serializing_if = "Option::is_none")]
123    pub elctrnc_seq_nb: Option<f64>,
124    #[serde(rename = "RptgSeq", skip_serializing_if = "Option::is_none")]
125    pub rptg_seq: Option<SequenceRange1Choice1>,
126    #[serde(rename = "LglSeqNb", skip_serializing_if = "Option::is_none")]
127    pub lgl_seq_nb: Option<f64>,
128    #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
129    pub cre_dt_tm: Option<String>,
130    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
131    pub fr_to_dt: Option<DateTimePeriod11>,
132    #[serde(rename = "CpyDplctInd", skip_serializing_if = "Option::is_none")]
133    pub cpy_dplct_ind: Option<CopyDuplicate1Code>,
134    #[serde(rename = "RptgSrc", skip_serializing_if = "Option::is_none")]
135    pub rptg_src: Option<ReportingSource1Choice1>,
136    #[serde(rename = "Acct")]
137    pub acct: CashAccount391,
138    #[serde(rename = "RltdAcct", skip_serializing_if = "Option::is_none")]
139    pub rltd_acct: Option<CashAccount381>,
140    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
141    pub intrst: Option<Vec<AccountInterest41>>,
142    #[serde(rename = "Bal", skip_serializing_if = "Option::is_none")]
143    pub bal: Option<Vec<CashBalance81>>,
144    #[serde(rename = "TxsSummry", skip_serializing_if = "Option::is_none")]
145    pub txs_summry: Option<TotalTransactions61>,
146    #[serde(rename = "Ntry", skip_serializing_if = "Option::is_none")]
147    pub ntry: Option<Vec<ReportEntry101>>,
148    #[serde(rename = "AddtlRptInf", skip_serializing_if = "Option::is_none")]
149    pub addtl_rpt_inf: Option<String>,
150}
151
152impl Validate for AccountReport251 {
153    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
154        helpers::validate_length(
155            &self.id,
156            "Id",
157            Some(1),
158            Some(35),
159            &helpers::child_path(path, "Id"),
160            config,
161            collector,
162        );
163        helpers::validate_pattern(
164            &self.id,
165            "Id",
166            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
167            &helpers::child_path(path, "Id"),
168            config,
169            collector,
170        );
171        self.rpt_pgntn
172            .validate(&helpers::child_path(path, "RptPgntn"), config, collector);
173        if let Some(ref val) = self.rptg_seq
174            && config.validate_optional_fields
175        {
176            val.validate(&helpers::child_path(path, "RptgSeq"), config, collector);
177        }
178        if let Some(ref val) = self.cre_dt_tm {
179            helpers::validate_pattern(
180                val,
181                "CreDtTm",
182                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
183                &helpers::child_path(path, "CreDtTm"),
184                config,
185                collector,
186            );
187        }
188        if let Some(ref val) = self.fr_to_dt
189            && config.validate_optional_fields
190        {
191            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
192        }
193        if let Some(ref val) = self.cpy_dplct_ind
194            && config.validate_optional_fields
195        {
196            val.validate(&helpers::child_path(path, "CpyDplctInd"), config, collector);
197        }
198        if let Some(ref val) = self.rptg_src
199            && config.validate_optional_fields
200        {
201            val.validate(&helpers::child_path(path, "RptgSrc"), config, collector);
202        }
203        self.acct
204            .validate(&helpers::child_path(path, "Acct"), config, collector);
205        if let Some(ref val) = self.rltd_acct
206            && config.validate_optional_fields
207        {
208            val.validate(&helpers::child_path(path, "RltdAcct"), config, collector);
209        }
210        if let Some(ref vec) = self.intrst
211            && config.validate_optional_fields
212        {
213            for item in vec {
214                item.validate(&helpers::child_path(path, "Intrst"), config, collector);
215            }
216        }
217        if let Some(ref vec) = self.bal
218            && config.validate_optional_fields
219        {
220            for item in vec {
221                item.validate(&helpers::child_path(path, "Bal"), config, collector);
222            }
223        }
224        if let Some(ref val) = self.txs_summry
225            && config.validate_optional_fields
226        {
227            val.validate(&helpers::child_path(path, "TxsSummry"), config, collector);
228        }
229        if let Some(ref vec) = self.ntry
230            && config.validate_optional_fields
231        {
232            for item in vec {
233                item.validate(&helpers::child_path(path, "Ntry"), config, collector);
234            }
235        }
236        if let Some(ref val) = self.addtl_rpt_inf {
237            helpers::validate_length(
238                val,
239                "AddtlRptInf",
240                Some(1),
241                Some(500),
242                &helpers::child_path(path, "AddtlRptInf"),
243                config,
244                collector,
245            );
246        }
247        if let Some(ref val) = self.addtl_rpt_inf {
248            helpers::validate_pattern(
249                val,
250                "AddtlRptInf",
251                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
252                &helpers::child_path(path, "AddtlRptInf"),
253                config,
254                collector,
255            );
256        }
257    }
258}
259
260// AccountSchemeName1Choice1: Name of the identification scheme, in a free text form.
261#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
262pub struct AccountSchemeName1Choice1 {
263    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
264    pub cd: Option<String>,
265    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
266    pub prtry: Option<String>,
267}
268
269impl Validate for AccountSchemeName1Choice1 {
270    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
271        if let Some(ref val) = self.cd {
272            helpers::validate_length(
273                val,
274                "Cd",
275                Some(1),
276                Some(4),
277                &helpers::child_path(path, "Cd"),
278                config,
279                collector,
280            );
281        }
282        if let Some(ref val) = self.prtry {
283            helpers::validate_length(
284                val,
285                "Prtry",
286                Some(1),
287                Some(35),
288                &helpers::child_path(path, "Prtry"),
289                config,
290                collector,
291            );
292        }
293        if let Some(ref val) = self.prtry {
294            helpers::validate_pattern(
295                val,
296                "Prtry",
297                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
298                &helpers::child_path(path, "Prtry"),
299                config,
300                collector,
301            );
302        }
303    }
304}
305
306// 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.
307#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
308pub struct ActiveOrHistoricCurrencyAndAmount {
309    #[serde(rename = "@Ccy")]
310    pub ccy: String,
311    #[serde(rename = "$value")]
312    pub value: f64,
313}
314
315impl Validate for ActiveOrHistoricCurrencyAndAmount {
316    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
317}
318
319// ActiveOrHistoricCurrencyAndAmountRange2: Medium of exchange of value, used to qualify an amount.
320#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
321pub struct ActiveOrHistoricCurrencyAndAmountRange2 {
322    #[serde(rename = "Amt")]
323    pub amt: ImpliedCurrencyAmountRange1Choice,
324    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
325    pub cdt_dbt_ind: Option<CreditDebitCode>,
326    #[serde(rename = "Ccy")]
327    pub ccy: String,
328}
329
330impl Validate for ActiveOrHistoricCurrencyAndAmountRange2 {
331    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
332        self.amt
333            .validate(&helpers::child_path(path, "Amt"), config, collector);
334        if let Some(ref val) = self.cdt_dbt_ind
335            && config.validate_optional_fields
336        {
337            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
338        }
339        helpers::validate_pattern(
340            &self.ccy,
341            "Ccy",
342            "[A-Z]{3,3}",
343            &helpers::child_path(path, "Ccy"),
344            config,
345            collector,
346        );
347    }
348}
349
350// AddressType2Code: Address is the address to which delivery is to take place.
351#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
352pub enum AddressType2Code {
353    #[default]
354    #[serde(rename = "ADDR")]
355    CodeADDR,
356    #[serde(rename = "PBOX")]
357    CodePBOX,
358    #[serde(rename = "HOME")]
359    CodeHOME,
360    #[serde(rename = "BIZZ")]
361    CodeBIZZ,
362    #[serde(rename = "MLTO")]
363    CodeMLTO,
364    #[serde(rename = "DLVY")]
365    CodeDLVY,
366}
367
368impl Validate for AddressType2Code {
369    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
370        // Enum validation is typically empty
371    }
372}
373
374// AddressType3Choice1: Type of address expressed as a proprietary code.
375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
376pub struct AddressType3Choice1 {
377    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
378    pub cd: Option<AddressType2Code>,
379    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
380    pub prtry: Option<GenericIdentification301>,
381}
382
383impl Validate for AddressType3Choice1 {
384    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
385        if let Some(ref val) = self.cd
386            && config.validate_optional_fields
387        {
388            val.validate(&helpers::child_path(path, "Cd"), config, collector);
389        }
390        if let Some(ref val) = self.prtry
391            && config.validate_optional_fields
392        {
393            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
394        }
395    }
396}
397
398// AmountAndCurrencyExchange31: Set of elements used to provide information on the original amount and currency exchange.
399#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
400pub struct AmountAndCurrencyExchange31 {
401    #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
402    pub instd_amt: Option<AmountAndCurrencyExchangeDetails31>,
403    #[serde(rename = "TxAmt", skip_serializing_if = "Option::is_none")]
404    pub tx_amt: Option<AmountAndCurrencyExchangeDetails31>,
405    #[serde(rename = "CntrValAmt", skip_serializing_if = "Option::is_none")]
406    pub cntr_val_amt: Option<AmountAndCurrencyExchangeDetails31>,
407    #[serde(rename = "AnncdPstngAmt", skip_serializing_if = "Option::is_none")]
408    pub anncd_pstng_amt: Option<AmountAndCurrencyExchangeDetails31>,
409    #[serde(rename = "PrtryAmt", skip_serializing_if = "Option::is_none")]
410    pub prtry_amt: Option<Vec<AmountAndCurrencyExchangeDetails41>>,
411}
412
413impl Validate for AmountAndCurrencyExchange31 {
414    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
415        if let Some(ref val) = self.instd_amt
416            && config.validate_optional_fields
417        {
418            val.validate(&helpers::child_path(path, "InstdAmt"), config, collector);
419        }
420        if let Some(ref val) = self.tx_amt
421            && config.validate_optional_fields
422        {
423            val.validate(&helpers::child_path(path, "TxAmt"), config, collector);
424        }
425        if let Some(ref val) = self.cntr_val_amt
426            && config.validate_optional_fields
427        {
428            val.validate(&helpers::child_path(path, "CntrValAmt"), config, collector);
429        }
430        if let Some(ref val) = self.anncd_pstng_amt
431            && config.validate_optional_fields
432        {
433            val.validate(
434                &helpers::child_path(path, "AnncdPstngAmt"),
435                config,
436                collector,
437            );
438        }
439        if let Some(ref vec) = self.prtry_amt
440            && config.validate_optional_fields
441        {
442            for item in vec {
443                item.validate(&helpers::child_path(path, "PrtryAmt"), config, collector);
444            }
445        }
446    }
447}
448
449// AmountAndCurrencyExchange32: Set of elements used to provide information on the original amount and currency exchange.
450#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
451pub struct AmountAndCurrencyExchange32 {
452    #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
453    pub instd_amt: Option<AmountAndCurrencyExchangeDetails32>,
454    #[serde(rename = "TxAmt", skip_serializing_if = "Option::is_none")]
455    pub tx_amt: Option<AmountAndCurrencyExchangeDetails32>,
456    #[serde(rename = "CntrValAmt", skip_serializing_if = "Option::is_none")]
457    pub cntr_val_amt: Option<AmountAndCurrencyExchangeDetails32>,
458    #[serde(rename = "AnncdPstngAmt", skip_serializing_if = "Option::is_none")]
459    pub anncd_pstng_amt: Option<AmountAndCurrencyExchangeDetails32>,
460    #[serde(rename = "PrtryAmt", skip_serializing_if = "Option::is_none")]
461    pub prtry_amt: Option<Vec<AmountAndCurrencyExchangeDetails42>>,
462}
463
464impl Validate for AmountAndCurrencyExchange32 {
465    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
466        if let Some(ref val) = self.instd_amt
467            && config.validate_optional_fields
468        {
469            val.validate(&helpers::child_path(path, "InstdAmt"), config, collector);
470        }
471        if let Some(ref val) = self.tx_amt
472            && config.validate_optional_fields
473        {
474            val.validate(&helpers::child_path(path, "TxAmt"), config, collector);
475        }
476        if let Some(ref val) = self.cntr_val_amt
477            && config.validate_optional_fields
478        {
479            val.validate(&helpers::child_path(path, "CntrValAmt"), config, collector);
480        }
481        if let Some(ref val) = self.anncd_pstng_amt
482            && config.validate_optional_fields
483        {
484            val.validate(
485                &helpers::child_path(path, "AnncdPstngAmt"),
486                config,
487                collector,
488            );
489        }
490        if let Some(ref vec) = self.prtry_amt
491            && config.validate_optional_fields
492        {
493            for item in vec {
494                item.validate(&helpers::child_path(path, "PrtryAmt"), config, collector);
495            }
496        }
497    }
498}
499
500// AmountAndCurrencyExchangeDetails31: Set of elements used to provide details on the currency exchange.
501#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
502pub struct AmountAndCurrencyExchangeDetails31 {
503    #[serde(rename = "Amt")]
504    pub amt: ActiveOrHistoricCurrencyAndAmount,
505    #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
506    pub ccy_xchg: Option<CurrencyExchange51>,
507}
508
509impl Validate for AmountAndCurrencyExchangeDetails31 {
510    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
511        self.amt
512            .validate(&helpers::child_path(path, "Amt"), config, collector);
513        if let Some(ref val) = self.ccy_xchg
514            && config.validate_optional_fields
515        {
516            val.validate(&helpers::child_path(path, "CcyXchg"), config, collector);
517        }
518    }
519}
520
521// AmountAndCurrencyExchangeDetails32: Set of elements used to provide details on the currency exchange.
522#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
523pub struct AmountAndCurrencyExchangeDetails32 {
524    #[serde(rename = "Amt")]
525    pub amt: ActiveOrHistoricCurrencyAndAmount,
526    #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
527    pub ccy_xchg: Option<CurrencyExchange52>,
528}
529
530impl Validate for AmountAndCurrencyExchangeDetails32 {
531    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
532        self.amt
533            .validate(&helpers::child_path(path, "Amt"), config, collector);
534        if let Some(ref val) = self.ccy_xchg
535            && config.validate_optional_fields
536        {
537            val.validate(&helpers::child_path(path, "CcyXchg"), config, collector);
538        }
539    }
540}
541
542// AmountAndCurrencyExchangeDetails41: Set of elements used to provide details on the currency exchange.
543#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
544pub struct AmountAndCurrencyExchangeDetails41 {
545    #[serde(rename = "Tp")]
546    pub tp: String,
547    #[serde(rename = "Amt")]
548    pub amt: ActiveOrHistoricCurrencyAndAmount,
549    #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
550    pub ccy_xchg: Option<CurrencyExchange51>,
551}
552
553impl Validate for AmountAndCurrencyExchangeDetails41 {
554    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
555        helpers::validate_length(
556            &self.tp,
557            "Tp",
558            Some(1),
559            Some(35),
560            &helpers::child_path(path, "Tp"),
561            config,
562            collector,
563        );
564        helpers::validate_pattern(
565            &self.tp,
566            "Tp",
567            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
568            &helpers::child_path(path, "Tp"),
569            config,
570            collector,
571        );
572        self.amt
573            .validate(&helpers::child_path(path, "Amt"), config, collector);
574        if let Some(ref val) = self.ccy_xchg
575            && config.validate_optional_fields
576        {
577            val.validate(&helpers::child_path(path, "CcyXchg"), config, collector);
578        }
579    }
580}
581
582// AmountAndCurrencyExchangeDetails42: Set of elements used to provide details on the currency exchange.
583#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
584pub struct AmountAndCurrencyExchangeDetails42 {
585    #[serde(rename = "Tp")]
586    pub tp: String,
587    #[serde(rename = "Amt")]
588    pub amt: ActiveOrHistoricCurrencyAndAmount,
589    #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
590    pub ccy_xchg: Option<CurrencyExchange52>,
591}
592
593impl Validate for AmountAndCurrencyExchangeDetails42 {
594    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
595        helpers::validate_length(
596            &self.tp,
597            "Tp",
598            Some(1),
599            Some(35),
600            &helpers::child_path(path, "Tp"),
601            config,
602            collector,
603        );
604        helpers::validate_pattern(
605            &self.tp,
606            "Tp",
607            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
608            &helpers::child_path(path, "Tp"),
609            config,
610            collector,
611        );
612        self.amt
613            .validate(&helpers::child_path(path, "Amt"), config, collector);
614        if let Some(ref val) = self.ccy_xchg
615            && config.validate_optional_fields
616        {
617            val.validate(&helpers::child_path(path, "CcyXchg"), config, collector);
618        }
619    }
620}
621
622// AmountAndDirection35: Indicates whether the amount is a credit or a debit amount.
623#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
624pub struct AmountAndDirection35 {
625    #[serde(rename = "Amt")]
626    pub amt: f64,
627    #[serde(rename = "CdtDbtInd")]
628    pub cdt_dbt_ind: CreditDebitCode,
629}
630
631impl Validate for AmountAndDirection35 {
632    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
633        self.cdt_dbt_ind
634            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
635    }
636}
637
638// AmountRangeBoundary1: Indicates whether the boundary amount is included in the range of amount values.
639#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
640pub struct AmountRangeBoundary1 {
641    #[serde(rename = "BdryAmt")]
642    pub bdry_amt: f64,
643    #[serde(rename = "Incl")]
644    pub incl: bool,
645}
646
647impl Validate for AmountRangeBoundary1 {
648    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
649}
650
651// AttendanceContext1Code: Unattended payment, no attendant present.
652#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
653pub enum AttendanceContext1Code {
654    #[default]
655    #[serde(rename = "ATTD")]
656    CodeATTD,
657    #[serde(rename = "SATT")]
658    CodeSATT,
659    #[serde(rename = "UATT")]
660    CodeUATT,
661}
662
663impl Validate for AttendanceContext1Code {
664    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
665        // Enum validation is typically empty
666    }
667}
668
669// AuthenticationEntity1Code: Merchant (for example signature verification by the attendant).
670#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
671pub enum AuthenticationEntity1Code {
672    #[default]
673    #[serde(rename = "ICCD")]
674    CodeICCD,
675    #[serde(rename = "AGNT")]
676    CodeAGNT,
677    #[serde(rename = "MERC")]
678    CodeMERC,
679}
680
681impl Validate for AuthenticationEntity1Code {
682    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
683        // Enum validation is typically empty
684    }
685}
686
687// AuthenticationMethod1Code: Channel-encrypted transaction.
688#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
689pub enum AuthenticationMethod1Code {
690    #[default]
691    #[serde(rename = "UKNW")]
692    CodeUKNW,
693    #[serde(rename = "BYPS")]
694    CodeBYPS,
695    #[serde(rename = "NPIN")]
696    CodeNPIN,
697    #[serde(rename = "FPIN")]
698    CodeFPIN,
699    #[serde(rename = "CPSG")]
700    CodeCPSG,
701    #[serde(rename = "PPSG")]
702    CodePPSG,
703    #[serde(rename = "MANU")]
704    CodeMANU,
705    #[serde(rename = "MERC")]
706    CodeMERC,
707    #[serde(rename = "SCRT")]
708    CodeSCRT,
709    #[serde(rename = "SNCT")]
710    CodeSNCT,
711    #[serde(rename = "SCNL")]
712    CodeSCNL,
713}
714
715impl Validate for AuthenticationMethod1Code {
716    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
717        // Enum validation is typically empty
718    }
719}
720
721// BalanceSubType1Choice1: Specifies a proprietary code for the balance type.
722#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
723pub struct BalanceSubType1Choice1 {
724    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
725    pub cd: Option<String>,
726    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
727    pub prtry: Option<String>,
728}
729
730impl Validate for BalanceSubType1Choice1 {
731    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
732        if let Some(ref val) = self.cd {
733            helpers::validate_length(
734                val,
735                "Cd",
736                Some(1),
737                Some(4),
738                &helpers::child_path(path, "Cd"),
739                config,
740                collector,
741            );
742        }
743        if let Some(ref val) = self.prtry {
744            helpers::validate_length(
745                val,
746                "Prtry",
747                Some(1),
748                Some(35),
749                &helpers::child_path(path, "Prtry"),
750                config,
751                collector,
752            );
753        }
754        if let Some(ref val) = self.prtry {
755            helpers::validate_pattern(
756                val,
757                "Prtry",
758                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
759                &helpers::child_path(path, "Prtry"),
760                config,
761                collector,
762            );
763        }
764    }
765}
766
767// BalanceType10Choice1: Balance type, in a proprietary format.
768#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
769pub struct BalanceType10Choice1 {
770    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
771    pub cd: Option<String>,
772    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
773    pub prtry: Option<String>,
774}
775
776impl Validate for BalanceType10Choice1 {
777    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
778        if let Some(ref val) = self.cd {
779            helpers::validate_length(
780                val,
781                "Cd",
782                Some(1),
783                Some(4),
784                &helpers::child_path(path, "Cd"),
785                config,
786                collector,
787            );
788        }
789        if let Some(ref val) = self.prtry {
790            helpers::validate_length(
791                val,
792                "Prtry",
793                Some(1),
794                Some(35),
795                &helpers::child_path(path, "Prtry"),
796                config,
797                collector,
798            );
799        }
800        if let Some(ref val) = self.prtry {
801            helpers::validate_pattern(
802                val,
803                "Prtry",
804                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
805                &helpers::child_path(path, "Prtry"),
806                config,
807                collector,
808            );
809        }
810    }
811}
812
813// BalanceType131: Specifies the balance sub-type.
814#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
815pub struct BalanceType131 {
816    #[serde(rename = "CdOrPrtry")]
817    pub cd_or_prtry: BalanceType10Choice1,
818    #[serde(rename = "SubTp", skip_serializing_if = "Option::is_none")]
819    pub sub_tp: Option<BalanceSubType1Choice1>,
820}
821
822impl Validate for BalanceType131 {
823    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
824        self.cd_or_prtry
825            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
826        if let Some(ref val) = self.sub_tp
827            && config.validate_optional_fields
828        {
829            val.validate(&helpers::child_path(path, "SubTp"), config, collector);
830        }
831    }
832}
833
834// BankToCustomerAccountReportV08: Reports on a cash account.
835#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
836pub struct BankToCustomerAccountReportV08 {
837    #[serde(rename = "GrpHdr")]
838    pub grp_hdr: GroupHeader811,
839    #[serde(rename = "Rpt")]
840    pub rpt: AccountReport251,
841}
842
843impl Validate for BankToCustomerAccountReportV08 {
844    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
845        self.grp_hdr
846            .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
847        self.rpt
848            .validate(&helpers::child_path(path, "Rpt"), config, collector);
849    }
850}
851
852// BankTransactionCodeStructure41: Bank transaction code in a proprietary form, as defined by the issuer.
853#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
854pub struct BankTransactionCodeStructure41 {
855    #[serde(rename = "Domn", skip_serializing_if = "Option::is_none")]
856    pub domn: Option<BankTransactionCodeStructure5>,
857    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
858    pub prtry: Option<ProprietaryBankTransactionCodeStructure11>,
859}
860
861impl Validate for BankTransactionCodeStructure41 {
862    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
863        if let Some(ref val) = self.domn
864            && config.validate_optional_fields
865        {
866            val.validate(&helpers::child_path(path, "Domn"), config, collector);
867        }
868        if let Some(ref val) = self.prtry
869            && config.validate_optional_fields
870        {
871            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
872        }
873    }
874}
875
876// BankTransactionCodeStructure5: Specifies the family and the sub-family of the bank transaction code, within a specific domain, in a structured and hierarchical format.
877#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
878pub struct BankTransactionCodeStructure5 {
879    #[serde(rename = "Cd")]
880    pub cd: String,
881    #[serde(rename = "Fmly")]
882    pub fmly: BankTransactionCodeStructure6,
883}
884
885impl Validate for BankTransactionCodeStructure5 {
886    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
887        helpers::validate_length(
888            &self.cd,
889            "Cd",
890            Some(1),
891            Some(4),
892            &helpers::child_path(path, "Cd"),
893            config,
894            collector,
895        );
896        self.fmly
897            .validate(&helpers::child_path(path, "Fmly"), config, collector);
898    }
899}
900
901// BankTransactionCodeStructure6: Specifies the sub-product family within a specific family.
902#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
903pub struct BankTransactionCodeStructure6 {
904    #[serde(rename = "Cd")]
905    pub cd: String,
906    #[serde(rename = "SubFmlyCd")]
907    pub sub_fmly_cd: String,
908}
909
910impl Validate for BankTransactionCodeStructure6 {
911    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
912        helpers::validate_length(
913            &self.cd,
914            "Cd",
915            Some(1),
916            Some(4),
917            &helpers::child_path(path, "Cd"),
918            config,
919            collector,
920        );
921        helpers::validate_length(
922            &self.sub_fmly_cd,
923            "SubFmlyCd",
924            Some(1),
925            Some(4),
926            &helpers::child_path(path, "SubFmlyCd"),
927            config,
928            collector,
929        );
930    }
931}
932
933// BatchInformation21: Indicates whether the batch entry is a credit or a debit entry.
934#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
935pub struct BatchInformation21 {
936    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
937    pub msg_id: Option<String>,
938    #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
939    pub pmt_inf_id: Option<String>,
940    #[serde(rename = "NbOfTxs", skip_serializing_if = "Option::is_none")]
941    pub nb_of_txs: Option<String>,
942    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
943    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
944    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
945    pub cdt_dbt_ind: Option<CreditDebitCode>,
946}
947
948impl Validate for BatchInformation21 {
949    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
950        if let Some(ref val) = self.msg_id {
951            helpers::validate_length(
952                val,
953                "MsgId",
954                Some(1),
955                Some(35),
956                &helpers::child_path(path, "MsgId"),
957                config,
958                collector,
959            );
960        }
961        if let Some(ref val) = self.msg_id {
962            helpers::validate_pattern(
963                val,
964                "MsgId",
965                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
966                &helpers::child_path(path, "MsgId"),
967                config,
968                collector,
969            );
970        }
971        if let Some(ref val) = self.pmt_inf_id {
972            helpers::validate_length(
973                val,
974                "PmtInfId",
975                Some(1),
976                Some(35),
977                &helpers::child_path(path, "PmtInfId"),
978                config,
979                collector,
980            );
981        }
982        if let Some(ref val) = self.pmt_inf_id {
983            helpers::validate_pattern(
984                val,
985                "PmtInfId",
986                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
987                &helpers::child_path(path, "PmtInfId"),
988                config,
989                collector,
990            );
991        }
992        if let Some(ref val) = self.nb_of_txs {
993            helpers::validate_pattern(
994                val,
995                "NbOfTxs",
996                "[0-9]{1,15}",
997                &helpers::child_path(path, "NbOfTxs"),
998                config,
999                collector,
1000            );
1001        }
1002        if let Some(ref val) = self.ttl_amt
1003            && config.validate_optional_fields
1004        {
1005            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
1006        }
1007        if let Some(ref val) = self.cdt_dbt_ind
1008            && config.validate_optional_fields
1009        {
1010            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
1011        }
1012    }
1013}
1014
1015// BranchAndFinancialInstitutionIdentification61: Identifies a specific branch of a financial institution.
1016//
1017// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
1018#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1019pub struct BranchAndFinancialInstitutionIdentification61 {
1020    #[serde(rename = "FinInstnId")]
1021    pub fin_instn_id: FinancialInstitutionIdentification181,
1022    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
1023    pub brnch_id: Option<BranchData31>,
1024}
1025
1026impl Validate for BranchAndFinancialInstitutionIdentification61 {
1027    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1028        self.fin_instn_id
1029            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
1030        if let Some(ref val) = self.brnch_id
1031            && config.validate_optional_fields
1032        {
1033            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
1034        }
1035    }
1036}
1037
1038// BranchAndFinancialInstitutionIdentification62: Identifies a specific branch of a financial institution.
1039//
1040// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
1041#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1042pub struct BranchAndFinancialInstitutionIdentification62 {
1043    #[serde(rename = "FinInstnId")]
1044    pub fin_instn_id: FinancialInstitutionIdentification181,
1045    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
1046    pub brnch_id: Option<BranchData32>,
1047}
1048
1049impl Validate for BranchAndFinancialInstitutionIdentification62 {
1050    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1051        self.fin_instn_id
1052            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
1053        if let Some(ref val) = self.brnch_id
1054            && config.validate_optional_fields
1055        {
1056            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
1057        }
1058    }
1059}
1060
1061// BranchAndFinancialInstitutionIdentification63: Identifies a specific branch of a financial institution.
1062//
1063// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
1064#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1065pub struct BranchAndFinancialInstitutionIdentification63 {
1066    #[serde(rename = "FinInstnId")]
1067    pub fin_instn_id: FinancialInstitutionIdentification182,
1068    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
1069    pub brnch_id: Option<BranchData32>,
1070}
1071
1072impl Validate for BranchAndFinancialInstitutionIdentification63 {
1073    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1074        self.fin_instn_id
1075            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
1076        if let Some(ref val) = self.brnch_id
1077            && config.validate_optional_fields
1078        {
1079            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
1080        }
1081    }
1082}
1083
1084// BranchAndFinancialInstitutionIdentification64: Identifies a specific branch of a financial institution.
1085//
1086// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
1087#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1088pub struct BranchAndFinancialInstitutionIdentification64 {
1089    #[serde(rename = "FinInstnId")]
1090    pub fin_instn_id: FinancialInstitutionIdentification181,
1091    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
1092    pub brnch_id: Option<BranchData33>,
1093}
1094
1095impl Validate for BranchAndFinancialInstitutionIdentification64 {
1096    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1097        self.fin_instn_id
1098            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
1099        if let Some(ref val) = self.brnch_id
1100            && config.validate_optional_fields
1101        {
1102            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
1103        }
1104    }
1105}
1106
1107// BranchData31: Information that locates and identifies a specific address, as defined by postal services.
1108#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1109pub struct BranchData31 {
1110    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1111    pub id: Option<String>,
1112    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1113    pub lei: Option<String>,
1114    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1115    pub nm: Option<String>,
1116    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1117    pub pstl_adr: Option<PostalAddress242>,
1118}
1119
1120impl Validate for BranchData31 {
1121    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1122        if let Some(ref val) = self.id {
1123            helpers::validate_length(
1124                val,
1125                "Id",
1126                Some(1),
1127                Some(35),
1128                &helpers::child_path(path, "Id"),
1129                config,
1130                collector,
1131            );
1132        }
1133        if let Some(ref val) = self.lei {
1134            helpers::validate_pattern(
1135                val,
1136                "LEI",
1137                "[A-Z0-9]{18,18}[0-9]{2,2}",
1138                &helpers::child_path(path, "LEI"),
1139                config,
1140                collector,
1141            );
1142        }
1143        if let Some(ref val) = self.nm {
1144            helpers::validate_length(
1145                val,
1146                "Nm",
1147                Some(1),
1148                Some(140),
1149                &helpers::child_path(path, "Nm"),
1150                config,
1151                collector,
1152            );
1153        }
1154        if let Some(ref val) = self.nm {
1155            helpers::validate_pattern(
1156                val,
1157                "Nm",
1158                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1159                &helpers::child_path(path, "Nm"),
1160                config,
1161                collector,
1162            );
1163        }
1164        if let Some(ref val) = self.pstl_adr
1165            && config.validate_optional_fields
1166        {
1167            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1168        }
1169    }
1170}
1171
1172// BranchData32: Information that locates and identifies a specific address, as defined by postal services.
1173#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1174pub struct BranchData32 {
1175    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1176    pub id: Option<String>,
1177    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1178    pub lei: Option<String>,
1179    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1180    pub nm: Option<String>,
1181    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1182    pub pstl_adr: Option<PostalAddress241>,
1183}
1184
1185impl Validate for BranchData32 {
1186    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1187        if let Some(ref val) = self.id {
1188            helpers::validate_length(
1189                val,
1190                "Id",
1191                Some(1),
1192                Some(35),
1193                &helpers::child_path(path, "Id"),
1194                config,
1195                collector,
1196            );
1197        }
1198        if let Some(ref val) = self.id {
1199            helpers::validate_pattern(
1200                val,
1201                "Id",
1202                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1203                &helpers::child_path(path, "Id"),
1204                config,
1205                collector,
1206            );
1207        }
1208        if let Some(ref val) = self.lei {
1209            helpers::validate_pattern(
1210                val,
1211                "LEI",
1212                "[A-Z0-9]{18,18}[0-9]{2,2}",
1213                &helpers::child_path(path, "LEI"),
1214                config,
1215                collector,
1216            );
1217        }
1218        if let Some(ref val) = self.nm {
1219            helpers::validate_length(
1220                val,
1221                "Nm",
1222                Some(1),
1223                Some(140),
1224                &helpers::child_path(path, "Nm"),
1225                config,
1226                collector,
1227            );
1228        }
1229        if let Some(ref val) = self.nm {
1230            helpers::validate_pattern(
1231                val,
1232                "Nm",
1233                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1234                &helpers::child_path(path, "Nm"),
1235                config,
1236                collector,
1237            );
1238        }
1239        if let Some(ref val) = self.pstl_adr
1240            && config.validate_optional_fields
1241        {
1242            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1243        }
1244    }
1245}
1246
1247// BranchData33: Information that locates and identifies a specific address, as defined by postal services.
1248#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1249pub struct BranchData33 {
1250    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1251    pub id: Option<String>,
1252    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1253    pub lei: Option<String>,
1254    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1255    pub nm: Option<String>,
1256    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1257    pub pstl_adr: Option<PostalAddress241>,
1258}
1259
1260impl Validate for BranchData33 {
1261    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1262        if let Some(ref val) = self.id {
1263            helpers::validate_length(
1264                val,
1265                "Id",
1266                Some(1),
1267                Some(35),
1268                &helpers::child_path(path, "Id"),
1269                config,
1270                collector,
1271            );
1272        }
1273        if let Some(ref val) = self.lei {
1274            helpers::validate_pattern(
1275                val,
1276                "LEI",
1277                "[A-Z0-9]{18,18}[0-9]{2,2}",
1278                &helpers::child_path(path, "LEI"),
1279                config,
1280                collector,
1281            );
1282        }
1283        if let Some(ref val) = self.nm {
1284            helpers::validate_length(
1285                val,
1286                "Nm",
1287                Some(1),
1288                Some(140),
1289                &helpers::child_path(path, "Nm"),
1290                config,
1291                collector,
1292            );
1293        }
1294        if let Some(ref val) = self.nm {
1295            helpers::validate_pattern(
1296                val,
1297                "Nm",
1298                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1299                &helpers::child_path(path, "Nm"),
1300                config,
1301                collector,
1302            );
1303        }
1304        if let Some(ref val) = self.pstl_adr
1305            && config.validate_optional_fields
1306        {
1307            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1308        }
1309    }
1310}
1311
1312// CSCManagement1Code: No card security code imprint.
1313#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1314pub enum CSCManagement1Code {
1315    #[default]
1316    #[serde(rename = "PRST")]
1317    CodePRST,
1318    #[serde(rename = "BYPS")]
1319    CodeBYPS,
1320    #[serde(rename = "UNRD")]
1321    CodeUNRD,
1322    #[serde(rename = "NCSC")]
1323    CodeNCSC,
1324}
1325
1326impl Validate for CSCManagement1Code {
1327    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1328        // Enum validation is typically empty
1329    }
1330}
1331
1332// CardAggregated21: Date range on which the globalisation applies.
1333#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1334pub struct CardAggregated21 {
1335    #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1336    pub addtl_svc: Option<CardPaymentServiceType2Code>,
1337    #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1338    pub tx_ctgy: Option<String>,
1339    #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1340    pub sale_rcncltn_id: Option<String>,
1341    #[serde(rename = "SeqNbRg", skip_serializing_if = "Option::is_none")]
1342    pub seq_nb_rg: Option<CardSequenceNumberRange11>,
1343    #[serde(rename = "TxDtRg", skip_serializing_if = "Option::is_none")]
1344    pub tx_dt_rg: Option<DateOrDateTimePeriod1Choice1>,
1345}
1346
1347impl Validate for CardAggregated21 {
1348    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1349        if let Some(ref val) = self.addtl_svc
1350            && config.validate_optional_fields
1351        {
1352            val.validate(&helpers::child_path(path, "AddtlSvc"), config, collector);
1353        }
1354        if let Some(ref val) = self.tx_ctgy {
1355            helpers::validate_length(
1356                val,
1357                "TxCtgy",
1358                Some(1),
1359                Some(4),
1360                &helpers::child_path(path, "TxCtgy"),
1361                config,
1362                collector,
1363            );
1364        }
1365        if let Some(ref val) = self.sale_rcncltn_id {
1366            helpers::validate_length(
1367                val,
1368                "SaleRcncltnId",
1369                Some(1),
1370                Some(35),
1371                &helpers::child_path(path, "SaleRcncltnId"),
1372                config,
1373                collector,
1374            );
1375        }
1376        if let Some(ref val) = self.sale_rcncltn_id {
1377            helpers::validate_pattern(
1378                val,
1379                "SaleRcncltnId",
1380                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1381                &helpers::child_path(path, "SaleRcncltnId"),
1382                config,
1383                collector,
1384            );
1385        }
1386        if let Some(ref val) = self.seq_nb_rg
1387            && config.validate_optional_fields
1388        {
1389            val.validate(&helpers::child_path(path, "SeqNbRg"), config, collector);
1390        }
1391        if let Some(ref val) = self.tx_dt_rg
1392            && config.validate_optional_fields
1393        {
1394            val.validate(&helpers::child_path(path, "TxDtRg"), config, collector);
1395        }
1396    }
1397}
1398
1399// CardDataReading1Code: Contactless proximity reader, with application conform to the standard EMV (standard initiated by Europay, Mastercard and Visa).
1400#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1401pub enum CardDataReading1Code {
1402    #[default]
1403    #[serde(rename = "TAGC")]
1404    CodeTAGC,
1405    #[serde(rename = "PHYS")]
1406    CodePHYS,
1407    #[serde(rename = "BRCD")]
1408    CodeBRCD,
1409    #[serde(rename = "MGST")]
1410    CodeMGST,
1411    #[serde(rename = "CICC")]
1412    CodeCICC,
1413    #[serde(rename = "DFLE")]
1414    CodeDFLE,
1415    #[serde(rename = "CTLS")]
1416    CodeCTLS,
1417    #[serde(rename = "ECTL")]
1418    CodeECTL,
1419}
1420
1421impl Validate for CardDataReading1Code {
1422    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1423        // Enum validation is typically empty
1424    }
1425}
1426
1427// CardEntry41: Prepaid account for the transfer or loading of an amount of money.
1428#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1429pub struct CardEntry41 {
1430    #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1431    pub card: Option<PaymentCard41>,
1432    #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1433    pub poi: Option<PointOfInteraction11>,
1434    #[serde(rename = "AggtdNtry", skip_serializing_if = "Option::is_none")]
1435    pub aggtd_ntry: Option<CardAggregated21>,
1436    #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1437    pub pre_pd_acct: Option<CashAccount382>,
1438}
1439
1440impl Validate for CardEntry41 {
1441    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1442        if let Some(ref val) = self.card
1443            && config.validate_optional_fields
1444        {
1445            val.validate(&helpers::child_path(path, "Card"), config, collector);
1446        }
1447        if let Some(ref val) = self.poi
1448            && config.validate_optional_fields
1449        {
1450            val.validate(&helpers::child_path(path, "POI"), config, collector);
1451        }
1452        if let Some(ref val) = self.aggtd_ntry
1453            && config.validate_optional_fields
1454        {
1455            val.validate(&helpers::child_path(path, "AggtdNtry"), config, collector);
1456        }
1457        if let Some(ref val) = self.pre_pd_acct
1458            && config.validate_optional_fields
1459        {
1460            val.validate(&helpers::child_path(path, "PrePdAcct"), config, collector);
1461        }
1462    }
1463}
1464
1465// CardIndividualTransaction21: Sequential number of the validation of the cash deposit.
1466// Usage: The sequential number is increased incrementally for each transaction.
1467#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1468pub struct CardIndividualTransaction21 {
1469    #[serde(rename = "ICCRltdData", skip_serializing_if = "Option::is_none")]
1470    pub icc_rltd_data: Option<String>,
1471    #[serde(rename = "PmtCntxt", skip_serializing_if = "Option::is_none")]
1472    pub pmt_cntxt: Option<PaymentContext3>,
1473    #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1474    pub addtl_svc: Option<CardPaymentServiceType2Code>,
1475    #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1476    pub tx_ctgy: Option<String>,
1477    #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1478    pub sale_rcncltn_id: Option<String>,
1479    #[serde(rename = "SaleRefNb", skip_serializing_if = "Option::is_none")]
1480    pub sale_ref_nb: Option<String>,
1481    #[serde(rename = "RePresntmntRsn", skip_serializing_if = "Option::is_none")]
1482    pub re_presntmnt_rsn: Option<String>,
1483    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
1484    pub seq_nb: Option<String>,
1485    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
1486    pub tx_id: Option<TransactionIdentifier11>,
1487    #[serde(rename = "Pdct", skip_serializing_if = "Option::is_none")]
1488    pub pdct: Option<Product21>,
1489    #[serde(rename = "VldtnDt", skip_serializing_if = "Option::is_none")]
1490    pub vldtn_dt: Option<String>,
1491    #[serde(rename = "VldtnSeqNb", skip_serializing_if = "Option::is_none")]
1492    pub vldtn_seq_nb: Option<String>,
1493}
1494
1495impl Validate for CardIndividualTransaction21 {
1496    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1497        if let Some(ref val) = self.icc_rltd_data {
1498            helpers::validate_length(
1499                val,
1500                "ICCRltdData",
1501                Some(1),
1502                Some(1025),
1503                &helpers::child_path(path, "ICCRltdData"),
1504                config,
1505                collector,
1506            );
1507        }
1508        if let Some(ref val) = self.icc_rltd_data {
1509            helpers::validate_pattern(
1510                val,
1511                "ICCRltdData",
1512                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1513                &helpers::child_path(path, "ICCRltdData"),
1514                config,
1515                collector,
1516            );
1517        }
1518        if let Some(ref val) = self.pmt_cntxt
1519            && config.validate_optional_fields
1520        {
1521            val.validate(&helpers::child_path(path, "PmtCntxt"), config, collector);
1522        }
1523        if let Some(ref val) = self.addtl_svc
1524            && config.validate_optional_fields
1525        {
1526            val.validate(&helpers::child_path(path, "AddtlSvc"), config, collector);
1527        }
1528        if let Some(ref val) = self.tx_ctgy {
1529            helpers::validate_length(
1530                val,
1531                "TxCtgy",
1532                Some(1),
1533                Some(4),
1534                &helpers::child_path(path, "TxCtgy"),
1535                config,
1536                collector,
1537            );
1538        }
1539        if let Some(ref val) = self.sale_rcncltn_id {
1540            helpers::validate_length(
1541                val,
1542                "SaleRcncltnId",
1543                Some(1),
1544                Some(35),
1545                &helpers::child_path(path, "SaleRcncltnId"),
1546                config,
1547                collector,
1548            );
1549        }
1550        if let Some(ref val) = self.sale_rcncltn_id {
1551            helpers::validate_pattern(
1552                val,
1553                "SaleRcncltnId",
1554                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1555                &helpers::child_path(path, "SaleRcncltnId"),
1556                config,
1557                collector,
1558            );
1559        }
1560        if let Some(ref val) = self.sale_ref_nb {
1561            helpers::validate_length(
1562                val,
1563                "SaleRefNb",
1564                Some(1),
1565                Some(35),
1566                &helpers::child_path(path, "SaleRefNb"),
1567                config,
1568                collector,
1569            );
1570        }
1571        if let Some(ref val) = self.sale_ref_nb {
1572            helpers::validate_pattern(
1573                val,
1574                "SaleRefNb",
1575                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1576                &helpers::child_path(path, "SaleRefNb"),
1577                config,
1578                collector,
1579            );
1580        }
1581        if let Some(ref val) = self.re_presntmnt_rsn {
1582            helpers::validate_length(
1583                val,
1584                "RePresntmntRsn",
1585                Some(1),
1586                Some(4),
1587                &helpers::child_path(path, "RePresntmntRsn"),
1588                config,
1589                collector,
1590            );
1591        }
1592        if let Some(ref val) = self.seq_nb {
1593            helpers::validate_length(
1594                val,
1595                "SeqNb",
1596                Some(1),
1597                Some(35),
1598                &helpers::child_path(path, "SeqNb"),
1599                config,
1600                collector,
1601            );
1602        }
1603        if let Some(ref val) = self.seq_nb {
1604            helpers::validate_pattern(
1605                val,
1606                "SeqNb",
1607                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1608                &helpers::child_path(path, "SeqNb"),
1609                config,
1610                collector,
1611            );
1612        }
1613        if let Some(ref val) = self.tx_id
1614            && config.validate_optional_fields
1615        {
1616            val.validate(&helpers::child_path(path, "TxId"), config, collector);
1617        }
1618        if let Some(ref val) = self.pdct
1619            && config.validate_optional_fields
1620        {
1621            val.validate(&helpers::child_path(path, "Pdct"), config, collector);
1622        }
1623        if let Some(ref val) = self.vldtn_seq_nb {
1624            helpers::validate_length(
1625                val,
1626                "VldtnSeqNb",
1627                Some(1),
1628                Some(35),
1629                &helpers::child_path(path, "VldtnSeqNb"),
1630                config,
1631                collector,
1632            );
1633        }
1634        if let Some(ref val) = self.vldtn_seq_nb {
1635            helpers::validate_pattern(
1636                val,
1637                "VldtnSeqNb",
1638                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1639                &helpers::child_path(path, "VldtnSeqNb"),
1640                config,
1641                collector,
1642            );
1643        }
1644    }
1645}
1646
1647// CardPaymentServiceType2Code: Voice authorisation.
1648#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1649pub enum CardPaymentServiceType2Code {
1650    #[default]
1651    #[serde(rename = "AGGR")]
1652    CodeAGGR,
1653    #[serde(rename = "DCCV")]
1654    CodeDCCV,
1655    #[serde(rename = "GRTT")]
1656    CodeGRTT,
1657    #[serde(rename = "INSP")]
1658    CodeINSP,
1659    #[serde(rename = "LOYT")]
1660    CodeLOYT,
1661    #[serde(rename = "NRES")]
1662    CodeNRES,
1663    #[serde(rename = "PUCO")]
1664    CodePUCO,
1665    #[serde(rename = "RECP")]
1666    CodeRECP,
1667    #[serde(rename = "SOAF")]
1668    CodeSOAF,
1669    #[serde(rename = "UNAF")]
1670    CodeUNAF,
1671    #[serde(rename = "VCAU")]
1672    CodeVCAU,
1673}
1674
1675impl Validate for CardPaymentServiceType2Code {
1676    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1677        // Enum validation is typically empty
1678    }
1679}
1680
1681// CardSecurityInformation1: Card security code (CSC).
1682#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1683pub struct CardSecurityInformation1 {
1684    #[serde(rename = "CSCMgmt")]
1685    pub csc_mgmt: CSCManagement1Code,
1686    #[serde(rename = "CSCVal", skip_serializing_if = "Option::is_none")]
1687    pub csc_val: Option<String>,
1688}
1689
1690impl Validate for CardSecurityInformation1 {
1691    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1692        self.csc_mgmt
1693            .validate(&helpers::child_path(path, "CSCMgmt"), config, collector);
1694        if let Some(ref val) = self.csc_val {
1695            helpers::validate_pattern(
1696                val,
1697                "CSCVal",
1698                "[0-9]{3,4}",
1699                &helpers::child_path(path, "CSCVal"),
1700                config,
1701                collector,
1702            );
1703        }
1704    }
1705}
1706
1707// CardSequenceNumberRange11: CardSequenceNumberRange1: LastTransactionSequenceNumberMessage element to be finalised once feedback from Card SEG has been received.
1708#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1709pub struct CardSequenceNumberRange11 {
1710    #[serde(rename = "FrstTx", skip_serializing_if = "Option::is_none")]
1711    pub frst_tx: Option<String>,
1712    #[serde(rename = "LastTx", skip_serializing_if = "Option::is_none")]
1713    pub last_tx: Option<String>,
1714}
1715
1716impl Validate for CardSequenceNumberRange11 {
1717    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1718        if let Some(ref val) = self.frst_tx {
1719            helpers::validate_length(
1720                val,
1721                "FrstTx",
1722                Some(1),
1723                Some(35),
1724                &helpers::child_path(path, "FrstTx"),
1725                config,
1726                collector,
1727            );
1728        }
1729        if let Some(ref val) = self.frst_tx {
1730            helpers::validate_pattern(
1731                val,
1732                "FrstTx",
1733                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1734                &helpers::child_path(path, "FrstTx"),
1735                config,
1736                collector,
1737            );
1738        }
1739        if let Some(ref val) = self.last_tx {
1740            helpers::validate_length(
1741                val,
1742                "LastTx",
1743                Some(1),
1744                Some(35),
1745                &helpers::child_path(path, "LastTx"),
1746                config,
1747                collector,
1748            );
1749        }
1750        if let Some(ref val) = self.last_tx {
1751            helpers::validate_pattern(
1752                val,
1753                "LastTx",
1754                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1755                &helpers::child_path(path, "LastTx"),
1756                config,
1757                collector,
1758            );
1759        }
1760    }
1761}
1762
1763// CardTransaction171: Prepaid account for the transfer or loading of an amount of money.
1764#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1765pub struct CardTransaction171 {
1766    #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1767    pub card: Option<PaymentCard41>,
1768    #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1769    pub poi: Option<PointOfInteraction11>,
1770    #[serde(rename = "Tx", skip_serializing_if = "Option::is_none")]
1771    pub tx: Option<CardTransaction3Choice1>,
1772    #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1773    pub pre_pd_acct: Option<CashAccount382>,
1774}
1775
1776impl Validate for CardTransaction171 {
1777    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1778        if let Some(ref val) = self.card
1779            && config.validate_optional_fields
1780        {
1781            val.validate(&helpers::child_path(path, "Card"), config, collector);
1782        }
1783        if let Some(ref val) = self.poi
1784            && config.validate_optional_fields
1785        {
1786            val.validate(&helpers::child_path(path, "POI"), config, collector);
1787        }
1788        if let Some(ref val) = self.tx
1789            && config.validate_optional_fields
1790        {
1791            val.validate(&helpers::child_path(path, "Tx"), config, collector);
1792        }
1793        if let Some(ref val) = self.pre_pd_acct
1794            && config.validate_optional_fields
1795        {
1796            val.validate(&helpers::child_path(path, "PrePdAcct"), config, collector);
1797        }
1798    }
1799}
1800
1801// CardTransaction3Choice1: Card transaction details for the individual transaction, as recorded at the POI (point of interaction).
1802#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1803pub struct CardTransaction3Choice1 {
1804    #[serde(rename = "Aggtd", skip_serializing_if = "Option::is_none")]
1805    pub aggtd: Option<CardAggregated21>,
1806    #[serde(rename = "Indv", skip_serializing_if = "Option::is_none")]
1807    pub indv: Option<CardIndividualTransaction21>,
1808}
1809
1810impl Validate for CardTransaction3Choice1 {
1811    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1812        if let Some(ref val) = self.aggtd
1813            && config.validate_optional_fields
1814        {
1815            val.validate(&helpers::child_path(path, "Aggtd"), config, collector);
1816        }
1817        if let Some(ref val) = self.indv
1818            && config.validate_optional_fields
1819        {
1820            val.validate(&helpers::child_path(path, "Indv"), config, collector);
1821        }
1822    }
1823}
1824
1825// CardholderAuthentication2: Entity or object in charge of verifying the cardholder authenticity.
1826#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1827pub struct CardholderAuthentication2 {
1828    #[serde(rename = "AuthntcnMtd")]
1829    pub authntcn_mtd: AuthenticationMethod1Code,
1830    #[serde(rename = "AuthntcnNtty")]
1831    pub authntcn_ntty: AuthenticationEntity1Code,
1832}
1833
1834impl Validate for CardholderAuthentication2 {
1835    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1836        self.authntcn_mtd
1837            .validate(&helpers::child_path(path, "AuthntcnMtd"), config, collector);
1838        self.authntcn_ntty.validate(
1839            &helpers::child_path(path, "AuthntcnNtty"),
1840            config,
1841            collector,
1842        );
1843    }
1844}
1845
1846// CardholderVerificationCapability1Code: Three domain secure (three domain secure authentication of the cardholder).
1847#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1848pub enum CardholderVerificationCapability1Code {
1849    #[default]
1850    #[serde(rename = "MNSG")]
1851    CodeMNSG,
1852    #[serde(rename = "NPIN")]
1853    CodeNPIN,
1854    #[serde(rename = "FCPN")]
1855    CodeFCPN,
1856    #[serde(rename = "FEPN")]
1857    CodeFEPN,
1858    #[serde(rename = "FDSG")]
1859    CodeFDSG,
1860    #[serde(rename = "FBIO")]
1861    CodeFBIO,
1862    #[serde(rename = "MNVR")]
1863    CodeMNVR,
1864    #[serde(rename = "FBIG")]
1865    CodeFBIG,
1866    #[serde(rename = "APKI")]
1867    CodeAPKI,
1868    #[serde(rename = "PKIS")]
1869    CodePKIS,
1870    #[serde(rename = "CHDT")]
1871    CodeCHDT,
1872    #[serde(rename = "SCEC")]
1873    CodeSCEC,
1874}
1875
1876impl Validate for CardholderVerificationCapability1Code {
1877    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1878        // Enum validation is typically empty
1879    }
1880}
1881
1882// CashAccount381: Specifies an alternate assumed name for the identification of the account.
1883#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1884pub struct CashAccount381 {
1885    #[serde(rename = "Id")]
1886    pub id: AccountIdentification4Choice1,
1887    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1888    pub tp: Option<CashAccountType2Choice1>,
1889    #[serde(rename = "Ccy")]
1890    pub ccy: String,
1891    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1892    pub nm: Option<String>,
1893    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1894    pub prxy: Option<ProxyAccountIdentification11>,
1895}
1896
1897impl Validate for CashAccount381 {
1898    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1899        self.id
1900            .validate(&helpers::child_path(path, "Id"), config, collector);
1901        if let Some(ref val) = self.tp
1902            && config.validate_optional_fields
1903        {
1904            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1905        }
1906        helpers::validate_pattern(
1907            &self.ccy,
1908            "Ccy",
1909            "[A-Z]{3,3}",
1910            &helpers::child_path(path, "Ccy"),
1911            config,
1912            collector,
1913        );
1914        if let Some(ref val) = self.nm {
1915            helpers::validate_length(
1916                val,
1917                "Nm",
1918                Some(1),
1919                Some(70),
1920                &helpers::child_path(path, "Nm"),
1921                config,
1922                collector,
1923            );
1924        }
1925        if let Some(ref val) = self.nm {
1926            helpers::validate_pattern(
1927                val,
1928                "Nm",
1929                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1930                &helpers::child_path(path, "Nm"),
1931                config,
1932                collector,
1933            );
1934        }
1935        if let Some(ref val) = self.prxy
1936            && config.validate_optional_fields
1937        {
1938            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
1939        }
1940    }
1941}
1942
1943// CashAccount382: Specifies an alternate assumed name for the identification of the account.
1944#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1945pub struct CashAccount382 {
1946    #[serde(rename = "Id")]
1947    pub id: AccountIdentification4Choice1,
1948    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1949    pub tp: Option<CashAccountType2Choice1>,
1950    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1951    pub ccy: Option<String>,
1952    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1953    pub nm: Option<String>,
1954    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1955    pub prxy: Option<ProxyAccountIdentification11>,
1956}
1957
1958impl Validate for CashAccount382 {
1959    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1960        self.id
1961            .validate(&helpers::child_path(path, "Id"), config, collector);
1962        if let Some(ref val) = self.tp
1963            && config.validate_optional_fields
1964        {
1965            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1966        }
1967        if let Some(ref val) = self.ccy {
1968            helpers::validate_pattern(
1969                val,
1970                "Ccy",
1971                "[A-Z]{3,3}",
1972                &helpers::child_path(path, "Ccy"),
1973                config,
1974                collector,
1975            );
1976        }
1977        if let Some(ref val) = self.nm {
1978            helpers::validate_length(
1979                val,
1980                "Nm",
1981                Some(1),
1982                Some(70),
1983                &helpers::child_path(path, "Nm"),
1984                config,
1985                collector,
1986            );
1987        }
1988        if let Some(ref val) = self.nm {
1989            helpers::validate_pattern(
1990                val,
1991                "Nm",
1992                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1993                &helpers::child_path(path, "Nm"),
1994                config,
1995                collector,
1996            );
1997        }
1998        if let Some(ref val) = self.prxy
1999            && config.validate_optional_fields
2000        {
2001            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2002        }
2003    }
2004}
2005
2006// CashAccount391: Party that manages the account on behalf of the account owner, that is manages the registration and booking of entries on the account, calculates balances on the account and provides information about the account.
2007#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2008pub struct CashAccount391 {
2009    #[serde(rename = "Id")]
2010    pub id: AccountIdentification4Choice1,
2011    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2012    pub tp: Option<CashAccountType2Choice1>,
2013    #[serde(rename = "Ccy")]
2014    pub ccy: String,
2015    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2016    pub nm: Option<String>,
2017    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
2018    pub prxy: Option<ProxyAccountIdentification11>,
2019    #[serde(rename = "Ownr", skip_serializing_if = "Option::is_none")]
2020    pub ownr: Option<PartyIdentification1352>,
2021    #[serde(rename = "Svcr", skip_serializing_if = "Option::is_none")]
2022    pub svcr: Option<BranchAndFinancialInstitutionIdentification61>,
2023}
2024
2025impl Validate for CashAccount391 {
2026    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2027        self.id
2028            .validate(&helpers::child_path(path, "Id"), config, collector);
2029        if let Some(ref val) = self.tp
2030            && config.validate_optional_fields
2031        {
2032            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2033        }
2034        helpers::validate_pattern(
2035            &self.ccy,
2036            "Ccy",
2037            "[A-Z]{3,3}",
2038            &helpers::child_path(path, "Ccy"),
2039            config,
2040            collector,
2041        );
2042        if let Some(ref val) = self.nm {
2043            helpers::validate_length(
2044                val,
2045                "Nm",
2046                Some(1),
2047                Some(70),
2048                &helpers::child_path(path, "Nm"),
2049                config,
2050                collector,
2051            );
2052        }
2053        if let Some(ref val) = self.nm {
2054            helpers::validate_pattern(
2055                val,
2056                "Nm",
2057                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2058                &helpers::child_path(path, "Nm"),
2059                config,
2060                collector,
2061            );
2062        }
2063        if let Some(ref val) = self.prxy
2064            && config.validate_optional_fields
2065        {
2066            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2067        }
2068        if let Some(ref val) = self.ownr
2069            && config.validate_optional_fields
2070        {
2071            val.validate(&helpers::child_path(path, "Ownr"), config, collector);
2072        }
2073        if let Some(ref val) = self.svcr
2074            && config.validate_optional_fields
2075        {
2076            val.validate(&helpers::child_path(path, "Svcr"), config, collector);
2077        }
2078    }
2079}
2080
2081// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
2082#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2083pub struct CashAccountType2Choice1 {
2084    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2085    pub cd: Option<String>,
2086    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2087    pub prtry: Option<String>,
2088}
2089
2090impl Validate for CashAccountType2Choice1 {
2091    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2092        if let Some(ref val) = self.cd {
2093            helpers::validate_length(
2094                val,
2095                "Cd",
2096                Some(1),
2097                Some(4),
2098                &helpers::child_path(path, "Cd"),
2099                config,
2100                collector,
2101            );
2102        }
2103        if let Some(ref val) = self.prtry {
2104            helpers::validate_length(
2105                val,
2106                "Prtry",
2107                Some(1),
2108                Some(35),
2109                &helpers::child_path(path, "Prtry"),
2110                config,
2111                collector,
2112            );
2113        }
2114        if let Some(ref val) = self.prtry {
2115            helpers::validate_pattern(
2116                val,
2117                "Prtry",
2118                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2119                &helpers::child_path(path, "Prtry"),
2120                config,
2121                collector,
2122            );
2123        }
2124    }
2125}
2126
2127// CashAvailability1: Indicates whether the availability balance is a credit or a debit balance.
2128// Usage: A zero balance is considered to be a credit balance.
2129#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2130pub struct CashAvailability1 {
2131    #[serde(rename = "Dt")]
2132    pub dt: CashAvailabilityDate1Choice,
2133    #[serde(rename = "Amt")]
2134    pub amt: ActiveOrHistoricCurrencyAndAmount,
2135    #[serde(rename = "CdtDbtInd")]
2136    pub cdt_dbt_ind: CreditDebitCode,
2137}
2138
2139impl Validate for CashAvailability1 {
2140    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2141        self.dt
2142            .validate(&helpers::child_path(path, "Dt"), config, collector);
2143        self.amt
2144            .validate(&helpers::child_path(path, "Amt"), config, collector);
2145        self.cdt_dbt_ind
2146            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2147    }
2148}
2149
2150// CashAvailabilityDate1Choice: Identifies the actual availability date.
2151#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2152pub struct CashAvailabilityDate1Choice {
2153    #[serde(rename = "NbOfDays", skip_serializing_if = "Option::is_none")]
2154    pub nb_of_days: Option<String>,
2155    #[serde(rename = "ActlDt", skip_serializing_if = "Option::is_none")]
2156    pub actl_dt: Option<String>,
2157}
2158
2159impl Validate for CashAvailabilityDate1Choice {
2160    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2161        if let Some(ref val) = self.nb_of_days {
2162            helpers::validate_pattern(
2163                val,
2164                "NbOfDays",
2165                "[\\+]{0,1}[0-9]{1,15}",
2166                &helpers::child_path(path, "NbOfDays"),
2167                config,
2168                collector,
2169            );
2170        }
2171    }
2172}
2173
2174// CashBalance81: Set of elements used to indicate when the booked amount of money will become available, that is can be accessed and starts generating interest.
2175//
2176// Usage: This type of information is used in the US and is linked to particular instruments such as cheques.
2177// Example: When a cheque is deposited, it will be booked on the deposit day, but the amount of money will only be accessible as of the indicated availability day (according to national banking regulations).
2178#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2179pub struct CashBalance81 {
2180    #[serde(rename = "Tp")]
2181    pub tp: BalanceType131,
2182    #[serde(rename = "CdtLine", skip_serializing_if = "Option::is_none")]
2183    pub cdt_line: Option<Vec<CreditLine31>>,
2184    #[serde(rename = "Amt")]
2185    pub amt: ActiveOrHistoricCurrencyAndAmount,
2186    #[serde(rename = "CdtDbtInd")]
2187    pub cdt_dbt_ind: CreditDebitCode,
2188    #[serde(rename = "Dt")]
2189    pub dt: DateAndDateTime2Choice1,
2190    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
2191    pub avlbty: Option<Vec<CashAvailability1>>,
2192}
2193
2194impl Validate for CashBalance81 {
2195    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2196        self.tp
2197            .validate(&helpers::child_path(path, "Tp"), config, collector);
2198        if let Some(ref vec) = self.cdt_line
2199            && config.validate_optional_fields
2200        {
2201            for item in vec {
2202                item.validate(&helpers::child_path(path, "CdtLine"), config, collector);
2203            }
2204        }
2205        self.amt
2206            .validate(&helpers::child_path(path, "Amt"), config, collector);
2207        self.cdt_dbt_ind
2208            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2209        self.dt
2210            .validate(&helpers::child_path(path, "Dt"), config, collector);
2211        if let Some(ref vec) = self.avlbty
2212            && config.validate_optional_fields
2213        {
2214            for item in vec {
2215                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
2216            }
2217        }
2218    }
2219}
2220
2221// CashDeposit11: Specifies the total amount of money in the cash deposit, that is the note denomination times the number of notes.
2222#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2223pub struct CashDeposit11 {
2224    #[serde(rename = "NoteDnmtn")]
2225    pub note_dnmtn: ActiveOrHistoricCurrencyAndAmount,
2226    #[serde(rename = "NbOfNotes")]
2227    pub nb_of_notes: String,
2228    #[serde(rename = "Amt")]
2229    pub amt: ActiveOrHistoricCurrencyAndAmount,
2230}
2231
2232impl Validate for CashDeposit11 {
2233    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2234        self.note_dnmtn
2235            .validate(&helpers::child_path(path, "NoteDnmtn"), config, collector);
2236        helpers::validate_pattern(
2237            &self.nb_of_notes,
2238            "NbOfNotes",
2239            "[0-9]{1,15}",
2240            &helpers::child_path(path, "NbOfNotes"),
2241            config,
2242            collector,
2243        );
2244        self.amt
2245            .validate(&helpers::child_path(path, "Amt"), config, collector);
2246    }
2247}
2248
2249// ChargeBearerType1Code: Charges are to be applied following the rules agreed in the service level and/or scheme.
2250#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2251pub enum ChargeBearerType1Code {
2252    #[default]
2253    #[serde(rename = "DEBT")]
2254    CodeDEBT,
2255    #[serde(rename = "CRED")]
2256    CodeCRED,
2257    #[serde(rename = "SHAR")]
2258    CodeSHAR,
2259    #[serde(rename = "SLEV")]
2260    CodeSLEV,
2261}
2262
2263impl Validate for ChargeBearerType1Code {
2264    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2265        // Enum validation is typically empty
2266    }
2267}
2268
2269// ChargeType3Choice1: Type of charge in a proprietary form, as defined by the issuer.
2270#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2271pub struct ChargeType3Choice1 {
2272    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2273    pub cd: Option<String>,
2274    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2275    pub prtry: Option<GenericIdentification31>,
2276}
2277
2278impl Validate for ChargeType3Choice1 {
2279    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2280        if let Some(ref val) = self.cd {
2281            helpers::validate_length(
2282                val,
2283                "Cd",
2284                Some(1),
2285                Some(4),
2286                &helpers::child_path(path, "Cd"),
2287                config,
2288                collector,
2289            );
2290        }
2291        if let Some(ref val) = self.prtry
2292            && config.validate_optional_fields
2293        {
2294            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
2295        }
2296    }
2297}
2298
2299// Charges61: Provides details of the individual charges record.
2300#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2301pub struct Charges61 {
2302    #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2303    pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2304    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2305    pub rcrd: Option<Vec<ChargesRecord31>>,
2306}
2307
2308impl Validate for Charges61 {
2309    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2310        if let Some(ref val) = self.ttl_chrgs_and_tax_amt
2311            && config.validate_optional_fields
2312        {
2313            val.validate(
2314                &helpers::child_path(path, "TtlChrgsAndTaxAmt"),
2315                config,
2316                collector,
2317            );
2318        }
2319        if let Some(ref vec) = self.rcrd
2320            && config.validate_optional_fields
2321        {
2322            for item in vec {
2323                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
2324            }
2325        }
2326    }
2327}
2328
2329// ChargesRecord31: Provides details on the tax applied to charges.
2330#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2331pub struct ChargesRecord31 {
2332    #[serde(rename = "Amt")]
2333    pub amt: ActiveOrHistoricCurrencyAndAmount,
2334    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2335    pub cdt_dbt_ind: Option<CreditDebitCode>,
2336    #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2337    pub chrg_incl_ind: Option<bool>,
2338    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2339    pub tp: Option<ChargeType3Choice1>,
2340    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2341    pub rate: Option<f64>,
2342    #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2343    pub br: Option<ChargeBearerType1Code>,
2344    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2345    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
2346    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2347    pub tax: Option<TaxCharges21>,
2348}
2349
2350impl Validate for ChargesRecord31 {
2351    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2352        self.amt
2353            .validate(&helpers::child_path(path, "Amt"), config, collector);
2354        if let Some(ref val) = self.cdt_dbt_ind
2355            && config.validate_optional_fields
2356        {
2357            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2358        }
2359        if let Some(ref val) = self.tp
2360            && config.validate_optional_fields
2361        {
2362            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2363        }
2364        if let Some(ref val) = self.br
2365            && config.validate_optional_fields
2366        {
2367            val.validate(&helpers::child_path(path, "Br"), config, collector);
2368        }
2369        if let Some(ref val) = self.agt
2370            && config.validate_optional_fields
2371        {
2372            val.validate(&helpers::child_path(path, "Agt"), config, collector);
2373        }
2374        if let Some(ref val) = self.tax
2375            && config.validate_optional_fields
2376        {
2377            val.validate(&helpers::child_path(path, "Tax"), config, collector);
2378        }
2379    }
2380}
2381
2382// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
2383#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2384pub struct ClearingSystemIdentification2Choice1 {
2385    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2386    pub cd: Option<String>,
2387}
2388
2389impl Validate for ClearingSystemIdentification2Choice1 {
2390    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2391        if let Some(ref val) = self.cd {
2392            helpers::validate_length(
2393                val,
2394                "Cd",
2395                Some(1),
2396                Some(5),
2397                &helpers::child_path(path, "Cd"),
2398                config,
2399                collector,
2400            );
2401        }
2402    }
2403}
2404
2405// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
2406#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2407pub struct ClearingSystemMemberIdentification21 {
2408    #[serde(rename = "ClrSysId")]
2409    pub clr_sys_id: ClearingSystemIdentification2Choice1,
2410    #[serde(rename = "MmbId")]
2411    pub mmb_id: String,
2412}
2413
2414impl Validate for ClearingSystemMemberIdentification21 {
2415    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2416        self.clr_sys_id
2417            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2418        helpers::validate_length(
2419            &self.mmb_id,
2420            "MmbId",
2421            Some(1),
2422            Some(28),
2423            &helpers::child_path(path, "MmbId"),
2424            config,
2425            collector,
2426        );
2427        helpers::validate_pattern(
2428            &self.mmb_id,
2429            "MmbId",
2430            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2431            &helpers::child_path(path, "MmbId"),
2432            config,
2433            collector,
2434        );
2435    }
2436}
2437
2438// ClearingSystemMemberIdentification22: Identification of a member of a clearing system.
2439#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2440pub struct ClearingSystemMemberIdentification22 {
2441    #[serde(rename = "ClrSysId")]
2442    pub clr_sys_id: ClearingSystemIdentification2Choice1,
2443    #[serde(rename = "MmbId")]
2444    pub mmb_id: String,
2445}
2446
2447impl Validate for ClearingSystemMemberIdentification22 {
2448    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2449        self.clr_sys_id
2450            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2451        helpers::validate_length(
2452            &self.mmb_id,
2453            "MmbId",
2454            Some(1),
2455            Some(35),
2456            &helpers::child_path(path, "MmbId"),
2457            config,
2458            collector,
2459        );
2460    }
2461}
2462
2463// Contact41: Name by which a party is known and which is usually used to identify that party.
2464#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2465pub struct Contact41 {
2466    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2467    pub nm: Option<String>,
2468}
2469
2470impl Validate for Contact41 {
2471    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2472        if let Some(ref val) = self.nm {
2473            helpers::validate_length(
2474                val,
2475                "Nm",
2476                Some(1),
2477                Some(140),
2478                &helpers::child_path(path, "Nm"),
2479                config,
2480                collector,
2481            );
2482        }
2483    }
2484}
2485
2486// Contact42: Name by which a party is known and which is usually used to identify that party.
2487#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2488pub struct Contact42 {
2489    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2490    pub nm: Option<String>,
2491}
2492
2493impl Validate for Contact42 {
2494    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2495        if let Some(ref val) = self.nm {
2496            helpers::validate_length(
2497                val,
2498                "Nm",
2499                Some(1),
2500                Some(140),
2501                &helpers::child_path(path, "Nm"),
2502                config,
2503                collector,
2504            );
2505        }
2506        if let Some(ref val) = self.nm {
2507            helpers::validate_pattern(
2508                val,
2509                "Nm",
2510                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2511                &helpers::child_path(path, "Nm"),
2512                config,
2513                collector,
2514            );
2515        }
2516    }
2517}
2518
2519// Contact43: Preferred method used to reach the contact.
2520#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2521pub struct Contact43 {
2522    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2523    pub nm: Option<String>,
2524    #[serde(rename = "PrefrdMtd", skip_serializing_if = "Option::is_none")]
2525    pub prefrd_mtd: Option<PreferredContactMethod1Code>,
2526}
2527
2528impl Validate for Contact43 {
2529    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2530        if let Some(ref val) = self.nm {
2531            helpers::validate_length(
2532                val,
2533                "Nm",
2534                Some(1),
2535                Some(140),
2536                &helpers::child_path(path, "Nm"),
2537                config,
2538                collector,
2539            );
2540        }
2541        if let Some(ref val) = self.nm {
2542            helpers::validate_pattern(
2543                val,
2544                "Nm",
2545                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2546                &helpers::child_path(path, "Nm"),
2547                config,
2548                collector,
2549            );
2550        }
2551        if let Some(ref val) = self.prefrd_mtd
2552            && config.validate_optional_fields
2553        {
2554            val.validate(&helpers::child_path(path, "PrefrdMtd"), config, collector);
2555        }
2556    }
2557}
2558
2559// CopyDuplicate1Code: Message is for information/confirmation purposes. It is a duplicate of a message previously sent.
2560#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2561pub enum CopyDuplicate1Code {
2562    #[default]
2563    #[serde(rename = "CODU")]
2564    CodeCODU,
2565    #[serde(rename = "COPY")]
2566    CodeCOPY,
2567    #[serde(rename = "DUPL")]
2568    CodeDUPL,
2569}
2570
2571impl Validate for CopyDuplicate1Code {
2572    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2573        // Enum validation is typically empty
2574    }
2575}
2576
2577// CorporateAction91: Identification of a corporate action assigned by an official central body/entity within a given market.
2578#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2579pub struct CorporateAction91 {
2580    #[serde(rename = "EvtTp")]
2581    pub evt_tp: String,
2582    #[serde(rename = "EvtId")]
2583    pub evt_id: String,
2584}
2585
2586impl Validate for CorporateAction91 {
2587    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2588        helpers::validate_length(
2589            &self.evt_tp,
2590            "EvtTp",
2591            Some(1),
2592            Some(35),
2593            &helpers::child_path(path, "EvtTp"),
2594            config,
2595            collector,
2596        );
2597        helpers::validate_pattern(
2598            &self.evt_tp,
2599            "EvtTp",
2600            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2601            &helpers::child_path(path, "EvtTp"),
2602            config,
2603            collector,
2604        );
2605        helpers::validate_length(
2606            &self.evt_id,
2607            "EvtId",
2608            Some(1),
2609            Some(35),
2610            &helpers::child_path(path, "EvtId"),
2611            config,
2612            collector,
2613        );
2614        helpers::validate_pattern(
2615            &self.evt_id,
2616            "EvtId",
2617            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2618            &helpers::child_path(path, "EvtId"),
2619            config,
2620            collector,
2621        );
2622    }
2623}
2624
2625// CreditDebitCode: Operation is a decrease.
2626#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2627pub enum CreditDebitCode {
2628    #[default]
2629    #[serde(rename = "CRDT")]
2630    CodeCRDT,
2631    #[serde(rename = "DBIT")]
2632    CodeDBIT,
2633}
2634
2635impl Validate for CreditDebitCode {
2636    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2637        // Enum validation is typically empty
2638    }
2639}
2640
2641// CreditLine31: Date of the credit line provided when multiple credit lines may be provided.
2642#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2643pub struct CreditLine31 {
2644    #[serde(rename = "Incl")]
2645    pub incl: bool,
2646    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2647    pub tp: Option<CreditLineType1Choice1>,
2648    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
2649    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2650    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2651    pub dt: Option<DateAndDateTime2Choice1>,
2652}
2653
2654impl Validate for CreditLine31 {
2655    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2656        if let Some(ref val) = self.tp
2657            && config.validate_optional_fields
2658        {
2659            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2660        }
2661        if let Some(ref val) = self.amt
2662            && config.validate_optional_fields
2663        {
2664            val.validate(&helpers::child_path(path, "Amt"), config, collector);
2665        }
2666        if let Some(ref val) = self.dt
2667            && config.validate_optional_fields
2668        {
2669            val.validate(&helpers::child_path(path, "Dt"), config, collector);
2670        }
2671    }
2672}
2673
2674// CreditLineType1Choice1: Type of the credit line, in a proprietary form.
2675#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2676pub struct CreditLineType1Choice1 {
2677    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2678    pub cd: Option<String>,
2679    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2680    pub prtry: Option<String>,
2681}
2682
2683impl Validate for CreditLineType1Choice1 {
2684    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2685        if let Some(ref val) = self.cd {
2686            helpers::validate_length(
2687                val,
2688                "Cd",
2689                Some(1),
2690                Some(4),
2691                &helpers::child_path(path, "Cd"),
2692                config,
2693                collector,
2694            );
2695        }
2696        if let Some(ref val) = self.prtry {
2697            helpers::validate_length(
2698                val,
2699                "Prtry",
2700                Some(1),
2701                Some(35),
2702                &helpers::child_path(path, "Prtry"),
2703                config,
2704                collector,
2705            );
2706        }
2707        if let Some(ref val) = self.prtry {
2708            helpers::validate_pattern(
2709                val,
2710                "Prtry",
2711                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2712                &helpers::child_path(path, "Prtry"),
2713                config,
2714                collector,
2715            );
2716        }
2717    }
2718}
2719
2720// CreditorReferenceInformation21: Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction.
2721//
2722// 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.
2723//
2724// 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.
2725#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2726pub struct CreditorReferenceInformation21 {
2727    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2728    pub tp: Option<CreditorReferenceType21>,
2729    #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
2730    pub ref_attr: Option<String>,
2731}
2732
2733impl Validate for CreditorReferenceInformation21 {
2734    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2735        if let Some(ref val) = self.tp
2736            && config.validate_optional_fields
2737        {
2738            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2739        }
2740        if let Some(ref val) = self.ref_attr {
2741            helpers::validate_length(
2742                val,
2743                "Ref",
2744                Some(1),
2745                Some(35),
2746                &helpers::child_path(path, "Ref"),
2747                config,
2748                collector,
2749            );
2750        }
2751        if let Some(ref val) = self.ref_attr {
2752            helpers::validate_pattern(
2753                val,
2754                "Ref",
2755                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2756                &helpers::child_path(path, "Ref"),
2757                config,
2758                collector,
2759            );
2760        }
2761    }
2762}
2763
2764// CreditorReferenceType1Choice1: Creditor reference type, in a proprietary form.
2765#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2766pub struct CreditorReferenceType1Choice1 {
2767    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2768    pub cd: Option<DocumentType3Code>,
2769    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2770    pub prtry: Option<String>,
2771}
2772
2773impl Validate for CreditorReferenceType1Choice1 {
2774    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2775        if let Some(ref val) = self.cd
2776            && config.validate_optional_fields
2777        {
2778            val.validate(&helpers::child_path(path, "Cd"), config, collector);
2779        }
2780        if let Some(ref val) = self.prtry {
2781            helpers::validate_length(
2782                val,
2783                "Prtry",
2784                Some(1),
2785                Some(35),
2786                &helpers::child_path(path, "Prtry"),
2787                config,
2788                collector,
2789            );
2790        }
2791        if let Some(ref val) = self.prtry {
2792            helpers::validate_pattern(
2793                val,
2794                "Prtry",
2795                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2796                &helpers::child_path(path, "Prtry"),
2797                config,
2798                collector,
2799            );
2800        }
2801    }
2802}
2803
2804// CreditorReferenceType21: Entity that assigns the credit reference type.
2805#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2806pub struct CreditorReferenceType21 {
2807    #[serde(rename = "CdOrPrtry")]
2808    pub cd_or_prtry: CreditorReferenceType1Choice1,
2809    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2810    pub issr: Option<String>,
2811}
2812
2813impl Validate for CreditorReferenceType21 {
2814    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2815        self.cd_or_prtry
2816            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
2817        if let Some(ref val) = self.issr {
2818            helpers::validate_length(
2819                val,
2820                "Issr",
2821                Some(1),
2822                Some(35),
2823                &helpers::child_path(path, "Issr"),
2824                config,
2825                collector,
2826            );
2827        }
2828        if let Some(ref val) = self.issr {
2829            helpers::validate_pattern(
2830                val,
2831                "Issr",
2832                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2833                &helpers::child_path(path, "Issr"),
2834                config,
2835                collector,
2836            );
2837        }
2838    }
2839}
2840
2841// CurrencyExchange51: Date and time at which an exchange rate is quoted.
2842#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2843pub struct CurrencyExchange51 {
2844    #[serde(rename = "SrcCcy")]
2845    pub src_ccy: String,
2846    #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2847    pub trgt_ccy: Option<String>,
2848    #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2849    pub unit_ccy: Option<String>,
2850    #[serde(rename = "XchgRate")]
2851    pub xchg_rate: f64,
2852    #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2853    pub ctrct_id: Option<String>,
2854    #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2855    pub qtn_dt: Option<String>,
2856}
2857
2858impl Validate for CurrencyExchange51 {
2859    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2860        helpers::validate_pattern(
2861            &self.src_ccy,
2862            "SrcCcy",
2863            "[A-Z]{3,3}",
2864            &helpers::child_path(path, "SrcCcy"),
2865            config,
2866            collector,
2867        );
2868        if let Some(ref val) = self.trgt_ccy {
2869            helpers::validate_pattern(
2870                val,
2871                "TrgtCcy",
2872                "[A-Z]{3,3}",
2873                &helpers::child_path(path, "TrgtCcy"),
2874                config,
2875                collector,
2876            );
2877        }
2878        if let Some(ref val) = self.unit_ccy {
2879            helpers::validate_pattern(
2880                val,
2881                "UnitCcy",
2882                "[A-Z]{3,3}",
2883                &helpers::child_path(path, "UnitCcy"),
2884                config,
2885                collector,
2886            );
2887        }
2888        if let Some(ref val) = self.ctrct_id {
2889            helpers::validate_length(
2890                val,
2891                "CtrctId",
2892                Some(1),
2893                Some(35),
2894                &helpers::child_path(path, "CtrctId"),
2895                config,
2896                collector,
2897            );
2898        }
2899        if let Some(ref val) = self.ctrct_id {
2900            helpers::validate_pattern(
2901                val,
2902                "CtrctId",
2903                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2904                &helpers::child_path(path, "CtrctId"),
2905                config,
2906                collector,
2907            );
2908        }
2909        if let Some(ref val) = self.qtn_dt {
2910            helpers::validate_pattern(
2911                val,
2912                "QtnDt",
2913                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
2914                &helpers::child_path(path, "QtnDt"),
2915                config,
2916                collector,
2917            );
2918        }
2919    }
2920}
2921
2922// CurrencyExchange52: Date and time at which an exchange rate is quoted.
2923#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2924pub struct CurrencyExchange52 {
2925    #[serde(rename = "SrcCcy")]
2926    pub src_ccy: String,
2927    #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2928    pub trgt_ccy: Option<String>,
2929    #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2930    pub unit_ccy: Option<String>,
2931    #[serde(rename = "XchgRate")]
2932    pub xchg_rate: f64,
2933    #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2934    pub ctrct_id: Option<String>,
2935    #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2936    pub qtn_dt: Option<String>,
2937}
2938
2939impl Validate for CurrencyExchange52 {
2940    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2941        helpers::validate_pattern(
2942            &self.src_ccy,
2943            "SrcCcy",
2944            "[A-Z]{3,3}",
2945            &helpers::child_path(path, "SrcCcy"),
2946            config,
2947            collector,
2948        );
2949        if let Some(ref val) = self.trgt_ccy {
2950            helpers::validate_pattern(
2951                val,
2952                "TrgtCcy",
2953                "[A-Z]{3,3}",
2954                &helpers::child_path(path, "TrgtCcy"),
2955                config,
2956                collector,
2957            );
2958        }
2959        if let Some(ref val) = self.unit_ccy {
2960            helpers::validate_pattern(
2961                val,
2962                "UnitCcy",
2963                "[A-Z]{3,3}",
2964                &helpers::child_path(path, "UnitCcy"),
2965                config,
2966                collector,
2967            );
2968        }
2969        if let Some(ref val) = self.ctrct_id {
2970            helpers::validate_length(
2971                val,
2972                "CtrctId",
2973                Some(1),
2974                Some(35),
2975                &helpers::child_path(path, "CtrctId"),
2976                config,
2977                collector,
2978            );
2979        }
2980        if let Some(ref val) = self.ctrct_id {
2981            helpers::validate_pattern(
2982                val,
2983                "CtrctId",
2984                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2985                &helpers::child_path(path, "CtrctId"),
2986                config,
2987                collector,
2988            );
2989        }
2990    }
2991}
2992
2993// DateAndDateTime2Choice1: Specified date and time.
2994#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2995pub struct DateAndDateTime2Choice1 {
2996    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2997    pub dt: Option<String>,
2998    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
2999    pub dt_tm: Option<String>,
3000}
3001
3002impl Validate for DateAndDateTime2Choice1 {
3003    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3004        if let Some(ref val) = self.dt_tm {
3005            helpers::validate_pattern(
3006                val,
3007                "DtTm",
3008                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3009                &helpers::child_path(path, "DtTm"),
3010                config,
3011                collector,
3012            );
3013        }
3014    }
3015}
3016
3017// DateAndPlaceOfBirth1: Country where a person was born.
3018#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3019pub struct DateAndPlaceOfBirth1 {
3020    #[serde(rename = "BirthDt")]
3021    pub birth_dt: String,
3022    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
3023    pub prvc_of_birth: Option<String>,
3024    #[serde(rename = "CityOfBirth")]
3025    pub city_of_birth: String,
3026    #[serde(rename = "CtryOfBirth")]
3027    pub ctry_of_birth: String,
3028}
3029
3030impl Validate for DateAndPlaceOfBirth1 {
3031    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3032        if let Some(ref val) = self.prvc_of_birth {
3033            helpers::validate_length(
3034                val,
3035                "PrvcOfBirth",
3036                Some(1),
3037                Some(35),
3038                &helpers::child_path(path, "PrvcOfBirth"),
3039                config,
3040                collector,
3041            );
3042        }
3043        helpers::validate_length(
3044            &self.city_of_birth,
3045            "CityOfBirth",
3046            Some(1),
3047            Some(35),
3048            &helpers::child_path(path, "CityOfBirth"),
3049            config,
3050            collector,
3051        );
3052        helpers::validate_pattern(
3053            &self.ctry_of_birth,
3054            "CtryOfBirth",
3055            "[A-Z]{2,2}",
3056            &helpers::child_path(path, "CtryOfBirth"),
3057            config,
3058            collector,
3059        );
3060    }
3061}
3062
3063// DateAndPlaceOfBirth11: Country where a person was born.
3064#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3065pub struct DateAndPlaceOfBirth11 {
3066    #[serde(rename = "BirthDt")]
3067    pub birth_dt: String,
3068    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
3069    pub prvc_of_birth: Option<String>,
3070    #[serde(rename = "CityOfBirth")]
3071    pub city_of_birth: String,
3072    #[serde(rename = "CtryOfBirth")]
3073    pub ctry_of_birth: String,
3074}
3075
3076impl Validate for DateAndPlaceOfBirth11 {
3077    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3078        if let Some(ref val) = self.prvc_of_birth {
3079            helpers::validate_length(
3080                val,
3081                "PrvcOfBirth",
3082                Some(1),
3083                Some(35),
3084                &helpers::child_path(path, "PrvcOfBirth"),
3085                config,
3086                collector,
3087            );
3088        }
3089        if let Some(ref val) = self.prvc_of_birth {
3090            helpers::validate_pattern(
3091                val,
3092                "PrvcOfBirth",
3093                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3094                &helpers::child_path(path, "PrvcOfBirth"),
3095                config,
3096                collector,
3097            );
3098        }
3099        helpers::validate_length(
3100            &self.city_of_birth,
3101            "CityOfBirth",
3102            Some(1),
3103            Some(35),
3104            &helpers::child_path(path, "CityOfBirth"),
3105            config,
3106            collector,
3107        );
3108        helpers::validate_pattern(
3109            &self.city_of_birth,
3110            "CityOfBirth",
3111            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3112            &helpers::child_path(path, "CityOfBirth"),
3113            config,
3114            collector,
3115        );
3116        helpers::validate_pattern(
3117            &self.ctry_of_birth,
3118            "CtryOfBirth",
3119            "[A-Z]{2,2}",
3120            &helpers::child_path(path, "CtryOfBirth"),
3121            config,
3122            collector,
3123        );
3124    }
3125}
3126
3127// DateOrDateTimePeriod1Choice1: Period expressed a dates and times.
3128#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3129pub struct DateOrDateTimePeriod1Choice1 {
3130    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3131    pub dt: Option<DatePeriod2>,
3132    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3133    pub dt_tm: Option<DateTimePeriod11>,
3134}
3135
3136impl Validate for DateOrDateTimePeriod1Choice1 {
3137    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3138        if let Some(ref val) = self.dt
3139            && config.validate_optional_fields
3140        {
3141            val.validate(&helpers::child_path(path, "Dt"), config, collector);
3142        }
3143        if let Some(ref val) = self.dt_tm
3144            && config.validate_optional_fields
3145        {
3146            val.validate(&helpers::child_path(path, "DtTm"), config, collector);
3147        }
3148    }
3149}
3150
3151// DatePeriod2: End date of the range.
3152#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3153pub struct DatePeriod2 {
3154    #[serde(rename = "FrDt")]
3155    pub fr_dt: String,
3156    #[serde(rename = "ToDt")]
3157    pub to_dt: String,
3158}
3159
3160impl Validate for DatePeriod2 {
3161    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
3162}
3163
3164// DateTimePeriod11: Date and time at which the period ends.
3165#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3166pub struct DateTimePeriod11 {
3167    #[serde(rename = "FrDtTm")]
3168    pub fr_dt_tm: String,
3169    #[serde(rename = "ToDtTm")]
3170    pub to_dt_tm: String,
3171}
3172
3173impl Validate for DateTimePeriod11 {
3174    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3175        helpers::validate_pattern(
3176            &self.fr_dt_tm,
3177            "FrDtTm",
3178            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3179            &helpers::child_path(path, "FrDtTm"),
3180            config,
3181            collector,
3182        );
3183        helpers::validate_pattern(
3184            &self.to_dt_tm,
3185            "ToDtTm",
3186            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3187            &helpers::child_path(path, "ToDtTm"),
3188            config,
3189            collector,
3190        );
3191    }
3192}
3193
3194// DiscountAmountAndType1: Amount of money, which has been typed.
3195#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3196pub struct DiscountAmountAndType1 {
3197    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3198    pub tp: Option<DiscountAmountType1Choice>,
3199    #[serde(rename = "Amt")]
3200    pub amt: ActiveOrHistoricCurrencyAndAmount,
3201}
3202
3203impl Validate for DiscountAmountAndType1 {
3204    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3205        if let Some(ref val) = self.tp
3206            && config.validate_optional_fields
3207        {
3208            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3209        }
3210        self.amt
3211            .validate(&helpers::child_path(path, "Amt"), config, collector);
3212    }
3213}
3214
3215// DiscountAmountAndType11: Amount of money, which has been typed.
3216#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3217pub struct DiscountAmountAndType11 {
3218    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3219    pub tp: Option<DiscountAmountType1Choice1>,
3220    #[serde(rename = "Amt")]
3221    pub amt: ActiveOrHistoricCurrencyAndAmount,
3222}
3223
3224impl Validate for DiscountAmountAndType11 {
3225    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3226        if let Some(ref val) = self.tp
3227            && config.validate_optional_fields
3228        {
3229            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3230        }
3231        self.amt
3232            .validate(&helpers::child_path(path, "Amt"), config, collector);
3233    }
3234}
3235
3236// DiscountAmountType1Choice: Specifies the amount type, in a free-text form.
3237#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3238pub struct DiscountAmountType1Choice {
3239    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3240    pub cd: Option<String>,
3241    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3242    pub prtry: Option<String>,
3243}
3244
3245impl Validate for DiscountAmountType1Choice {
3246    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3247        if let Some(ref val) = self.cd {
3248            helpers::validate_length(
3249                val,
3250                "Cd",
3251                Some(1),
3252                Some(4),
3253                &helpers::child_path(path, "Cd"),
3254                config,
3255                collector,
3256            );
3257        }
3258        if let Some(ref val) = self.prtry {
3259            helpers::validate_length(
3260                val,
3261                "Prtry",
3262                Some(1),
3263                Some(35),
3264                &helpers::child_path(path, "Prtry"),
3265                config,
3266                collector,
3267            );
3268        }
3269    }
3270}
3271
3272// DiscountAmountType1Choice1: Specifies the amount type, in a free-text form.
3273#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3274pub struct DiscountAmountType1Choice1 {
3275    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3276    pub cd: Option<String>,
3277    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3278    pub prtry: Option<String>,
3279}
3280
3281impl Validate for DiscountAmountType1Choice1 {
3282    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3283        if let Some(ref val) = self.cd {
3284            helpers::validate_length(
3285                val,
3286                "Cd",
3287                Some(1),
3288                Some(4),
3289                &helpers::child_path(path, "Cd"),
3290                config,
3291                collector,
3292            );
3293        }
3294        if let Some(ref val) = self.prtry {
3295            helpers::validate_length(
3296                val,
3297                "Prtry",
3298                Some(1),
3299                Some(35),
3300                &helpers::child_path(path, "Prtry"),
3301                config,
3302                collector,
3303            );
3304        }
3305        if let Some(ref val) = self.prtry {
3306            helpers::validate_pattern(
3307                val,
3308                "Prtry",
3309                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3310                &helpers::child_path(path, "Prtry"),
3311                config,
3312                collector,
3313            );
3314        }
3315    }
3316}
3317
3318// DisplayCapabilities1: Number of columns of the display component.
3319#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3320pub struct DisplayCapabilities1 {
3321    #[serde(rename = "DispTp")]
3322    pub disp_tp: UserInterface2Code,
3323    #[serde(rename = "NbOfLines")]
3324    pub nb_of_lines: String,
3325    #[serde(rename = "LineWidth")]
3326    pub line_width: String,
3327}
3328
3329impl Validate for DisplayCapabilities1 {
3330    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3331        self.disp_tp
3332            .validate(&helpers::child_path(path, "DispTp"), config, collector);
3333        helpers::validate_pattern(
3334            &self.nb_of_lines,
3335            "NbOfLines",
3336            "[0-9]{1,3}",
3337            &helpers::child_path(path, "NbOfLines"),
3338            config,
3339            collector,
3340        );
3341        helpers::validate_pattern(
3342            &self.line_width,
3343            "LineWidth",
3344            "[0-9]{1,3}",
3345            &helpers::child_path(path, "LineWidth"),
3346            config,
3347            collector,
3348        );
3349    }
3350}
3351
3352// DocumentAdjustment11: Provides further details on the document adjustment.
3353#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3354pub struct DocumentAdjustment11 {
3355    #[serde(rename = "Amt")]
3356    pub amt: ActiveOrHistoricCurrencyAndAmount,
3357    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
3358    pub cdt_dbt_ind: Option<CreditDebitCode>,
3359    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
3360    pub rsn: Option<String>,
3361    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
3362    pub addtl_inf: Option<String>,
3363}
3364
3365impl Validate for DocumentAdjustment11 {
3366    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3367        self.amt
3368            .validate(&helpers::child_path(path, "Amt"), config, collector);
3369        if let Some(ref val) = self.cdt_dbt_ind
3370            && config.validate_optional_fields
3371        {
3372            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
3373        }
3374        if let Some(ref val) = self.rsn {
3375            helpers::validate_length(
3376                val,
3377                "Rsn",
3378                Some(1),
3379                Some(4),
3380                &helpers::child_path(path, "Rsn"),
3381                config,
3382                collector,
3383            );
3384        }
3385        if let Some(ref val) = self.rsn {
3386            helpers::validate_pattern(
3387                val,
3388                "Rsn",
3389                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3390                &helpers::child_path(path, "Rsn"),
3391                config,
3392                collector,
3393            );
3394        }
3395        if let Some(ref val) = self.addtl_inf {
3396            helpers::validate_length(
3397                val,
3398                "AddtlInf",
3399                Some(1),
3400                Some(140),
3401                &helpers::child_path(path, "AddtlInf"),
3402                config,
3403                collector,
3404            );
3405        }
3406        if let Some(ref val) = self.addtl_inf {
3407            helpers::validate_pattern(
3408                val,
3409                "AddtlInf",
3410                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3411                &helpers::child_path(path, "AddtlInf"),
3412                config,
3413                collector,
3414            );
3415        }
3416    }
3417}
3418
3419// DocumentLineIdentification11: Date associated with the referred document line.
3420#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3421pub struct DocumentLineIdentification11 {
3422    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3423    pub tp: Option<DocumentLineType11>,
3424    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
3425    pub nb: Option<String>,
3426    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
3427    pub rltd_dt: Option<String>,
3428}
3429
3430impl Validate for DocumentLineIdentification11 {
3431    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3432        if let Some(ref val) = self.tp
3433            && config.validate_optional_fields
3434        {
3435            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3436        }
3437        if let Some(ref val) = self.nb {
3438            helpers::validate_length(
3439                val,
3440                "Nb",
3441                Some(1),
3442                Some(35),
3443                &helpers::child_path(path, "Nb"),
3444                config,
3445                collector,
3446            );
3447        }
3448        if let Some(ref val) = self.nb {
3449            helpers::validate_pattern(
3450                val,
3451                "Nb",
3452                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3453                &helpers::child_path(path, "Nb"),
3454                config,
3455                collector,
3456            );
3457        }
3458    }
3459}
3460
3461// DocumentLineInformation11: Provides details on the amounts of the document line.
3462#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3463pub struct DocumentLineInformation11 {
3464    #[serde(rename = "Id")]
3465    pub id: Vec<DocumentLineIdentification11>,
3466    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
3467    pub desc: Option<String>,
3468    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
3469    pub amt: Option<RemittanceAmount31>,
3470}
3471
3472impl Validate for DocumentLineInformation11 {
3473    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3474        for item in &self.id {
3475            item.validate(&helpers::child_path(path, "Id"), config, collector);
3476        }
3477        if let Some(ref val) = self.desc {
3478            helpers::validate_length(
3479                val,
3480                "Desc",
3481                Some(1),
3482                Some(2048),
3483                &helpers::child_path(path, "Desc"),
3484                config,
3485                collector,
3486            );
3487        }
3488        if let Some(ref val) = self.desc {
3489            helpers::validate_pattern(
3490                val,
3491                "Desc",
3492                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3493                &helpers::child_path(path, "Desc"),
3494                config,
3495                collector,
3496            );
3497        }
3498        if let Some(ref val) = self.amt
3499            && config.validate_optional_fields
3500        {
3501            val.validate(&helpers::child_path(path, "Amt"), config, collector);
3502        }
3503    }
3504}
3505
3506// DocumentLineType1Choice1: Proprietary identification of the type of the remittance document.
3507#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3508pub struct DocumentLineType1Choice1 {
3509    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3510    pub cd: Option<String>,
3511    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3512    pub prtry: Option<String>,
3513}
3514
3515impl Validate for DocumentLineType1Choice1 {
3516    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3517        if let Some(ref val) = self.cd {
3518            helpers::validate_length(
3519                val,
3520                "Cd",
3521                Some(1),
3522                Some(4),
3523                &helpers::child_path(path, "Cd"),
3524                config,
3525                collector,
3526            );
3527        }
3528        if let Some(ref val) = self.prtry {
3529            helpers::validate_length(
3530                val,
3531                "Prtry",
3532                Some(1),
3533                Some(35),
3534                &helpers::child_path(path, "Prtry"),
3535                config,
3536                collector,
3537            );
3538        }
3539        if let Some(ref val) = self.prtry {
3540            helpers::validate_pattern(
3541                val,
3542                "Prtry",
3543                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3544                &helpers::child_path(path, "Prtry"),
3545                config,
3546                collector,
3547            );
3548        }
3549    }
3550}
3551
3552// DocumentLineType11: Identification of the issuer of the reference document line identificationtype.
3553#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3554pub struct DocumentLineType11 {
3555    #[serde(rename = "CdOrPrtry")]
3556    pub cd_or_prtry: DocumentLineType1Choice1,
3557    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3558    pub issr: Option<String>,
3559}
3560
3561impl Validate for DocumentLineType11 {
3562    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3563        self.cd_or_prtry
3564            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
3565        if let Some(ref val) = self.issr {
3566            helpers::validate_length(
3567                val,
3568                "Issr",
3569                Some(1),
3570                Some(35),
3571                &helpers::child_path(path, "Issr"),
3572                config,
3573                collector,
3574            );
3575        }
3576        if let Some(ref val) = self.issr {
3577            helpers::validate_pattern(
3578                val,
3579                "Issr",
3580                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3581                &helpers::child_path(path, "Issr"),
3582                config,
3583                collector,
3584            );
3585        }
3586    }
3587}
3588
3589// DocumentType3Code: Document is a structured communication reference provided by the creditor to identify the referred transaction.
3590#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3591pub enum DocumentType3Code {
3592    #[default]
3593    #[serde(rename = "RADM")]
3594    CodeRADM,
3595    #[serde(rename = "RPIN")]
3596    CodeRPIN,
3597    #[serde(rename = "FXDR")]
3598    CodeFXDR,
3599    #[serde(rename = "DISP")]
3600    CodeDISP,
3601    #[serde(rename = "PUOR")]
3602    CodePUOR,
3603    #[serde(rename = "SCOR")]
3604    CodeSCOR,
3605}
3606
3607impl Validate for DocumentType3Code {
3608    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3609        // Enum validation is typically empty
3610    }
3611}
3612
3613// DocumentType6Code: Document is a purchase order.
3614#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3615pub enum DocumentType6Code {
3616    #[default]
3617    #[serde(rename = "MSIN")]
3618    CodeMSIN,
3619    #[serde(rename = "CNFA")]
3620    CodeCNFA,
3621    #[serde(rename = "DNFA")]
3622    CodeDNFA,
3623    #[serde(rename = "CINV")]
3624    CodeCINV,
3625    #[serde(rename = "CREN")]
3626    CodeCREN,
3627    #[serde(rename = "DEBN")]
3628    CodeDEBN,
3629    #[serde(rename = "HIRI")]
3630    CodeHIRI,
3631    #[serde(rename = "SBIN")]
3632    CodeSBIN,
3633    #[serde(rename = "CMCN")]
3634    CodeCMCN,
3635    #[serde(rename = "SOAC")]
3636    CodeSOAC,
3637    #[serde(rename = "DISP")]
3638    CodeDISP,
3639    #[serde(rename = "BOLD")]
3640    CodeBOLD,
3641    #[serde(rename = "VCHR")]
3642    CodeVCHR,
3643    #[serde(rename = "AROI")]
3644    CodeAROI,
3645    #[serde(rename = "TSUT")]
3646    CodeTSUT,
3647    #[serde(rename = "PUOR")]
3648    CodePUOR,
3649}
3650
3651impl Validate for DocumentType6Code {
3652    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3653        // Enum validation is typically empty
3654    }
3655}
3656
3657// EntryDetails91: Provides information on the underlying transaction(s).
3658#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3659pub struct EntryDetails91 {
3660    #[serde(rename = "Btch", skip_serializing_if = "Option::is_none")]
3661    pub btch: Option<BatchInformation21>,
3662    #[serde(rename = "TxDtls")]
3663    pub tx_dtls: EntryTransaction101,
3664}
3665
3666impl Validate for EntryDetails91 {
3667    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3668        if let Some(ref val) = self.btch
3669            && config.validate_optional_fields
3670        {
3671            val.validate(&helpers::child_path(path, "Btch"), config, collector);
3672        }
3673        self.tx_dtls
3674            .validate(&helpers::child_path(path, "TxDtls"), config, collector);
3675    }
3676}
3677
3678// EntryStatus1Choice1: Entry status, in a coded form.
3679#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3680pub struct EntryStatus1Choice1 {
3681    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3682    pub cd: Option<String>,
3683}
3684
3685impl Validate for EntryStatus1Choice1 {
3686    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3687        if let Some(ref val) = self.cd {
3688            helpers::validate_length(
3689                val,
3690                "Cd",
3691                Some(1),
3692                Some(4),
3693                &helpers::child_path(path, "Cd"),
3694                config,
3695                collector,
3696            );
3697        }
3698    }
3699}
3700
3701// EntryTransaction101: Further details of the transaction.
3702#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3703pub struct EntryTransaction101 {
3704    #[serde(rename = "Refs")]
3705    pub refs: TransactionReferences61,
3706    #[serde(rename = "Amt")]
3707    pub amt: ActiveOrHistoricCurrencyAndAmount,
3708    #[serde(rename = "CdtDbtInd")]
3709    pub cdt_dbt_ind: CreditDebitCode,
3710    #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
3711    pub amt_dtls: Option<AmountAndCurrencyExchange32>,
3712    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
3713    pub avlbty: Option<Vec<CashAvailability1>>,
3714    #[serde(rename = "BkTxCd", skip_serializing_if = "Option::is_none")]
3715    pub bk_tx_cd: Option<BankTransactionCodeStructure41>,
3716    #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
3717    pub chrgs: Option<Charges61>,
3718    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
3719    pub intrst: Option<TransactionInterest41>,
3720    #[serde(rename = "RltdPties", skip_serializing_if = "Option::is_none")]
3721    pub rltd_pties: Option<TransactionParties61>,
3722    #[serde(rename = "RltdAgts", skip_serializing_if = "Option::is_none")]
3723    pub rltd_agts: Option<TransactionAgents51>,
3724    #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3725    pub lcl_instrm: Option<LocalInstrument2Choice1>,
3726    #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
3727    pub purp: Option<Purpose2Choice1>,
3728    #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
3729    pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
3730    #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
3731    pub rmt_inf: Option<RemittanceInformation161>,
3732    #[serde(rename = "RltdDts", skip_serializing_if = "Option::is_none")]
3733    pub rltd_dts: Option<TransactionDates31>,
3734    #[serde(rename = "RltdPric", skip_serializing_if = "Option::is_none")]
3735    pub rltd_pric: Option<TransactionPrice4Choice1>,
3736    #[serde(rename = "RltdQties", skip_serializing_if = "Option::is_none")]
3737    pub rltd_qties: Option<Vec<TransactionQuantities3Choice1>>,
3738    #[serde(rename = "FinInstrmId", skip_serializing_if = "Option::is_none")]
3739    pub fin_instrm_id: Option<SecurityIdentification191>,
3740    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
3741    pub tax: Option<TaxInformation81>,
3742    #[serde(rename = "RtrInf", skip_serializing_if = "Option::is_none")]
3743    pub rtr_inf: Option<PaymentReturnReason51>,
3744    #[serde(rename = "CorpActn", skip_serializing_if = "Option::is_none")]
3745    pub corp_actn: Option<CorporateAction91>,
3746    #[serde(rename = "SfkpgAcct", skip_serializing_if = "Option::is_none")]
3747    pub sfkpg_acct: Option<SecuritiesAccount191>,
3748    #[serde(rename = "CshDpst", skip_serializing_if = "Option::is_none")]
3749    pub csh_dpst: Option<Vec<CashDeposit11>>,
3750    #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
3751    pub card_tx: Option<CardTransaction171>,
3752    #[serde(rename = "AddtlTxInf", skip_serializing_if = "Option::is_none")]
3753    pub addtl_tx_inf: Option<String>,
3754}
3755
3756impl Validate for EntryTransaction101 {
3757    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3758        self.refs
3759            .validate(&helpers::child_path(path, "Refs"), config, collector);
3760        self.amt
3761            .validate(&helpers::child_path(path, "Amt"), config, collector);
3762        self.cdt_dbt_ind
3763            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
3764        if let Some(ref val) = self.amt_dtls
3765            && config.validate_optional_fields
3766        {
3767            val.validate(&helpers::child_path(path, "AmtDtls"), config, collector);
3768        }
3769        if let Some(ref vec) = self.avlbty
3770            && config.validate_optional_fields
3771        {
3772            for item in vec {
3773                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
3774            }
3775        }
3776        if let Some(ref val) = self.bk_tx_cd
3777            && config.validate_optional_fields
3778        {
3779            val.validate(&helpers::child_path(path, "BkTxCd"), config, collector);
3780        }
3781        if let Some(ref val) = self.chrgs
3782            && config.validate_optional_fields
3783        {
3784            val.validate(&helpers::child_path(path, "Chrgs"), config, collector);
3785        }
3786        if let Some(ref val) = self.intrst
3787            && config.validate_optional_fields
3788        {
3789            val.validate(&helpers::child_path(path, "Intrst"), config, collector);
3790        }
3791        if let Some(ref val) = self.rltd_pties
3792            && config.validate_optional_fields
3793        {
3794            val.validate(&helpers::child_path(path, "RltdPties"), config, collector);
3795        }
3796        if let Some(ref val) = self.rltd_agts
3797            && config.validate_optional_fields
3798        {
3799            val.validate(&helpers::child_path(path, "RltdAgts"), config, collector);
3800        }
3801        if let Some(ref val) = self.lcl_instrm
3802            && config.validate_optional_fields
3803        {
3804            val.validate(&helpers::child_path(path, "LclInstrm"), config, collector);
3805        }
3806        if let Some(ref val) = self.purp
3807            && config.validate_optional_fields
3808        {
3809            val.validate(&helpers::child_path(path, "Purp"), config, collector);
3810        }
3811        if let Some(ref vec) = self.rltd_rmt_inf
3812            && config.validate_optional_fields
3813        {
3814            for item in vec {
3815                item.validate(&helpers::child_path(path, "RltdRmtInf"), config, collector);
3816            }
3817        }
3818        if let Some(ref val) = self.rmt_inf
3819            && config.validate_optional_fields
3820        {
3821            val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
3822        }
3823        if let Some(ref val) = self.rltd_dts
3824            && config.validate_optional_fields
3825        {
3826            val.validate(&helpers::child_path(path, "RltdDts"), config, collector);
3827        }
3828        if let Some(ref val) = self.rltd_pric
3829            && config.validate_optional_fields
3830        {
3831            val.validate(&helpers::child_path(path, "RltdPric"), config, collector);
3832        }
3833        if let Some(ref vec) = self.rltd_qties
3834            && config.validate_optional_fields
3835        {
3836            for item in vec {
3837                item.validate(&helpers::child_path(path, "RltdQties"), config, collector);
3838            }
3839        }
3840        if let Some(ref val) = self.fin_instrm_id
3841            && config.validate_optional_fields
3842        {
3843            val.validate(&helpers::child_path(path, "FinInstrmId"), config, collector);
3844        }
3845        if let Some(ref val) = self.tax
3846            && config.validate_optional_fields
3847        {
3848            val.validate(&helpers::child_path(path, "Tax"), config, collector);
3849        }
3850        if let Some(ref val) = self.rtr_inf
3851            && config.validate_optional_fields
3852        {
3853            val.validate(&helpers::child_path(path, "RtrInf"), config, collector);
3854        }
3855        if let Some(ref val) = self.corp_actn
3856            && config.validate_optional_fields
3857        {
3858            val.validate(&helpers::child_path(path, "CorpActn"), config, collector);
3859        }
3860        if let Some(ref val) = self.sfkpg_acct
3861            && config.validate_optional_fields
3862        {
3863            val.validate(&helpers::child_path(path, "SfkpgAcct"), config, collector);
3864        }
3865        if let Some(ref vec) = self.csh_dpst
3866            && config.validate_optional_fields
3867        {
3868            for item in vec {
3869                item.validate(&helpers::child_path(path, "CshDpst"), config, collector);
3870            }
3871        }
3872        if let Some(ref val) = self.card_tx
3873            && config.validate_optional_fields
3874        {
3875            val.validate(&helpers::child_path(path, "CardTx"), config, collector);
3876        }
3877        if let Some(ref val) = self.addtl_tx_inf {
3878            helpers::validate_length(
3879                val,
3880                "AddtlTxInf",
3881                Some(1),
3882                Some(500),
3883                &helpers::child_path(path, "AddtlTxInf"),
3884                config,
3885                collector,
3886            );
3887        }
3888        if let Some(ref val) = self.addtl_tx_inf {
3889            helpers::validate_pattern(
3890                val,
3891                "AddtlTxInf",
3892                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3893                &helpers::child_path(path, "AddtlTxInf"),
3894                config,
3895                collector,
3896            );
3897        }
3898    }
3899}
3900
3901// FinancialIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
3902#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3903pub struct FinancialIdentificationSchemeName1Choice1 {
3904    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3905    pub cd: Option<String>,
3906    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3907    pub prtry: Option<String>,
3908}
3909
3910impl Validate for FinancialIdentificationSchemeName1Choice1 {
3911    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3912        if let Some(ref val) = self.cd {
3913            helpers::validate_length(
3914                val,
3915                "Cd",
3916                Some(1),
3917                Some(4),
3918                &helpers::child_path(path, "Cd"),
3919                config,
3920                collector,
3921            );
3922        }
3923        if let Some(ref val) = self.prtry {
3924            helpers::validate_length(
3925                val,
3926                "Prtry",
3927                Some(1),
3928                Some(35),
3929                &helpers::child_path(path, "Prtry"),
3930                config,
3931                collector,
3932            );
3933        }
3934        if let Some(ref val) = self.prtry {
3935            helpers::validate_pattern(
3936                val,
3937                "Prtry",
3938                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3939                &helpers::child_path(path, "Prtry"),
3940                config,
3941                collector,
3942            );
3943        }
3944    }
3945}
3946
3947// FinancialInstitutionIdentification181: Unique identification of an agent, as assigned by an institution, using an identification scheme.
3948#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3949pub struct FinancialInstitutionIdentification181 {
3950    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
3951    pub bicfi: Option<String>,
3952    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
3953    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
3954    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3955    pub lei: Option<String>,
3956    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3957    pub nm: Option<String>,
3958    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3959    pub pstl_adr: Option<PostalAddress241>,
3960    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3961    pub othr: Option<GenericFinancialIdentification11>,
3962}
3963
3964impl Validate for FinancialInstitutionIdentification181 {
3965    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3966        if let Some(ref val) = self.bicfi {
3967            helpers::validate_pattern(
3968                val,
3969                "BICFI",
3970                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
3971                &helpers::child_path(path, "BICFI"),
3972                config,
3973                collector,
3974            );
3975        }
3976        if let Some(ref val) = self.clr_sys_mmb_id
3977            && config.validate_optional_fields
3978        {
3979            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
3980        }
3981        if let Some(ref val) = self.lei {
3982            helpers::validate_pattern(
3983                val,
3984                "LEI",
3985                "[A-Z0-9]{18,18}[0-9]{2,2}",
3986                &helpers::child_path(path, "LEI"),
3987                config,
3988                collector,
3989            );
3990        }
3991        if let Some(ref val) = self.nm {
3992            helpers::validate_length(
3993                val,
3994                "Nm",
3995                Some(1),
3996                Some(140),
3997                &helpers::child_path(path, "Nm"),
3998                config,
3999                collector,
4000            );
4001        }
4002        if let Some(ref val) = self.nm {
4003            helpers::validate_pattern(
4004                val,
4005                "Nm",
4006                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4007                &helpers::child_path(path, "Nm"),
4008                config,
4009                collector,
4010            );
4011        }
4012        if let Some(ref val) = self.pstl_adr
4013            && config.validate_optional_fields
4014        {
4015            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4016        }
4017        if let Some(ref val) = self.othr
4018            && config.validate_optional_fields
4019        {
4020            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4021        }
4022    }
4023}
4024
4025// FinancialInstitutionIdentification182: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4026#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4027pub struct FinancialInstitutionIdentification182 {
4028    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4029    pub bicfi: Option<String>,
4030    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4031    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
4032    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4033    pub lei: Option<String>,
4034    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4035    pub nm: Option<String>,
4036    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4037    pub pstl_adr: Option<PostalAddress241>,
4038    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4039    pub othr: Option<GenericFinancialIdentification11>,
4040}
4041
4042impl Validate for FinancialInstitutionIdentification182 {
4043    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4044        if let Some(ref val) = self.bicfi {
4045            helpers::validate_pattern(
4046                val,
4047                "BICFI",
4048                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4049                &helpers::child_path(path, "BICFI"),
4050                config,
4051                collector,
4052            );
4053        }
4054        if let Some(ref val) = self.clr_sys_mmb_id
4055            && config.validate_optional_fields
4056        {
4057            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4058        }
4059        if let Some(ref val) = self.lei {
4060            helpers::validate_pattern(
4061                val,
4062                "LEI",
4063                "[A-Z0-9]{18,18}[0-9]{2,2}",
4064                &helpers::child_path(path, "LEI"),
4065                config,
4066                collector,
4067            );
4068        }
4069        if let Some(ref val) = self.nm {
4070            helpers::validate_length(
4071                val,
4072                "Nm",
4073                Some(1),
4074                Some(140),
4075                &helpers::child_path(path, "Nm"),
4076                config,
4077                collector,
4078            );
4079        }
4080        if let Some(ref val) = self.nm {
4081            helpers::validate_pattern(
4082                val,
4083                "Nm",
4084                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4085                &helpers::child_path(path, "Nm"),
4086                config,
4087                collector,
4088            );
4089        }
4090        if let Some(ref val) = self.pstl_adr
4091            && config.validate_optional_fields
4092        {
4093            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4094        }
4095        if let Some(ref val) = self.othr
4096            && config.validate_optional_fields
4097        {
4098            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4099        }
4100    }
4101}
4102
4103// FinancialInstrumentQuantity1Choice: Quantity expressed as an amount representing the current amortised face amount of a bond, for example, a periodic reduction/increase of a bond's principal amount.
4104#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4105pub struct FinancialInstrumentQuantity1Choice {
4106    #[serde(rename = "Unit", skip_serializing_if = "Option::is_none")]
4107    pub unit: Option<f64>,
4108    #[serde(rename = "FaceAmt", skip_serializing_if = "Option::is_none")]
4109    pub face_amt: Option<f64>,
4110    #[serde(rename = "AmtsdVal", skip_serializing_if = "Option::is_none")]
4111    pub amtsd_val: Option<f64>,
4112}
4113
4114impl Validate for FinancialInstrumentQuantity1Choice {
4115    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
4116}
4117
4118// FromToAmountRange1: Upper boundary of a range of amount values.
4119#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4120pub struct FromToAmountRange1 {
4121    #[serde(rename = "FrAmt")]
4122    pub fr_amt: AmountRangeBoundary1,
4123    #[serde(rename = "ToAmt")]
4124    pub to_amt: AmountRangeBoundary1,
4125}
4126
4127impl Validate for FromToAmountRange1 {
4128    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4129        self.fr_amt
4130            .validate(&helpers::child_path(path, "FrAmt"), config, collector);
4131        self.to_amt
4132            .validate(&helpers::child_path(path, "ToAmt"), config, collector);
4133    }
4134}
4135
4136// Garnishment31: Indicates if the employment of the person to whom the garnishment applies (that is, the ultimate debtor) has been terminated.
4137#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4138pub struct Garnishment31 {
4139    #[serde(rename = "Tp")]
4140    pub tp: GarnishmentType11,
4141    #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
4142    pub grnshee: Option<PartyIdentification1355>,
4143    #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
4144    pub grnshmt_admstr: Option<PartyIdentification1356>,
4145    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4146    pub ref_nb: Option<String>,
4147    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4148    pub dt: Option<String>,
4149    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4150    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4151    #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
4152    pub fmly_mdcl_insrnc_ind: Option<bool>,
4153    #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
4154    pub mplyee_termntn_ind: Option<bool>,
4155}
4156
4157impl Validate for Garnishment31 {
4158    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4159        self.tp
4160            .validate(&helpers::child_path(path, "Tp"), config, collector);
4161        if let Some(ref val) = self.grnshee
4162            && config.validate_optional_fields
4163        {
4164            val.validate(&helpers::child_path(path, "Grnshee"), config, collector);
4165        }
4166        if let Some(ref val) = self.grnshmt_admstr
4167            && config.validate_optional_fields
4168        {
4169            val.validate(
4170                &helpers::child_path(path, "GrnshmtAdmstr"),
4171                config,
4172                collector,
4173            );
4174        }
4175        if let Some(ref val) = self.ref_nb {
4176            helpers::validate_length(
4177                val,
4178                "RefNb",
4179                Some(1),
4180                Some(140),
4181                &helpers::child_path(path, "RefNb"),
4182                config,
4183                collector,
4184            );
4185        }
4186        if let Some(ref val) = self.ref_nb {
4187            helpers::validate_pattern(
4188                val,
4189                "RefNb",
4190                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4191                &helpers::child_path(path, "RefNb"),
4192                config,
4193                collector,
4194            );
4195        }
4196        if let Some(ref val) = self.rmtd_amt
4197            && config.validate_optional_fields
4198        {
4199            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
4200        }
4201    }
4202}
4203
4204// GarnishmentType1Choice1: Proprietary identification of the type of garnishment.
4205#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4206pub struct GarnishmentType1Choice1 {
4207    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4208    pub cd: Option<String>,
4209    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4210    pub prtry: Option<String>,
4211}
4212
4213impl Validate for GarnishmentType1Choice1 {
4214    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4215        if let Some(ref val) = self.cd {
4216            helpers::validate_length(
4217                val,
4218                "Cd",
4219                Some(1),
4220                Some(4),
4221                &helpers::child_path(path, "Cd"),
4222                config,
4223                collector,
4224            );
4225        }
4226        if let Some(ref val) = self.prtry {
4227            helpers::validate_length(
4228                val,
4229                "Prtry",
4230                Some(1),
4231                Some(35),
4232                &helpers::child_path(path, "Prtry"),
4233                config,
4234                collector,
4235            );
4236        }
4237        if let Some(ref val) = self.prtry {
4238            helpers::validate_pattern(
4239                val,
4240                "Prtry",
4241                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4242                &helpers::child_path(path, "Prtry"),
4243                config,
4244                collector,
4245            );
4246        }
4247    }
4248}
4249
4250// GarnishmentType11: Identification of the issuer of the garnishment type.
4251#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4252pub struct GarnishmentType11 {
4253    #[serde(rename = "CdOrPrtry")]
4254    pub cd_or_prtry: GarnishmentType1Choice1,
4255    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4256    pub issr: Option<String>,
4257}
4258
4259impl Validate for GarnishmentType11 {
4260    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4261        self.cd_or_prtry
4262            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
4263        if let Some(ref val) = self.issr {
4264            helpers::validate_length(
4265                val,
4266                "Issr",
4267                Some(1),
4268                Some(35),
4269                &helpers::child_path(path, "Issr"),
4270                config,
4271                collector,
4272            );
4273        }
4274        if let Some(ref val) = self.issr {
4275            helpers::validate_pattern(
4276                val,
4277                "Issr",
4278                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4279                &helpers::child_path(path, "Issr"),
4280                config,
4281                collector,
4282            );
4283        }
4284    }
4285}
4286
4287// GenericAccountIdentification11: Entity that assigns the identification.
4288#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4289pub struct GenericAccountIdentification11 {
4290    #[serde(rename = "Id")]
4291    pub id: String,
4292    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4293    pub schme_nm: Option<AccountSchemeName1Choice1>,
4294    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4295    pub issr: Option<String>,
4296}
4297
4298impl Validate for GenericAccountIdentification11 {
4299    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4300        helpers::validate_length(
4301            &self.id,
4302            "Id",
4303            Some(1),
4304            Some(34),
4305            &helpers::child_path(path, "Id"),
4306            config,
4307            collector,
4308        );
4309        helpers::validate_pattern(
4310            &self.id,
4311            "Id",
4312            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
4313            &helpers::child_path(path, "Id"),
4314            config,
4315            collector,
4316        );
4317        if let Some(ref val) = self.schme_nm
4318            && config.validate_optional_fields
4319        {
4320            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4321        }
4322        if let Some(ref val) = self.issr {
4323            helpers::validate_length(
4324                val,
4325                "Issr",
4326                Some(1),
4327                Some(35),
4328                &helpers::child_path(path, "Issr"),
4329                config,
4330                collector,
4331            );
4332        }
4333        if let Some(ref val) = self.issr {
4334            helpers::validate_pattern(
4335                val,
4336                "Issr",
4337                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4338                &helpers::child_path(path, "Issr"),
4339                config,
4340                collector,
4341            );
4342        }
4343    }
4344}
4345
4346// GenericFinancialIdentification11: Entity that assigns the identification.
4347#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4348pub struct GenericFinancialIdentification11 {
4349    #[serde(rename = "Id")]
4350    pub id: String,
4351    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4352    pub schme_nm: Option<FinancialIdentificationSchemeName1Choice1>,
4353    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4354    pub issr: Option<String>,
4355}
4356
4357impl Validate for GenericFinancialIdentification11 {
4358    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4359        helpers::validate_length(
4360            &self.id,
4361            "Id",
4362            Some(1),
4363            Some(35),
4364            &helpers::child_path(path, "Id"),
4365            config,
4366            collector,
4367        );
4368        helpers::validate_pattern(
4369            &self.id,
4370            "Id",
4371            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4372            &helpers::child_path(path, "Id"),
4373            config,
4374            collector,
4375        );
4376        if let Some(ref val) = self.schme_nm
4377            && config.validate_optional_fields
4378        {
4379            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4380        }
4381        if let Some(ref val) = self.issr {
4382            helpers::validate_length(
4383                val,
4384                "Issr",
4385                Some(1),
4386                Some(35),
4387                &helpers::child_path(path, "Issr"),
4388                config,
4389                collector,
4390            );
4391        }
4392        if let Some(ref val) = self.issr {
4393            helpers::validate_pattern(
4394                val,
4395                "Issr",
4396                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4397                &helpers::child_path(path, "Issr"),
4398                config,
4399                collector,
4400            );
4401        }
4402    }
4403}
4404
4405// GenericIdentification11: Entity that assigns the identification.
4406#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4407pub struct GenericIdentification11 {
4408    #[serde(rename = "Id")]
4409    pub id: String,
4410    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4411    pub schme_nm: Option<String>,
4412    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4413    pub issr: Option<String>,
4414}
4415
4416impl Validate for GenericIdentification11 {
4417    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4418        helpers::validate_length(
4419            &self.id,
4420            "Id",
4421            Some(1),
4422            Some(35),
4423            &helpers::child_path(path, "Id"),
4424            config,
4425            collector,
4426        );
4427        helpers::validate_pattern(
4428            &self.id,
4429            "Id",
4430            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4431            &helpers::child_path(path, "Id"),
4432            config,
4433            collector,
4434        );
4435        if let Some(ref val) = self.schme_nm {
4436            helpers::validate_length(
4437                val,
4438                "SchmeNm",
4439                Some(1),
4440                Some(35),
4441                &helpers::child_path(path, "SchmeNm"),
4442                config,
4443                collector,
4444            );
4445        }
4446        if let Some(ref val) = self.schme_nm {
4447            helpers::validate_pattern(
4448                val,
4449                "SchmeNm",
4450                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4451                &helpers::child_path(path, "SchmeNm"),
4452                config,
4453                collector,
4454            );
4455        }
4456        if let Some(ref val) = self.issr {
4457            helpers::validate_length(
4458                val,
4459                "Issr",
4460                Some(1),
4461                Some(35),
4462                &helpers::child_path(path, "Issr"),
4463                config,
4464                collector,
4465            );
4466        }
4467        if let Some(ref val) = self.issr {
4468            helpers::validate_pattern(
4469                val,
4470                "Issr",
4471                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4472                &helpers::child_path(path, "Issr"),
4473                config,
4474                collector,
4475            );
4476        }
4477    }
4478}
4479
4480// GenericIdentification301: Short textual description of the scheme.
4481#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4482pub struct GenericIdentification301 {
4483    #[serde(rename = "Id")]
4484    pub id: String,
4485    #[serde(rename = "Issr")]
4486    pub issr: String,
4487    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4488    pub schme_nm: Option<String>,
4489}
4490
4491impl Validate for GenericIdentification301 {
4492    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4493        helpers::validate_pattern(
4494            &self.id,
4495            "Id",
4496            "[a-zA-Z0-9]{4}",
4497            &helpers::child_path(path, "Id"),
4498            config,
4499            collector,
4500        );
4501        helpers::validate_length(
4502            &self.issr,
4503            "Issr",
4504            Some(1),
4505            Some(35),
4506            &helpers::child_path(path, "Issr"),
4507            config,
4508            collector,
4509        );
4510        helpers::validate_pattern(
4511            &self.issr,
4512            "Issr",
4513            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4514            &helpers::child_path(path, "Issr"),
4515            config,
4516            collector,
4517        );
4518        if let Some(ref val) = self.schme_nm {
4519            helpers::validate_length(
4520                val,
4521                "SchmeNm",
4522                Some(1),
4523                Some(35),
4524                &helpers::child_path(path, "SchmeNm"),
4525                config,
4526                collector,
4527            );
4528        }
4529        if let Some(ref val) = self.schme_nm {
4530            helpers::validate_pattern(
4531                val,
4532                "SchmeNm",
4533                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4534                &helpers::child_path(path, "SchmeNm"),
4535                config,
4536                collector,
4537            );
4538        }
4539    }
4540}
4541
4542// GenericIdentification302: Short textual description of the scheme.
4543#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4544pub struct GenericIdentification302 {
4545    #[serde(rename = "Id")]
4546    pub id: String,
4547    #[serde(rename = "Issr")]
4548    pub issr: String,
4549    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4550    pub schme_nm: Option<String>,
4551}
4552
4553impl Validate for GenericIdentification302 {
4554    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4555        helpers::validate_pattern(
4556            &self.id,
4557            "Id",
4558            "[a-zA-Z0-9]{4}",
4559            &helpers::child_path(path, "Id"),
4560            config,
4561            collector,
4562        );
4563        helpers::validate_length(
4564            &self.issr,
4565            "Issr",
4566            Some(1),
4567            Some(35),
4568            &helpers::child_path(path, "Issr"),
4569            config,
4570            collector,
4571        );
4572        helpers::validate_pattern(
4573            &self.issr,
4574            "Issr",
4575            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4576            &helpers::child_path(path, "Issr"),
4577            config,
4578            collector,
4579        );
4580        if let Some(ref val) = self.schme_nm {
4581            helpers::validate_length(
4582                val,
4583                "SchmeNm",
4584                Some(1),
4585                Some(35),
4586                &helpers::child_path(path, "SchmeNm"),
4587                config,
4588                collector,
4589            );
4590        }
4591        if let Some(ref val) = self.schme_nm {
4592            helpers::validate_pattern(
4593                val,
4594                "SchmeNm",
4595                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4596                &helpers::child_path(path, "SchmeNm"),
4597                config,
4598                collector,
4599            );
4600        }
4601    }
4602}
4603
4604// GenericIdentification321: Name of the entity.
4605#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4606pub struct GenericIdentification321 {
4607    #[serde(rename = "Id")]
4608    pub id: String,
4609    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4610    pub tp: Option<PartyType3Code>,
4611    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4612    pub issr: Option<PartyType4Code>,
4613    #[serde(rename = "ShrtNm", skip_serializing_if = "Option::is_none")]
4614    pub shrt_nm: Option<String>,
4615}
4616
4617impl Validate for GenericIdentification321 {
4618    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4619        helpers::validate_length(
4620            &self.id,
4621            "Id",
4622            Some(1),
4623            Some(35),
4624            &helpers::child_path(path, "Id"),
4625            config,
4626            collector,
4627        );
4628        helpers::validate_pattern(
4629            &self.id,
4630            "Id",
4631            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4632            &helpers::child_path(path, "Id"),
4633            config,
4634            collector,
4635        );
4636        if let Some(ref val) = self.tp
4637            && config.validate_optional_fields
4638        {
4639            val.validate(&helpers::child_path(path, "Tp"), config, collector);
4640        }
4641        if let Some(ref val) = self.issr
4642            && config.validate_optional_fields
4643        {
4644            val.validate(&helpers::child_path(path, "Issr"), config, collector);
4645        }
4646        if let Some(ref val) = self.shrt_nm {
4647            helpers::validate_length(
4648                val,
4649                "ShrtNm",
4650                Some(1),
4651                Some(35),
4652                &helpers::child_path(path, "ShrtNm"),
4653                config,
4654                collector,
4655            );
4656        }
4657        if let Some(ref val) = self.shrt_nm {
4658            helpers::validate_pattern(
4659                val,
4660                "ShrtNm",
4661                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4662                &helpers::child_path(path, "ShrtNm"),
4663                config,
4664                collector,
4665            );
4666        }
4667    }
4668}
4669
4670// GenericIdentification31: Entity that assigns the identification.
4671#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4672pub struct GenericIdentification31 {
4673    #[serde(rename = "Id")]
4674    pub id: String,
4675    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4676    pub issr: Option<String>,
4677}
4678
4679impl Validate for GenericIdentification31 {
4680    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4681        helpers::validate_length(
4682            &self.id,
4683            "Id",
4684            Some(1),
4685            Some(35),
4686            &helpers::child_path(path, "Id"),
4687            config,
4688            collector,
4689        );
4690        helpers::validate_pattern(
4691            &self.id,
4692            "Id",
4693            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4694            &helpers::child_path(path, "Id"),
4695            config,
4696            collector,
4697        );
4698        if let Some(ref val) = self.issr {
4699            helpers::validate_length(
4700                val,
4701                "Issr",
4702                Some(1),
4703                Some(35),
4704                &helpers::child_path(path, "Issr"),
4705                config,
4706                collector,
4707            );
4708        }
4709        if let Some(ref val) = self.issr {
4710            helpers::validate_pattern(
4711                val,
4712                "Issr",
4713                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4714                &helpers::child_path(path, "Issr"),
4715                config,
4716                collector,
4717            );
4718        }
4719    }
4720}
4721
4722// GenericOrganisationIdentification11: Entity that assigns the identification.
4723#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4724pub struct GenericOrganisationIdentification11 {
4725    #[serde(rename = "Id")]
4726    pub id: String,
4727    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4728    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
4729    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4730    pub issr: Option<String>,
4731}
4732
4733impl Validate for GenericOrganisationIdentification11 {
4734    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4735        helpers::validate_length(
4736            &self.id,
4737            "Id",
4738            Some(1),
4739            Some(35),
4740            &helpers::child_path(path, "Id"),
4741            config,
4742            collector,
4743        );
4744        helpers::validate_pattern(
4745            &self.id,
4746            "Id",
4747            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4748            &helpers::child_path(path, "Id"),
4749            config,
4750            collector,
4751        );
4752        if let Some(ref val) = self.schme_nm
4753            && config.validate_optional_fields
4754        {
4755            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4756        }
4757        if let Some(ref val) = self.issr {
4758            helpers::validate_length(
4759                val,
4760                "Issr",
4761                Some(1),
4762                Some(35),
4763                &helpers::child_path(path, "Issr"),
4764                config,
4765                collector,
4766            );
4767        }
4768        if let Some(ref val) = self.issr {
4769            helpers::validate_pattern(
4770                val,
4771                "Issr",
4772                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4773                &helpers::child_path(path, "Issr"),
4774                config,
4775                collector,
4776            );
4777        }
4778    }
4779}
4780
4781// GenericOrganisationIdentification12: Entity that assigns the identification.
4782#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4783pub struct GenericOrganisationIdentification12 {
4784    #[serde(rename = "Id")]
4785    pub id: String,
4786    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4787    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice2>,
4788    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4789    pub issr: Option<String>,
4790}
4791
4792impl Validate for GenericOrganisationIdentification12 {
4793    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4794        helpers::validate_length(
4795            &self.id,
4796            "Id",
4797            Some(1),
4798            Some(35),
4799            &helpers::child_path(path, "Id"),
4800            config,
4801            collector,
4802        );
4803        helpers::validate_pattern(
4804            &self.id,
4805            "Id",
4806            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4807            &helpers::child_path(path, "Id"),
4808            config,
4809            collector,
4810        );
4811        if let Some(ref val) = self.schme_nm
4812            && config.validate_optional_fields
4813        {
4814            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4815        }
4816        if let Some(ref val) = self.issr {
4817            helpers::validate_length(
4818                val,
4819                "Issr",
4820                Some(1),
4821                Some(35),
4822                &helpers::child_path(path, "Issr"),
4823                config,
4824                collector,
4825            );
4826        }
4827        if let Some(ref val) = self.issr {
4828            helpers::validate_pattern(
4829                val,
4830                "Issr",
4831                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4832                &helpers::child_path(path, "Issr"),
4833                config,
4834                collector,
4835            );
4836        }
4837    }
4838}
4839
4840// GenericPersonIdentification11: Entity that assigns the identification.
4841#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4842pub struct GenericPersonIdentification11 {
4843    #[serde(rename = "Id")]
4844    pub id: String,
4845    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4846    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
4847    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4848    pub issr: Option<String>,
4849}
4850
4851impl Validate for GenericPersonIdentification11 {
4852    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4853        helpers::validate_length(
4854            &self.id,
4855            "Id",
4856            Some(1),
4857            Some(35),
4858            &helpers::child_path(path, "Id"),
4859            config,
4860            collector,
4861        );
4862        helpers::validate_pattern(
4863            &self.id,
4864            "Id",
4865            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4866            &helpers::child_path(path, "Id"),
4867            config,
4868            collector,
4869        );
4870        if let Some(ref val) = self.schme_nm
4871            && config.validate_optional_fields
4872        {
4873            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4874        }
4875        if let Some(ref val) = self.issr {
4876            helpers::validate_length(
4877                val,
4878                "Issr",
4879                Some(1),
4880                Some(35),
4881                &helpers::child_path(path, "Issr"),
4882                config,
4883                collector,
4884            );
4885        }
4886        if let Some(ref val) = self.issr {
4887            helpers::validate_pattern(
4888                val,
4889                "Issr",
4890                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4891                &helpers::child_path(path, "Issr"),
4892                config,
4893                collector,
4894            );
4895        }
4896    }
4897}
4898
4899// GenericPersonIdentification12: Entity that assigns the identification.
4900#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4901pub struct GenericPersonIdentification12 {
4902    #[serde(rename = "Id")]
4903    pub id: String,
4904    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4905    pub schme_nm: Option<PersonIdentificationSchemeName1Choice2>,
4906    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4907    pub issr: Option<String>,
4908}
4909
4910impl Validate for GenericPersonIdentification12 {
4911    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4912        helpers::validate_length(
4913            &self.id,
4914            "Id",
4915            Some(1),
4916            Some(35),
4917            &helpers::child_path(path, "Id"),
4918            config,
4919            collector,
4920        );
4921        helpers::validate_pattern(
4922            &self.id,
4923            "Id",
4924            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4925            &helpers::child_path(path, "Id"),
4926            config,
4927            collector,
4928        );
4929        if let Some(ref val) = self.schme_nm
4930            && config.validate_optional_fields
4931        {
4932            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4933        }
4934        if let Some(ref val) = self.issr {
4935            helpers::validate_length(
4936                val,
4937                "Issr",
4938                Some(1),
4939                Some(35),
4940                &helpers::child_path(path, "Issr"),
4941                config,
4942                collector,
4943            );
4944        }
4945        if let Some(ref val) = self.issr {
4946            helpers::validate_pattern(
4947                val,
4948                "Issr",
4949                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4950                &helpers::child_path(path, "Issr"),
4951                config,
4952                collector,
4953            );
4954        }
4955    }
4956}
4957
4958// GroupHeader811: Further details of the message.
4959#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4960pub struct GroupHeader811 {
4961    #[serde(rename = "MsgId")]
4962    pub msg_id: String,
4963    #[serde(rename = "CreDtTm")]
4964    pub cre_dt_tm: String,
4965    #[serde(rename = "MsgRcpt", skip_serializing_if = "Option::is_none")]
4966    pub msg_rcpt: Option<PartyIdentification1351>,
4967    #[serde(rename = "OrgnlBizQry", skip_serializing_if = "Option::is_none")]
4968    pub orgnl_biz_qry: Option<OriginalBusinessQuery11>,
4969    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
4970    pub addtl_inf: Option<String>,
4971}
4972
4973impl Validate for GroupHeader811 {
4974    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4975        helpers::validate_length(
4976            &self.msg_id,
4977            "MsgId",
4978            Some(1),
4979            Some(35),
4980            &helpers::child_path(path, "MsgId"),
4981            config,
4982            collector,
4983        );
4984        helpers::validate_pattern(
4985            &self.msg_id,
4986            "MsgId",
4987            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4988            &helpers::child_path(path, "MsgId"),
4989            config,
4990            collector,
4991        );
4992        helpers::validate_pattern(
4993            &self.cre_dt_tm,
4994            "CreDtTm",
4995            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
4996            &helpers::child_path(path, "CreDtTm"),
4997            config,
4998            collector,
4999        );
5000        if let Some(ref val) = self.msg_rcpt
5001            && config.validate_optional_fields
5002        {
5003            val.validate(&helpers::child_path(path, "MsgRcpt"), config, collector);
5004        }
5005        if let Some(ref val) = self.orgnl_biz_qry
5006            && config.validate_optional_fields
5007        {
5008            val.validate(&helpers::child_path(path, "OrgnlBizQry"), config, collector);
5009        }
5010        if let Some(ref val) = self.addtl_inf {
5011            helpers::validate_length(
5012                val,
5013                "AddtlInf",
5014                Some(1),
5015                Some(500),
5016                &helpers::child_path(path, "AddtlInf"),
5017                config,
5018                collector,
5019            );
5020        }
5021        if let Some(ref val) = self.addtl_inf {
5022            helpers::validate_pattern(
5023                val,
5024                "AddtlInf",
5025                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5026                &helpers::child_path(path, "AddtlInf"),
5027                config,
5028                collector,
5029            );
5030        }
5031    }
5032}
5033
5034// IdentificationSource3Choice1: Unique and unambiguous identification source using a proprietary identification scheme.
5035#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5036pub struct IdentificationSource3Choice1 {
5037    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5038    pub cd: Option<String>,
5039    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5040    pub prtry: Option<String>,
5041}
5042
5043impl Validate for IdentificationSource3Choice1 {
5044    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5045        if let Some(ref val) = self.cd {
5046            helpers::validate_length(
5047                val,
5048                "Cd",
5049                Some(1),
5050                Some(4),
5051                &helpers::child_path(path, "Cd"),
5052                config,
5053                collector,
5054            );
5055        }
5056        if let Some(ref val) = self.prtry {
5057            helpers::validate_length(
5058                val,
5059                "Prtry",
5060                Some(1),
5061                Some(35),
5062                &helpers::child_path(path, "Prtry"),
5063                config,
5064                collector,
5065            );
5066        }
5067        if let Some(ref val) = self.prtry {
5068            helpers::validate_pattern(
5069                val,
5070                "Prtry",
5071                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5072                &helpers::child_path(path, "Prtry"),
5073                config,
5074                collector,
5075            );
5076        }
5077    }
5078}
5079
5080// ImpliedCurrencyAmountRange1Choice: Value that an amount must not match to be considered valid.
5081#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5082pub struct ImpliedCurrencyAmountRange1Choice {
5083    #[serde(rename = "FrAmt", skip_serializing_if = "Option::is_none")]
5084    pub fr_amt: Option<AmountRangeBoundary1>,
5085    #[serde(rename = "ToAmt", skip_serializing_if = "Option::is_none")]
5086    pub to_amt: Option<AmountRangeBoundary1>,
5087    #[serde(rename = "FrToAmt", skip_serializing_if = "Option::is_none")]
5088    pub fr_to_amt: Option<FromToAmountRange1>,
5089    #[serde(rename = "EQAmt", skip_serializing_if = "Option::is_none")]
5090    pub eq_amt: Option<f64>,
5091    #[serde(rename = "NEQAmt", skip_serializing_if = "Option::is_none")]
5092    pub neq_amt: Option<f64>,
5093}
5094
5095impl Validate for ImpliedCurrencyAmountRange1Choice {
5096    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5097        if let Some(ref val) = self.fr_amt
5098            && config.validate_optional_fields
5099        {
5100            val.validate(&helpers::child_path(path, "FrAmt"), config, collector);
5101        }
5102        if let Some(ref val) = self.to_amt
5103            && config.validate_optional_fields
5104        {
5105            val.validate(&helpers::child_path(path, "ToAmt"), config, collector);
5106        }
5107        if let Some(ref val) = self.fr_to_amt
5108            && config.validate_optional_fields
5109        {
5110            val.validate(&helpers::child_path(path, "FrToAmt"), config, collector);
5111        }
5112    }
5113}
5114
5115// InterestRecord21: Provides details on the tax applied to charges.
5116#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5117pub struct InterestRecord21 {
5118    #[serde(rename = "Amt")]
5119    pub amt: ActiveOrHistoricCurrencyAndAmount,
5120    #[serde(rename = "CdtDbtInd")]
5121    pub cdt_dbt_ind: CreditDebitCode,
5122    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5123    pub tp: Option<InterestType1Choice1>,
5124    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
5125    pub rate: Option<Rate41>,
5126    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5127    pub fr_to_dt: Option<DateTimePeriod11>,
5128    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
5129    pub rsn: Option<String>,
5130    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
5131    pub tax: Option<TaxCharges21>,
5132}
5133
5134impl Validate for InterestRecord21 {
5135    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5136        self.amt
5137            .validate(&helpers::child_path(path, "Amt"), config, collector);
5138        self.cdt_dbt_ind
5139            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
5140        if let Some(ref val) = self.tp
5141            && config.validate_optional_fields
5142        {
5143            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5144        }
5145        if let Some(ref val) = self.rate
5146            && config.validate_optional_fields
5147        {
5148            val.validate(&helpers::child_path(path, "Rate"), config, collector);
5149        }
5150        if let Some(ref val) = self.fr_to_dt
5151            && config.validate_optional_fields
5152        {
5153            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
5154        }
5155        if let Some(ref val) = self.rsn {
5156            helpers::validate_length(
5157                val,
5158                "Rsn",
5159                Some(1),
5160                Some(35),
5161                &helpers::child_path(path, "Rsn"),
5162                config,
5163                collector,
5164            );
5165        }
5166        if let Some(ref val) = self.rsn {
5167            helpers::validate_pattern(
5168                val,
5169                "Rsn",
5170                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5171                &helpers::child_path(path, "Rsn"),
5172                config,
5173                collector,
5174            );
5175        }
5176        if let Some(ref val) = self.tax
5177            && config.validate_optional_fields
5178        {
5179            val.validate(&helpers::child_path(path, "Tax"), config, collector);
5180        }
5181    }
5182}
5183
5184// InterestType1Choice1: Specifies the type of interest in uncoded form.
5185#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5186pub struct InterestType1Choice1 {
5187    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5188    pub cd: Option<InterestType1Code>,
5189    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5190    pub prtry: Option<String>,
5191}
5192
5193impl Validate for InterestType1Choice1 {
5194    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5195        if let Some(ref val) = self.cd
5196            && config.validate_optional_fields
5197        {
5198            val.validate(&helpers::child_path(path, "Cd"), config, collector);
5199        }
5200        if let Some(ref val) = self.prtry {
5201            helpers::validate_length(
5202                val,
5203                "Prtry",
5204                Some(1),
5205                Some(35),
5206                &helpers::child_path(path, "Prtry"),
5207                config,
5208                collector,
5209            );
5210        }
5211        if let Some(ref val) = self.prtry {
5212            helpers::validate_pattern(
5213                val,
5214                "Prtry",
5215                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5216                &helpers::child_path(path, "Prtry"),
5217                config,
5218                collector,
5219            );
5220        }
5221    }
5222}
5223
5224// InterestType1Code: Period of time between the end of a business day and the start of the next business day (usually the day after).
5225#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5226pub enum InterestType1Code {
5227    #[default]
5228    #[serde(rename = "INDY")]
5229    CodeINDY,
5230    #[serde(rename = "OVRN")]
5231    CodeOVRN,
5232}
5233
5234impl Validate for InterestType1Code {
5235    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5236        // Enum validation is typically empty
5237    }
5238}
5239
5240// LocalInstrument2Choice1: Specifies the local instrument, as a proprietary code.
5241#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5242pub struct LocalInstrument2Choice1 {
5243    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5244    pub cd: Option<String>,
5245    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5246    pub prtry: Option<String>,
5247}
5248
5249impl Validate for LocalInstrument2Choice1 {
5250    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5251        if let Some(ref val) = self.cd {
5252            helpers::validate_length(
5253                val,
5254                "Cd",
5255                Some(1),
5256                Some(35),
5257                &helpers::child_path(path, "Cd"),
5258                config,
5259                collector,
5260            );
5261        }
5262        if let Some(ref val) = self.prtry {
5263            helpers::validate_length(
5264                val,
5265                "Prtry",
5266                Some(1),
5267                Some(35),
5268                &helpers::child_path(path, "Prtry"),
5269                config,
5270                collector,
5271            );
5272        }
5273        if let Some(ref val) = self.prtry {
5274            helpers::validate_pattern(
5275                val,
5276                "Prtry",
5277                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5278                &helpers::child_path(path, "Prtry"),
5279                config,
5280                collector,
5281            );
5282        }
5283    }
5284}
5285
5286// MessageIdentification21: Specifies the identification of the message that will be used to provide additional details.
5287#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5288pub struct MessageIdentification21 {
5289    #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5290    pub msg_nm_id: Option<String>,
5291    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
5292    pub msg_id: Option<String>,
5293}
5294
5295impl Validate for MessageIdentification21 {
5296    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5297        if let Some(ref val) = self.msg_nm_id {
5298            helpers::validate_length(
5299                val,
5300                "MsgNmId",
5301                Some(1),
5302                Some(35),
5303                &helpers::child_path(path, "MsgNmId"),
5304                config,
5305                collector,
5306            );
5307        }
5308        if let Some(ref val) = self.msg_nm_id {
5309            helpers::validate_pattern(
5310                val,
5311                "MsgNmId",
5312                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5313                &helpers::child_path(path, "MsgNmId"),
5314                config,
5315                collector,
5316            );
5317        }
5318        if let Some(ref val) = self.msg_id {
5319            helpers::validate_length(
5320                val,
5321                "MsgId",
5322                Some(1),
5323                Some(35),
5324                &helpers::child_path(path, "MsgId"),
5325                config,
5326                collector,
5327            );
5328        }
5329        if let Some(ref val) = self.msg_id {
5330            helpers::validate_pattern(
5331                val,
5332                "MsgId",
5333                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5334                &helpers::child_path(path, "MsgId"),
5335                config,
5336                collector,
5337            );
5338        }
5339    }
5340}
5341
5342// NameAndAddress161: Postal address of a party.
5343#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5344pub struct NameAndAddress161 {
5345    #[serde(rename = "Nm")]
5346    pub nm: String,
5347    #[serde(rename = "Adr")]
5348    pub adr: PostalAddress241,
5349}
5350
5351impl Validate for NameAndAddress161 {
5352    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5353        helpers::validate_length(
5354            &self.nm,
5355            "Nm",
5356            Some(1),
5357            Some(140),
5358            &helpers::child_path(path, "Nm"),
5359            config,
5360            collector,
5361        );
5362        helpers::validate_pattern(
5363            &self.nm,
5364            "Nm",
5365            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5366            &helpers::child_path(path, "Nm"),
5367            config,
5368            collector,
5369        );
5370        self.adr
5371            .validate(&helpers::child_path(path, "Adr"), config, collector);
5372    }
5373}
5374
5375// NumberAndSumOfTransactions1: Total of all individual entries included in the report.
5376#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5377pub struct NumberAndSumOfTransactions1 {
5378    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5379    pub nb_of_ntries: Option<String>,
5380    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5381    pub sum: Option<f64>,
5382}
5383
5384impl Validate for NumberAndSumOfTransactions1 {
5385    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5386        if let Some(ref val) = self.nb_of_ntries {
5387            helpers::validate_pattern(
5388                val,
5389                "NbOfNtries",
5390                "[0-9]{1,15}",
5391                &helpers::child_path(path, "NbOfNtries"),
5392                config,
5393                collector,
5394            );
5395        }
5396    }
5397}
5398
5399// NumberAndSumOfTransactions4: Resulting debit or credit amount of the netted amounts for all debit and credit entries.
5400#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5401pub struct NumberAndSumOfTransactions4 {
5402    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5403    pub nb_of_ntries: Option<String>,
5404    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5405    pub sum: Option<f64>,
5406    #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
5407    pub ttl_net_ntry: Option<AmountAndDirection35>,
5408}
5409
5410impl Validate for NumberAndSumOfTransactions4 {
5411    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5412        if let Some(ref val) = self.nb_of_ntries {
5413            helpers::validate_pattern(
5414                val,
5415                "NbOfNtries",
5416                "[0-9]{1,15}",
5417                &helpers::child_path(path, "NbOfNtries"),
5418                config,
5419                collector,
5420            );
5421        }
5422        if let Some(ref val) = self.ttl_net_ntry
5423            && config.validate_optional_fields
5424        {
5425            val.validate(&helpers::child_path(path, "TtlNetNtry"), config, collector);
5426        }
5427    }
5428}
5429
5430// OnLineCapability1Code: Off-line capable with possible on-line requests to the acquirer.
5431#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5432pub enum OnLineCapability1Code {
5433    #[default]
5434    #[serde(rename = "OFLN")]
5435    CodeOFLN,
5436    #[serde(rename = "ONLN")]
5437    CodeONLN,
5438    #[serde(rename = "SMON")]
5439    CodeSMON,
5440}
5441
5442impl Validate for OnLineCapability1Code {
5443    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5444        // Enum validation is typically empty
5445    }
5446}
5447
5448// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
5449#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5450pub struct OrganisationIdentification291 {
5451    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5452    pub any_bic: Option<String>,
5453    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5454    pub lei: Option<String>,
5455    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5456    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
5457}
5458
5459impl Validate for OrganisationIdentification291 {
5460    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5461        if let Some(ref val) = self.any_bic {
5462            helpers::validate_pattern(
5463                val,
5464                "AnyBIC",
5465                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
5466                &helpers::child_path(path, "AnyBIC"),
5467                config,
5468                collector,
5469            );
5470        }
5471        if let Some(ref val) = self.lei {
5472            helpers::validate_pattern(
5473                val,
5474                "LEI",
5475                "[A-Z0-9]{18,18}[0-9]{2,2}",
5476                &helpers::child_path(path, "LEI"),
5477                config,
5478                collector,
5479            );
5480        }
5481        if let Some(ref vec) = self.othr
5482            && config.validate_optional_fields
5483        {
5484            for item in vec {
5485                item.validate(&helpers::child_path(path, "Othr"), config, collector);
5486            }
5487        }
5488    }
5489}
5490
5491// OrganisationIdentification292: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
5492#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5493pub struct OrganisationIdentification292 {
5494    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5495    pub any_bic: Option<String>,
5496    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5497    pub lei: Option<String>,
5498    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5499    pub othr: Option<Vec<GenericOrganisationIdentification12>>,
5500}
5501
5502impl Validate for OrganisationIdentification292 {
5503    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5504        if let Some(ref val) = self.any_bic {
5505            helpers::validate_pattern(
5506                val,
5507                "AnyBIC",
5508                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
5509                &helpers::child_path(path, "AnyBIC"),
5510                config,
5511                collector,
5512            );
5513        }
5514        if let Some(ref val) = self.lei {
5515            helpers::validate_pattern(
5516                val,
5517                "LEI",
5518                "[A-Z0-9]{18,18}[0-9]{2,2}",
5519                &helpers::child_path(path, "LEI"),
5520                config,
5521                collector,
5522            );
5523        }
5524        if let Some(ref vec) = self.othr
5525            && config.validate_optional_fields
5526        {
5527            for item in vec {
5528                item.validate(&helpers::child_path(path, "Othr"), config, collector);
5529            }
5530        }
5531    }
5532}
5533
5534// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
5535#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5536pub struct OrganisationIdentificationSchemeName1Choice1 {
5537    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5538    pub cd: Option<String>,
5539    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5540    pub prtry: Option<String>,
5541}
5542
5543impl Validate for OrganisationIdentificationSchemeName1Choice1 {
5544    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5545        if let Some(ref val) = self.cd {
5546            helpers::validate_length(
5547                val,
5548                "Cd",
5549                Some(1),
5550                Some(4),
5551                &helpers::child_path(path, "Cd"),
5552                config,
5553                collector,
5554            );
5555        }
5556        if let Some(ref val) = self.prtry {
5557            helpers::validate_length(
5558                val,
5559                "Prtry",
5560                Some(1),
5561                Some(35),
5562                &helpers::child_path(path, "Prtry"),
5563                config,
5564                collector,
5565            );
5566        }
5567        if let Some(ref val) = self.prtry {
5568            helpers::validate_pattern(
5569                val,
5570                "Prtry",
5571                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5572                &helpers::child_path(path, "Prtry"),
5573                config,
5574                collector,
5575            );
5576        }
5577    }
5578}
5579
5580// OrganisationIdentificationSchemeName1Choice2: Name of the identification scheme, in a free text form.
5581#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5582pub struct OrganisationIdentificationSchemeName1Choice2 {
5583    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5584    pub cd: Option<String>,
5585    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5586    pub prtry: Option<String>,
5587}
5588
5589impl Validate for OrganisationIdentificationSchemeName1Choice2 {
5590    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5591        if let Some(ref val) = self.cd {
5592            helpers::validate_length(
5593                val,
5594                "Cd",
5595                Some(1),
5596                Some(4),
5597                &helpers::child_path(path, "Cd"),
5598                config,
5599                collector,
5600            );
5601        }
5602        if let Some(ref val) = self.prtry {
5603            helpers::validate_length(
5604                val,
5605                "Prtry",
5606                Some(1),
5607                Some(35),
5608                &helpers::child_path(path, "Prtry"),
5609                config,
5610                collector,
5611            );
5612        }
5613        if let Some(ref val) = self.prtry {
5614            helpers::validate_pattern(
5615                val,
5616                "Prtry",
5617                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5618                &helpers::child_path(path, "Prtry"),
5619                config,
5620                collector,
5621            );
5622        }
5623    }
5624}
5625
5626// OriginalAndCurrentQuantities1: Quantity expressed as an amount representing the current amortised face amount of a bond, for example, a periodic reduction/increase of a bond's principal amount.
5627#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5628pub struct OriginalAndCurrentQuantities1 {
5629    #[serde(rename = "FaceAmt")]
5630    pub face_amt: f64,
5631    #[serde(rename = "AmtsdVal")]
5632    pub amtsd_val: f64,
5633}
5634
5635impl Validate for OriginalAndCurrentQuantities1 {
5636    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
5637}
5638
5639// OriginalBusinessQuery11: Date and time at which the message was created.
5640#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5641pub struct OriginalBusinessQuery11 {
5642    #[serde(rename = "MsgId")]
5643    pub msg_id: String,
5644    #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5645    pub msg_nm_id: Option<String>,
5646    #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
5647    pub cre_dt_tm: Option<String>,
5648}
5649
5650impl Validate for OriginalBusinessQuery11 {
5651    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5652        helpers::validate_length(
5653            &self.msg_id,
5654            "MsgId",
5655            Some(1),
5656            Some(35),
5657            &helpers::child_path(path, "MsgId"),
5658            config,
5659            collector,
5660        );
5661        helpers::validate_pattern(
5662            &self.msg_id,
5663            "MsgId",
5664            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5665            &helpers::child_path(path, "MsgId"),
5666            config,
5667            collector,
5668        );
5669        if let Some(ref val) = self.msg_nm_id {
5670            helpers::validate_length(
5671                val,
5672                "MsgNmId",
5673                Some(1),
5674                Some(35),
5675                &helpers::child_path(path, "MsgNmId"),
5676                config,
5677                collector,
5678            );
5679        }
5680        if let Some(ref val) = self.msg_nm_id {
5681            helpers::validate_pattern(
5682                val,
5683                "MsgNmId",
5684                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5685                &helpers::child_path(path, "MsgNmId"),
5686                config,
5687                collector,
5688            );
5689        }
5690        if let Some(ref val) = self.cre_dt_tm {
5691            helpers::validate_pattern(
5692                val,
5693                "CreDtTm",
5694                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
5695                &helpers::child_path(path, "CreDtTm"),
5696                config,
5697                collector,
5698            );
5699        }
5700    }
5701}
5702
5703// OtherIdentification11: Type of the identification.
5704#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5705pub struct OtherIdentification11 {
5706    #[serde(rename = "Id")]
5707    pub id: String,
5708    #[serde(rename = "Sfx", skip_serializing_if = "Option::is_none")]
5709    pub sfx: Option<String>,
5710    #[serde(rename = "Tp")]
5711    pub tp: IdentificationSource3Choice1,
5712}
5713
5714impl Validate for OtherIdentification11 {
5715    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5716        helpers::validate_length(
5717            &self.id,
5718            "Id",
5719            Some(1),
5720            Some(35),
5721            &helpers::child_path(path, "Id"),
5722            config,
5723            collector,
5724        );
5725        helpers::validate_pattern(
5726            &self.id,
5727            "Id",
5728            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5729            &helpers::child_path(path, "Id"),
5730            config,
5731            collector,
5732        );
5733        if let Some(ref val) = self.sfx {
5734            helpers::validate_length(
5735                val,
5736                "Sfx",
5737                Some(1),
5738                Some(16),
5739                &helpers::child_path(path, "Sfx"),
5740                config,
5741                collector,
5742            );
5743        }
5744        if let Some(ref val) = self.sfx {
5745            helpers::validate_pattern(
5746                val,
5747                "Sfx",
5748                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5749                &helpers::child_path(path, "Sfx"),
5750                config,
5751                collector,
5752            );
5753        }
5754        self.tp
5755            .validate(&helpers::child_path(path, "Tp"), config, collector);
5756    }
5757}
5758
5759// POIComponentType1Code: Personal identification number (or PIN) entry device (PED).
5760#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5761pub enum POIComponentType1Code {
5762    #[default]
5763    #[serde(rename = "SOFT")]
5764    CodeSOFT,
5765    #[serde(rename = "EMVK")]
5766    CodeEMVK,
5767    #[serde(rename = "EMVO")]
5768    CodeEMVO,
5769    #[serde(rename = "MRIT")]
5770    CodeMRIT,
5771    #[serde(rename = "CHIT")]
5772    CodeCHIT,
5773    #[serde(rename = "SECM")]
5774    CodeSECM,
5775    #[serde(rename = "PEDV")]
5776    CodePEDV,
5777}
5778
5779impl Validate for POIComponentType1Code {
5780    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5781        // Enum validation is typically empty
5782    }
5783}
5784
5785// Pagination1: Indicates the last page.
5786#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5787pub struct Pagination1 {
5788    #[serde(rename = "PgNb")]
5789    pub pg_nb: String,
5790    #[serde(rename = "LastPgInd")]
5791    pub last_pg_ind: bool,
5792}
5793
5794impl Validate for Pagination1 {
5795    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5796        helpers::validate_pattern(
5797            &self.pg_nb,
5798            "PgNb",
5799            "[0-9]{1,5}",
5800            &helpers::child_path(path, "PgNb"),
5801            config,
5802            collector,
5803        );
5804    }
5805}
5806
5807// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
5808#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5809pub struct Party38Choice1 {
5810    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5811    pub org_id: Option<OrganisationIdentification291>,
5812    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5813    pub prvt_id: Option<PersonIdentification131>,
5814}
5815
5816impl Validate for Party38Choice1 {
5817    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5818        if let Some(ref val) = self.org_id
5819            && config.validate_optional_fields
5820        {
5821            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
5822        }
5823        if let Some(ref val) = self.prvt_id
5824            && config.validate_optional_fields
5825        {
5826            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
5827        }
5828    }
5829}
5830
5831// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
5832#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5833pub struct Party38Choice2 {
5834    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5835    pub org_id: Option<OrganisationIdentification292>,
5836    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5837    pub prvt_id: Option<PersonIdentification132>,
5838}
5839
5840impl Validate for Party38Choice2 {
5841    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5842        if let Some(ref val) = self.org_id
5843            && config.validate_optional_fields
5844        {
5845            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
5846        }
5847        if let Some(ref val) = self.prvt_id
5848            && config.validate_optional_fields
5849        {
5850            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
5851        }
5852    }
5853}
5854
5855// Party38Choice3: Unique and unambiguous identification of a person, for example a passport.
5856#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5857pub struct Party38Choice3 {
5858    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5859    pub org_id: Option<OrganisationIdentification292>,
5860    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5861    pub prvt_id: Option<PersonIdentification133>,
5862}
5863
5864impl Validate for Party38Choice3 {
5865    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5866        if let Some(ref val) = self.org_id
5867            && config.validate_optional_fields
5868        {
5869            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
5870        }
5871        if let Some(ref val) = self.prvt_id
5872            && config.validate_optional_fields
5873        {
5874            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
5875        }
5876    }
5877}
5878
5879// Party40Choice1: Identification of a financial institution.
5880#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5881pub struct Party40Choice1 {
5882    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5883    pub pty: Option<PartyIdentification1353>,
5884    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5885    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
5886}
5887
5888impl Validate for Party40Choice1 {
5889    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5890        if let Some(ref val) = self.pty
5891            && config.validate_optional_fields
5892        {
5893            val.validate(&helpers::child_path(path, "Pty"), config, collector);
5894        }
5895        if let Some(ref val) = self.agt
5896            && config.validate_optional_fields
5897        {
5898            val.validate(&helpers::child_path(path, "Agt"), config, collector);
5899        }
5900    }
5901}
5902
5903// Party40Choice2: Identification of a financial institution.
5904#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5905pub struct Party40Choice2 {
5906    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5907    pub pty: Option<PartyIdentification1354>,
5908    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5909    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
5910}
5911
5912impl Validate for Party40Choice2 {
5913    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5914        if let Some(ref val) = self.pty
5915            && config.validate_optional_fields
5916        {
5917            val.validate(&helpers::child_path(path, "Pty"), config, collector);
5918        }
5919        if let Some(ref val) = self.agt
5920            && config.validate_optional_fields
5921        {
5922            val.validate(&helpers::child_path(path, "Agt"), config, collector);
5923        }
5924    }
5925}
5926
5927// Party40Choice3: Identification of a financial institution.
5928#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5929pub struct Party40Choice3 {
5930    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5931    pub pty: Option<PartyIdentification1353>,
5932    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5933    pub agt: Option<BranchAndFinancialInstitutionIdentification63>,
5934}
5935
5936impl Validate for Party40Choice3 {
5937    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5938        if let Some(ref val) = self.pty
5939            && config.validate_optional_fields
5940        {
5941            val.validate(&helpers::child_path(path, "Pty"), config, collector);
5942        }
5943        if let Some(ref val) = self.agt
5944            && config.validate_optional_fields
5945        {
5946            val.validate(&helpers::child_path(path, "Agt"), config, collector);
5947        }
5948    }
5949}
5950
5951// PartyIdentification1351: Set of elements used to indicate how to contact the party.
5952#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5953pub struct PartyIdentification1351 {
5954    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
5955    pub nm: Option<String>,
5956    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
5957    pub pstl_adr: Option<PostalAddress241>,
5958    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
5959    pub id: Option<Party38Choice1>,
5960    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
5961    pub ctct_dtls: Option<Contact41>,
5962}
5963
5964impl Validate for PartyIdentification1351 {
5965    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5966        if let Some(ref val) = self.nm {
5967            helpers::validate_length(
5968                val,
5969                "Nm",
5970                Some(1),
5971                Some(140),
5972                &helpers::child_path(path, "Nm"),
5973                config,
5974                collector,
5975            );
5976        }
5977        if let Some(ref val) = self.nm {
5978            helpers::validate_pattern(
5979                val,
5980                "Nm",
5981                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5982                &helpers::child_path(path, "Nm"),
5983                config,
5984                collector,
5985            );
5986        }
5987        if let Some(ref val) = self.pstl_adr
5988            && config.validate_optional_fields
5989        {
5990            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
5991        }
5992        if let Some(ref val) = self.id
5993            && config.validate_optional_fields
5994        {
5995            val.validate(&helpers::child_path(path, "Id"), config, collector);
5996        }
5997        if let Some(ref val) = self.ctct_dtls
5998            && config.validate_optional_fields
5999        {
6000            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6001        }
6002    }
6003}
6004
6005// 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.
6006#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6007pub struct PartyIdentification1352 {
6008    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6009    pub nm: Option<String>,
6010    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6011    pub pstl_adr: Option<PostalAddress241>,
6012    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6013    pub id: Option<Party38Choice1>,
6014    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6015    pub ctry_of_res: Option<String>,
6016}
6017
6018impl Validate for PartyIdentification1352 {
6019    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6020        if let Some(ref val) = self.nm {
6021            helpers::validate_length(
6022                val,
6023                "Nm",
6024                Some(1),
6025                Some(140),
6026                &helpers::child_path(path, "Nm"),
6027                config,
6028                collector,
6029            );
6030        }
6031        if let Some(ref val) = self.nm {
6032            helpers::validate_pattern(
6033                val,
6034                "Nm",
6035                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6036                &helpers::child_path(path, "Nm"),
6037                config,
6038                collector,
6039            );
6040        }
6041        if let Some(ref val) = self.pstl_adr
6042            && config.validate_optional_fields
6043        {
6044            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6045        }
6046        if let Some(ref val) = self.id
6047            && config.validate_optional_fields
6048        {
6049            val.validate(&helpers::child_path(path, "Id"), config, collector);
6050        }
6051        if let Some(ref val) = self.ctry_of_res {
6052            helpers::validate_pattern(
6053                val,
6054                "CtryOfRes",
6055                "[A-Z]{2,2}",
6056                &helpers::child_path(path, "CtryOfRes"),
6057                config,
6058                collector,
6059            );
6060        }
6061    }
6062}
6063
6064// PartyIdentification1353: Set of elements used to indicate how to contact the party.
6065#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6066pub struct PartyIdentification1353 {
6067    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6068    pub nm: Option<String>,
6069    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6070    pub pstl_adr: Option<PostalAddress241>,
6071    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6072    pub id: Option<Party38Choice1>,
6073    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6074    pub ctry_of_res: Option<String>,
6075    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6076    pub ctct_dtls: Option<Contact42>,
6077}
6078
6079impl Validate for PartyIdentification1353 {
6080    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6081        if let Some(ref val) = self.nm {
6082            helpers::validate_length(
6083                val,
6084                "Nm",
6085                Some(1),
6086                Some(140),
6087                &helpers::child_path(path, "Nm"),
6088                config,
6089                collector,
6090            );
6091        }
6092        if let Some(ref val) = self.nm {
6093            helpers::validate_pattern(
6094                val,
6095                "Nm",
6096                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6097                &helpers::child_path(path, "Nm"),
6098                config,
6099                collector,
6100            );
6101        }
6102        if let Some(ref val) = self.pstl_adr
6103            && config.validate_optional_fields
6104        {
6105            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6106        }
6107        if let Some(ref val) = self.id
6108            && config.validate_optional_fields
6109        {
6110            val.validate(&helpers::child_path(path, "Id"), config, collector);
6111        }
6112        if let Some(ref val) = self.ctry_of_res {
6113            helpers::validate_pattern(
6114                val,
6115                "CtryOfRes",
6116                "[A-Z]{2,2}",
6117                &helpers::child_path(path, "CtryOfRes"),
6118                config,
6119                collector,
6120            );
6121        }
6122        if let Some(ref val) = self.ctct_dtls
6123            && config.validate_optional_fields
6124        {
6125            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6126        }
6127    }
6128}
6129
6130// PartyIdentification1354: Set of elements used to indicate how to contact the party.
6131#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6132pub struct PartyIdentification1354 {
6133    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6134    pub nm: Option<String>,
6135    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6136    pub pstl_adr: Option<PostalAddress241>,
6137    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6138    pub id: Option<Party38Choice1>,
6139    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6140    pub ctry_of_res: Option<String>,
6141    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6142    pub ctct_dtls: Option<Contact43>,
6143}
6144
6145impl Validate for PartyIdentification1354 {
6146    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6147        if let Some(ref val) = self.nm {
6148            helpers::validate_length(
6149                val,
6150                "Nm",
6151                Some(1),
6152                Some(140),
6153                &helpers::child_path(path, "Nm"),
6154                config,
6155                collector,
6156            );
6157        }
6158        if let Some(ref val) = self.nm {
6159            helpers::validate_pattern(
6160                val,
6161                "Nm",
6162                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6163                &helpers::child_path(path, "Nm"),
6164                config,
6165                collector,
6166            );
6167        }
6168        if let Some(ref val) = self.pstl_adr
6169            && config.validate_optional_fields
6170        {
6171            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6172        }
6173        if let Some(ref val) = self.id
6174            && config.validate_optional_fields
6175        {
6176            val.validate(&helpers::child_path(path, "Id"), config, collector);
6177        }
6178        if let Some(ref val) = self.ctry_of_res {
6179            helpers::validate_pattern(
6180                val,
6181                "CtryOfRes",
6182                "[A-Z]{2,2}",
6183                &helpers::child_path(path, "CtryOfRes"),
6184                config,
6185                collector,
6186            );
6187        }
6188        if let Some(ref val) = self.ctct_dtls
6189            && config.validate_optional_fields
6190        {
6191            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6192        }
6193    }
6194}
6195
6196// PartyIdentification1355: Set of elements used to indicate how to contact the party.
6197#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6198pub struct PartyIdentification1355 {
6199    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6200    pub nm: Option<String>,
6201    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6202    pub pstl_adr: Option<PostalAddress241>,
6203    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6204    pub id: Option<Party38Choice2>,
6205    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6206    pub ctry_of_res: Option<String>,
6207    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6208    pub ctct_dtls: Option<Contact42>,
6209}
6210
6211impl Validate for PartyIdentification1355 {
6212    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6213        if let Some(ref val) = self.nm {
6214            helpers::validate_length(
6215                val,
6216                "Nm",
6217                Some(1),
6218                Some(140),
6219                &helpers::child_path(path, "Nm"),
6220                config,
6221                collector,
6222            );
6223        }
6224        if let Some(ref val) = self.nm {
6225            helpers::validate_pattern(
6226                val,
6227                "Nm",
6228                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6229                &helpers::child_path(path, "Nm"),
6230                config,
6231                collector,
6232            );
6233        }
6234        if let Some(ref val) = self.pstl_adr
6235            && config.validate_optional_fields
6236        {
6237            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6238        }
6239        if let Some(ref val) = self.id
6240            && config.validate_optional_fields
6241        {
6242            val.validate(&helpers::child_path(path, "Id"), config, collector);
6243        }
6244        if let Some(ref val) = self.ctry_of_res {
6245            helpers::validate_pattern(
6246                val,
6247                "CtryOfRes",
6248                "[A-Z]{2,2}",
6249                &helpers::child_path(path, "CtryOfRes"),
6250                config,
6251                collector,
6252            );
6253        }
6254        if let Some(ref val) = self.ctct_dtls
6255            && config.validate_optional_fields
6256        {
6257            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6258        }
6259    }
6260}
6261
6262// PartyIdentification1356: Set of elements used to indicate how to contact the party.
6263#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6264pub struct PartyIdentification1356 {
6265    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6266    pub nm: Option<String>,
6267    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6268    pub pstl_adr: Option<PostalAddress241>,
6269    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6270    pub id: Option<Party38Choice3>,
6271    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6272    pub ctry_of_res: Option<String>,
6273    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6274    pub ctct_dtls: Option<Contact42>,
6275}
6276
6277impl Validate for PartyIdentification1356 {
6278    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6279        if let Some(ref val) = self.nm {
6280            helpers::validate_length(
6281                val,
6282                "Nm",
6283                Some(1),
6284                Some(140),
6285                &helpers::child_path(path, "Nm"),
6286                config,
6287                collector,
6288            );
6289        }
6290        if let Some(ref val) = self.nm {
6291            helpers::validate_pattern(
6292                val,
6293                "Nm",
6294                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6295                &helpers::child_path(path, "Nm"),
6296                config,
6297                collector,
6298            );
6299        }
6300        if let Some(ref val) = self.pstl_adr
6301            && config.validate_optional_fields
6302        {
6303            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6304        }
6305        if let Some(ref val) = self.id
6306            && config.validate_optional_fields
6307        {
6308            val.validate(&helpers::child_path(path, "Id"), config, collector);
6309        }
6310        if let Some(ref val) = self.ctry_of_res {
6311            helpers::validate_pattern(
6312                val,
6313                "CtryOfRes",
6314                "[A-Z]{2,2}",
6315                &helpers::child_path(path, "CtryOfRes"),
6316                config,
6317                collector,
6318            );
6319        }
6320        if let Some(ref val) = self.ctct_dtls
6321            && config.validate_optional_fields
6322        {
6323            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6324        }
6325    }
6326}
6327
6328// PartyIdentification1357: Set of elements used to indicate how to contact the party.
6329#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6330pub struct PartyIdentification1357 {
6331    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6332    pub nm: Option<String>,
6333    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6334    pub pstl_adr: Option<PostalAddress241>,
6335    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6336    pub id: Option<Party38Choice1>,
6337    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6338    pub ctry_of_res: Option<String>,
6339    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6340    pub ctct_dtls: Option<Contact43>,
6341}
6342
6343impl Validate for PartyIdentification1357 {
6344    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6345        if let Some(ref val) = self.nm {
6346            helpers::validate_length(
6347                val,
6348                "Nm",
6349                Some(1),
6350                Some(140),
6351                &helpers::child_path(path, "Nm"),
6352                config,
6353                collector,
6354            );
6355        }
6356        if let Some(ref val) = self.nm {
6357            helpers::validate_pattern(
6358                val,
6359                "Nm",
6360                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6361                &helpers::child_path(path, "Nm"),
6362                config,
6363                collector,
6364            );
6365        }
6366        if let Some(ref val) = self.pstl_adr
6367            && config.validate_optional_fields
6368        {
6369            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6370        }
6371        if let Some(ref val) = self.id
6372            && config.validate_optional_fields
6373        {
6374            val.validate(&helpers::child_path(path, "Id"), config, collector);
6375        }
6376        if let Some(ref val) = self.ctry_of_res {
6377            helpers::validate_pattern(
6378                val,
6379                "CtryOfRes",
6380                "[A-Z]{2,2}",
6381                &helpers::child_path(path, "CtryOfRes"),
6382                config,
6383                collector,
6384            );
6385        }
6386        if let Some(ref val) = self.ctct_dtls
6387            && config.validate_optional_fields
6388        {
6389            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6390        }
6391    }
6392}
6393
6394// PartyType3Code: Party to whom the card issuer delegates to authorise card payment transactions.
6395#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6396pub enum PartyType3Code {
6397    #[default]
6398    #[serde(rename = "OPOI")]
6399    CodeOPOI,
6400    #[serde(rename = "MERC")]
6401    CodeMERC,
6402    #[serde(rename = "ACCP")]
6403    CodeACCP,
6404    #[serde(rename = "ITAG")]
6405    CodeITAG,
6406    #[serde(rename = "ACQR")]
6407    CodeACQR,
6408    #[serde(rename = "CISS")]
6409    CodeCISS,
6410    #[serde(rename = "DLIS")]
6411    CodeDLIS,
6412}
6413
6414impl Validate for PartyType3Code {
6415    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6416        // Enum validation is typically empty
6417    }
6418}
6419
6420// PartyType4Code: Tax authority.
6421#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6422pub enum PartyType4Code {
6423    #[default]
6424    #[serde(rename = "MERC")]
6425    CodeMERC,
6426    #[serde(rename = "ACCP")]
6427    CodeACCP,
6428    #[serde(rename = "ITAG")]
6429    CodeITAG,
6430    #[serde(rename = "ACQR")]
6431    CodeACQR,
6432    #[serde(rename = "CISS")]
6433    CodeCISS,
6434    #[serde(rename = "TAXH")]
6435    CodeTAXH,
6436}
6437
6438impl Validate for PartyType4Code {
6439    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6440        // Enum validation is typically empty
6441    }
6442}
6443
6444// PaymentCard41: Additional card issuer specific data.
6445#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6446pub struct PaymentCard41 {
6447    #[serde(rename = "PlainCardData", skip_serializing_if = "Option::is_none")]
6448    pub plain_card_data: Option<PlainCardData11>,
6449    #[serde(rename = "CardCtryCd", skip_serializing_if = "Option::is_none")]
6450    pub card_ctry_cd: Option<String>,
6451    #[serde(rename = "CardBrnd", skip_serializing_if = "Option::is_none")]
6452    pub card_brnd: Option<GenericIdentification11>,
6453    #[serde(rename = "AddtlCardData", skip_serializing_if = "Option::is_none")]
6454    pub addtl_card_data: Option<String>,
6455}
6456
6457impl Validate for PaymentCard41 {
6458    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6459        if let Some(ref val) = self.plain_card_data
6460            && config.validate_optional_fields
6461        {
6462            val.validate(
6463                &helpers::child_path(path, "PlainCardData"),
6464                config,
6465                collector,
6466            );
6467        }
6468        if let Some(ref val) = self.card_ctry_cd {
6469            helpers::validate_pattern(
6470                val,
6471                "CardCtryCd",
6472                "[0-9]{3}",
6473                &helpers::child_path(path, "CardCtryCd"),
6474                config,
6475                collector,
6476            );
6477        }
6478        if let Some(ref val) = self.card_brnd
6479            && config.validate_optional_fields
6480        {
6481            val.validate(&helpers::child_path(path, "CardBrnd"), config, collector);
6482        }
6483        if let Some(ref val) = self.addtl_card_data {
6484            helpers::validate_length(
6485                val,
6486                "AddtlCardData",
6487                Some(1),
6488                Some(70),
6489                &helpers::child_path(path, "AddtlCardData"),
6490                config,
6491                collector,
6492            );
6493        }
6494        if let Some(ref val) = self.addtl_card_data {
6495            helpers::validate_pattern(
6496                val,
6497                "AddtlCardData",
6498                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6499                &helpers::child_path(path, "AddtlCardData"),
6500                config,
6501                collector,
6502            );
6503        }
6504    }
6505}
6506
6507// PaymentContext3: Method used to authenticate a cardholder.
6508#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6509pub struct PaymentContext3 {
6510    #[serde(rename = "CardPres", skip_serializing_if = "Option::is_none")]
6511    pub card_pres: Option<bool>,
6512    #[serde(rename = "CrdhldrPres", skip_serializing_if = "Option::is_none")]
6513    pub crdhldr_pres: Option<bool>,
6514    #[serde(rename = "OnLineCntxt", skip_serializing_if = "Option::is_none")]
6515    pub on_line_cntxt: Option<bool>,
6516    #[serde(rename = "AttndncCntxt", skip_serializing_if = "Option::is_none")]
6517    pub attndnc_cntxt: Option<AttendanceContext1Code>,
6518    #[serde(rename = "TxEnvt", skip_serializing_if = "Option::is_none")]
6519    pub tx_envt: Option<TransactionEnvironment1Code>,
6520    #[serde(rename = "TxChanl", skip_serializing_if = "Option::is_none")]
6521    pub tx_chanl: Option<TransactionChannel1Code>,
6522    #[serde(rename = "AttndntMsgCpbl", skip_serializing_if = "Option::is_none")]
6523    pub attndnt_msg_cpbl: Option<bool>,
6524    #[serde(rename = "AttndntLang", skip_serializing_if = "Option::is_none")]
6525    pub attndnt_lang: Option<String>,
6526    #[serde(rename = "CardDataNtryMd")]
6527    pub card_data_ntry_md: CardDataReading1Code,
6528    #[serde(rename = "FllbckInd", skip_serializing_if = "Option::is_none")]
6529    pub fllbck_ind: Option<bool>,
6530    #[serde(rename = "AuthntcnMtd", skip_serializing_if = "Option::is_none")]
6531    pub authntcn_mtd: Option<CardholderAuthentication2>,
6532}
6533
6534impl Validate for PaymentContext3 {
6535    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6536        if let Some(ref val) = self.attndnc_cntxt
6537            && config.validate_optional_fields
6538        {
6539            val.validate(
6540                &helpers::child_path(path, "AttndncCntxt"),
6541                config,
6542                collector,
6543            );
6544        }
6545        if let Some(ref val) = self.tx_envt
6546            && config.validate_optional_fields
6547        {
6548            val.validate(&helpers::child_path(path, "TxEnvt"), config, collector);
6549        }
6550        if let Some(ref val) = self.tx_chanl
6551            && config.validate_optional_fields
6552        {
6553            val.validate(&helpers::child_path(path, "TxChanl"), config, collector);
6554        }
6555        if let Some(ref val) = self.attndnt_lang {
6556            helpers::validate_pattern(
6557                val,
6558                "AttndntLang",
6559                "[a-z]{2,2}",
6560                &helpers::child_path(path, "AttndntLang"),
6561                config,
6562                collector,
6563            );
6564        }
6565        self.card_data_ntry_md.validate(
6566            &helpers::child_path(path, "CardDataNtryMd"),
6567            config,
6568            collector,
6569        );
6570        if let Some(ref val) = self.authntcn_mtd
6571            && config.validate_optional_fields
6572        {
6573            val.validate(&helpers::child_path(path, "AuthntcnMtd"), config, collector);
6574        }
6575    }
6576}
6577
6578// PaymentReturnReason51: Further details on the return reason.
6579#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6580pub struct PaymentReturnReason51 {
6581    #[serde(rename = "OrgnlBkTxCd", skip_serializing_if = "Option::is_none")]
6582    pub orgnl_bk_tx_cd: Option<BankTransactionCodeStructure41>,
6583    #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
6584    pub orgtr: Option<PartyIdentification1357>,
6585    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
6586    pub rsn: Option<ReturnReason5Choice1>,
6587    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
6588    pub addtl_inf: Option<Vec<String>>,
6589}
6590
6591impl Validate for PaymentReturnReason51 {
6592    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6593        if let Some(ref val) = self.orgnl_bk_tx_cd
6594            && config.validate_optional_fields
6595        {
6596            val.validate(&helpers::child_path(path, "OrgnlBkTxCd"), config, collector);
6597        }
6598        if let Some(ref val) = self.orgtr
6599            && config.validate_optional_fields
6600        {
6601            val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
6602        }
6603        if let Some(ref val) = self.rsn
6604            && config.validate_optional_fields
6605        {
6606            val.validate(&helpers::child_path(path, "Rsn"), config, collector);
6607        }
6608        if let Some(ref vec) = self.addtl_inf {
6609            for item in vec {
6610                helpers::validate_length(
6611                    item,
6612                    "AddtlInf",
6613                    Some(1),
6614                    Some(105),
6615                    &helpers::child_path(path, "AddtlInf"),
6616                    config,
6617                    collector,
6618                );
6619            }
6620        }
6621        if let Some(ref vec) = self.addtl_inf {
6622            for item in vec {
6623                helpers::validate_pattern(
6624                    item,
6625                    "AddtlInf",
6626                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6627                    &helpers::child_path(path, "AddtlInf"),
6628                    config,
6629                    collector,
6630                );
6631            }
6632        }
6633    }
6634}
6635
6636// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
6637#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6638pub struct PersonIdentification131 {
6639    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6640    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
6641    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6642    pub othr: Option<Vec<GenericPersonIdentification11>>,
6643}
6644
6645impl Validate for PersonIdentification131 {
6646    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6647        if let Some(ref val) = self.dt_and_plc_of_birth
6648            && config.validate_optional_fields
6649        {
6650            val.validate(
6651                &helpers::child_path(path, "DtAndPlcOfBirth"),
6652                config,
6653                collector,
6654            );
6655        }
6656        if let Some(ref vec) = self.othr
6657            && config.validate_optional_fields
6658        {
6659            for item in vec {
6660                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6661            }
6662        }
6663    }
6664}
6665
6666// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
6667#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6668pub struct PersonIdentification132 {
6669    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6670    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
6671    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6672    pub othr: Option<Vec<GenericPersonIdentification12>>,
6673}
6674
6675impl Validate for PersonIdentification132 {
6676    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6677        if let Some(ref val) = self.dt_and_plc_of_birth
6678            && config.validate_optional_fields
6679        {
6680            val.validate(
6681                &helpers::child_path(path, "DtAndPlcOfBirth"),
6682                config,
6683                collector,
6684            );
6685        }
6686        if let Some(ref vec) = self.othr
6687            && config.validate_optional_fields
6688        {
6689            for item in vec {
6690                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6691            }
6692        }
6693    }
6694}
6695
6696// PersonIdentification133: Unique identification of a person, as assigned by an institution, using an identification scheme.
6697#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6698pub struct PersonIdentification133 {
6699    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6700    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
6701    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6702    pub othr: Option<Vec<GenericPersonIdentification12>>,
6703}
6704
6705impl Validate for PersonIdentification133 {
6706    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6707        if let Some(ref val) = self.dt_and_plc_of_birth
6708            && config.validate_optional_fields
6709        {
6710            val.validate(
6711                &helpers::child_path(path, "DtAndPlcOfBirth"),
6712                config,
6713                collector,
6714            );
6715        }
6716        if let Some(ref vec) = self.othr
6717            && config.validate_optional_fields
6718        {
6719            for item in vec {
6720                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6721            }
6722        }
6723    }
6724}
6725
6726// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
6727#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6728pub struct PersonIdentificationSchemeName1Choice1 {
6729    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6730    pub cd: Option<String>,
6731    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6732    pub prtry: Option<String>,
6733}
6734
6735impl Validate for PersonIdentificationSchemeName1Choice1 {
6736    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6737        if let Some(ref val) = self.cd {
6738            helpers::validate_length(
6739                val,
6740                "Cd",
6741                Some(1),
6742                Some(4),
6743                &helpers::child_path(path, "Cd"),
6744                config,
6745                collector,
6746            );
6747        }
6748        if let Some(ref val) = self.prtry {
6749            helpers::validate_length(
6750                val,
6751                "Prtry",
6752                Some(1),
6753                Some(35),
6754                &helpers::child_path(path, "Prtry"),
6755                config,
6756                collector,
6757            );
6758        }
6759        if let Some(ref val) = self.prtry {
6760            helpers::validate_pattern(
6761                val,
6762                "Prtry",
6763                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6764                &helpers::child_path(path, "Prtry"),
6765                config,
6766                collector,
6767            );
6768        }
6769    }
6770}
6771
6772// PersonIdentificationSchemeName1Choice2: Name of the identification scheme, in a free text form.
6773#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6774pub struct PersonIdentificationSchemeName1Choice2 {
6775    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6776    pub cd: Option<String>,
6777    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6778    pub prtry: Option<String>,
6779}
6780
6781impl Validate for PersonIdentificationSchemeName1Choice2 {
6782    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6783        if let Some(ref val) = self.cd {
6784            helpers::validate_length(
6785                val,
6786                "Cd",
6787                Some(1),
6788                Some(4),
6789                &helpers::child_path(path, "Cd"),
6790                config,
6791                collector,
6792            );
6793        }
6794        if let Some(ref val) = self.prtry {
6795            helpers::validate_length(
6796                val,
6797                "Prtry",
6798                Some(1),
6799                Some(35),
6800                &helpers::child_path(path, "Prtry"),
6801                config,
6802                collector,
6803            );
6804        }
6805        if let Some(ref val) = self.prtry {
6806            helpers::validate_pattern(
6807                val,
6808                "Prtry",
6809                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6810                &helpers::child_path(path, "Prtry"),
6811                config,
6812                collector,
6813            );
6814        }
6815    }
6816}
6817
6818// PlainCardData11: Card security code (CSC) associated with the card performing the transaction.
6819#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6820pub struct PlainCardData11 {
6821    #[serde(rename = "PAN")]
6822    pub pan: String,
6823    #[serde(rename = "CardSeqNb", skip_serializing_if = "Option::is_none")]
6824    pub card_seq_nb: Option<String>,
6825    #[serde(rename = "FctvDt", skip_serializing_if = "Option::is_none")]
6826    pub fctv_dt: Option<String>,
6827    #[serde(rename = "XpryDt")]
6828    pub xpry_dt: String,
6829    #[serde(rename = "SvcCd", skip_serializing_if = "Option::is_none")]
6830    pub svc_cd: Option<String>,
6831    #[serde(rename = "TrckData", skip_serializing_if = "Option::is_none")]
6832    pub trck_data: Option<Vec<TrackData11>>,
6833    #[serde(rename = "CardSctyCd", skip_serializing_if = "Option::is_none")]
6834    pub card_scty_cd: Option<CardSecurityInformation1>,
6835}
6836
6837impl Validate for PlainCardData11 {
6838    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6839        helpers::validate_pattern(
6840            &self.pan,
6841            "PAN",
6842            "[0-9]{8,28}",
6843            &helpers::child_path(path, "PAN"),
6844            config,
6845            collector,
6846        );
6847        if let Some(ref val) = self.card_seq_nb {
6848            helpers::validate_pattern(
6849                val,
6850                "CardSeqNb",
6851                "[0-9]{2,3}",
6852                &helpers::child_path(path, "CardSeqNb"),
6853                config,
6854                collector,
6855            );
6856        }
6857        if let Some(ref val) = self.svc_cd {
6858            helpers::validate_pattern(
6859                val,
6860                "SvcCd",
6861                "[0-9]{3}",
6862                &helpers::child_path(path, "SvcCd"),
6863                config,
6864                collector,
6865            );
6866        }
6867        if let Some(ref vec) = self.trck_data
6868            && config.validate_optional_fields
6869        {
6870            for item in vec {
6871                item.validate(&helpers::child_path(path, "TrckData"), config, collector);
6872            }
6873        }
6874        if let Some(ref val) = self.card_scty_cd
6875            && config.validate_optional_fields
6876        {
6877            val.validate(&helpers::child_path(path, "CardSctyCd"), config, collector);
6878        }
6879    }
6880}
6881
6882// PointOfInteraction11: Data related to a component of the POI performing the transaction.
6883#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6884pub struct PointOfInteraction11 {
6885    #[serde(rename = "Id")]
6886    pub id: GenericIdentification321,
6887    #[serde(rename = "SysNm", skip_serializing_if = "Option::is_none")]
6888    pub sys_nm: Option<String>,
6889    #[serde(rename = "GrpId", skip_serializing_if = "Option::is_none")]
6890    pub grp_id: Option<String>,
6891    #[serde(rename = "Cpblties", skip_serializing_if = "Option::is_none")]
6892    pub cpblties: Option<PointOfInteractionCapabilities1>,
6893    #[serde(rename = "Cmpnt", skip_serializing_if = "Option::is_none")]
6894    pub cmpnt: Option<Vec<PointOfInteractionComponent11>>,
6895}
6896
6897impl Validate for PointOfInteraction11 {
6898    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6899        self.id
6900            .validate(&helpers::child_path(path, "Id"), config, collector);
6901        if let Some(ref val) = self.sys_nm {
6902            helpers::validate_length(
6903                val,
6904                "SysNm",
6905                Some(1),
6906                Some(70),
6907                &helpers::child_path(path, "SysNm"),
6908                config,
6909                collector,
6910            );
6911        }
6912        if let Some(ref val) = self.sys_nm {
6913            helpers::validate_pattern(
6914                val,
6915                "SysNm",
6916                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6917                &helpers::child_path(path, "SysNm"),
6918                config,
6919                collector,
6920            );
6921        }
6922        if let Some(ref val) = self.grp_id {
6923            helpers::validate_length(
6924                val,
6925                "GrpId",
6926                Some(1),
6927                Some(35),
6928                &helpers::child_path(path, "GrpId"),
6929                config,
6930                collector,
6931            );
6932        }
6933        if let Some(ref val) = self.grp_id {
6934            helpers::validate_pattern(
6935                val,
6936                "GrpId",
6937                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6938                &helpers::child_path(path, "GrpId"),
6939                config,
6940                collector,
6941            );
6942        }
6943        if let Some(ref val) = self.cpblties
6944            && config.validate_optional_fields
6945        {
6946            val.validate(&helpers::child_path(path, "Cpblties"), config, collector);
6947        }
6948        if let Some(ref vec) = self.cmpnt
6949            && config.validate_optional_fields
6950        {
6951            for item in vec {
6952                item.validate(&helpers::child_path(path, "Cmpnt"), config, collector);
6953            }
6954        }
6955    }
6956}
6957
6958// PointOfInteractionCapabilities1: Number of columns of the printer component.
6959#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6960pub struct PointOfInteractionCapabilities1 {
6961    #[serde(rename = "CardRdngCpblties", skip_serializing_if = "Option::is_none")]
6962    pub card_rdng_cpblties: Option<Vec<CardDataReading1Code>>,
6963    #[serde(
6964        rename = "CrdhldrVrfctnCpblties",
6965        skip_serializing_if = "Option::is_none"
6966    )]
6967    pub crdhldr_vrfctn_cpblties: Option<Vec<CardholderVerificationCapability1Code>>,
6968    #[serde(rename = "OnLineCpblties", skip_serializing_if = "Option::is_none")]
6969    pub on_line_cpblties: Option<OnLineCapability1Code>,
6970    #[serde(rename = "DispCpblties", skip_serializing_if = "Option::is_none")]
6971    pub disp_cpblties: Option<Vec<DisplayCapabilities1>>,
6972    #[serde(rename = "PrtLineWidth", skip_serializing_if = "Option::is_none")]
6973    pub prt_line_width: Option<String>,
6974}
6975
6976impl Validate for PointOfInteractionCapabilities1 {
6977    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6978        if let Some(ref vec) = self.card_rdng_cpblties
6979            && config.validate_optional_fields
6980        {
6981            for item in vec {
6982                item.validate(
6983                    &helpers::child_path(path, "CardRdngCpblties"),
6984                    config,
6985                    collector,
6986                );
6987            }
6988        }
6989        if let Some(ref vec) = self.crdhldr_vrfctn_cpblties
6990            && config.validate_optional_fields
6991        {
6992            for item in vec {
6993                item.validate(
6994                    &helpers::child_path(path, "CrdhldrVrfctnCpblties"),
6995                    config,
6996                    collector,
6997                );
6998            }
6999        }
7000        if let Some(ref val) = self.on_line_cpblties
7001            && config.validate_optional_fields
7002        {
7003            val.validate(
7004                &helpers::child_path(path, "OnLineCpblties"),
7005                config,
7006                collector,
7007            );
7008        }
7009        if let Some(ref vec) = self.disp_cpblties
7010            && config.validate_optional_fields
7011        {
7012            for item in vec {
7013                item.validate(
7014                    &helpers::child_path(path, "DispCpblties"),
7015                    config,
7016                    collector,
7017                );
7018            }
7019        }
7020        if let Some(ref val) = self.prt_line_width {
7021            helpers::validate_pattern(
7022                val,
7023                "PrtLineWidth",
7024                "[0-9]{1,3}",
7025                &helpers::child_path(path, "PrtLineWidth"),
7026                config,
7027                collector,
7028            );
7029        }
7030    }
7031}
7032
7033// PointOfInteractionComponent11: Unique approval number for a component, delivered by a certification body.
7034// Usage: More than one approval number could be present, when assigned by different bodies. The certification body identification must be provided within the approval number (for example at the beginning of the value).
7035#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7036pub struct PointOfInteractionComponent11 {
7037    #[serde(rename = "POICmpntTp")]
7038    pub poi_cmpnt_tp: POIComponentType1Code,
7039    #[serde(rename = "ManfctrId", skip_serializing_if = "Option::is_none")]
7040    pub manfctr_id: Option<String>,
7041    #[serde(rename = "Mdl", skip_serializing_if = "Option::is_none")]
7042    pub mdl: Option<String>,
7043    #[serde(rename = "VrsnNb", skip_serializing_if = "Option::is_none")]
7044    pub vrsn_nb: Option<String>,
7045    #[serde(rename = "SrlNb", skip_serializing_if = "Option::is_none")]
7046    pub srl_nb: Option<String>,
7047    #[serde(rename = "ApprvlNb", skip_serializing_if = "Option::is_none")]
7048    pub apprvl_nb: Option<Vec<String>>,
7049}
7050
7051impl Validate for PointOfInteractionComponent11 {
7052    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7053        self.poi_cmpnt_tp
7054            .validate(&helpers::child_path(path, "POICmpntTp"), config, collector);
7055        if let Some(ref val) = self.manfctr_id {
7056            helpers::validate_length(
7057                val,
7058                "ManfctrId",
7059                Some(1),
7060                Some(35),
7061                &helpers::child_path(path, "ManfctrId"),
7062                config,
7063                collector,
7064            );
7065        }
7066        if let Some(ref val) = self.manfctr_id {
7067            helpers::validate_pattern(
7068                val,
7069                "ManfctrId",
7070                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7071                &helpers::child_path(path, "ManfctrId"),
7072                config,
7073                collector,
7074            );
7075        }
7076        if let Some(ref val) = self.mdl {
7077            helpers::validate_length(
7078                val,
7079                "Mdl",
7080                Some(1),
7081                Some(35),
7082                &helpers::child_path(path, "Mdl"),
7083                config,
7084                collector,
7085            );
7086        }
7087        if let Some(ref val) = self.mdl {
7088            helpers::validate_pattern(
7089                val,
7090                "Mdl",
7091                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7092                &helpers::child_path(path, "Mdl"),
7093                config,
7094                collector,
7095            );
7096        }
7097        if let Some(ref val) = self.vrsn_nb {
7098            helpers::validate_length(
7099                val,
7100                "VrsnNb",
7101                Some(1),
7102                Some(16),
7103                &helpers::child_path(path, "VrsnNb"),
7104                config,
7105                collector,
7106            );
7107        }
7108        if let Some(ref val) = self.vrsn_nb {
7109            helpers::validate_pattern(
7110                val,
7111                "VrsnNb",
7112                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7113                &helpers::child_path(path, "VrsnNb"),
7114                config,
7115                collector,
7116            );
7117        }
7118        if let Some(ref val) = self.srl_nb {
7119            helpers::validate_length(
7120                val,
7121                "SrlNb",
7122                Some(1),
7123                Some(35),
7124                &helpers::child_path(path, "SrlNb"),
7125                config,
7126                collector,
7127            );
7128        }
7129        if let Some(ref val) = self.srl_nb {
7130            helpers::validate_pattern(
7131                val,
7132                "SrlNb",
7133                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7134                &helpers::child_path(path, "SrlNb"),
7135                config,
7136                collector,
7137            );
7138        }
7139        if let Some(ref vec) = self.apprvl_nb {
7140            for item in vec {
7141                helpers::validate_length(
7142                    item,
7143                    "ApprvlNb",
7144                    Some(1),
7145                    Some(70),
7146                    &helpers::child_path(path, "ApprvlNb"),
7147                    config,
7148                    collector,
7149                );
7150            }
7151        }
7152        if let Some(ref vec) = self.apprvl_nb {
7153            for item in vec {
7154                helpers::validate_pattern(
7155                    item,
7156                    "ApprvlNb",
7157                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7158                    &helpers::child_path(path, "ApprvlNb"),
7159                    config,
7160                    collector,
7161                );
7162            }
7163        }
7164    }
7165}
7166
7167// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
7168#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7169pub struct PostalAddress241 {
7170    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
7171    pub adr_tp: Option<AddressType3Choice1>,
7172    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
7173    pub dept: Option<String>,
7174    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
7175    pub sub_dept: Option<String>,
7176    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
7177    pub strt_nm: Option<String>,
7178    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
7179    pub bldg_nb: Option<String>,
7180    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
7181    pub bldg_nm: Option<String>,
7182    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
7183    pub flr: Option<String>,
7184    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
7185    pub pst_bx: Option<String>,
7186    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
7187    pub room: Option<String>,
7188    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
7189    pub pst_cd: Option<String>,
7190    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
7191    pub twn_nm: Option<String>,
7192    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
7193    pub twn_lctn_nm: Option<String>,
7194    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
7195    pub dstrct_nm: Option<String>,
7196    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
7197    pub ctry_sub_dvsn: Option<String>,
7198    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
7199    pub ctry: Option<String>,
7200    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
7201    pub adr_line: Option<Vec<String>>,
7202}
7203
7204impl Validate for PostalAddress241 {
7205    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7206        if let Some(ref val) = self.adr_tp
7207            && config.validate_optional_fields
7208        {
7209            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
7210        }
7211        if let Some(ref val) = self.dept {
7212            helpers::validate_length(
7213                val,
7214                "Dept",
7215                Some(1),
7216                Some(70),
7217                &helpers::child_path(path, "Dept"),
7218                config,
7219                collector,
7220            );
7221        }
7222        if let Some(ref val) = self.dept {
7223            helpers::validate_pattern(
7224                val,
7225                "Dept",
7226                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7227                &helpers::child_path(path, "Dept"),
7228                config,
7229                collector,
7230            );
7231        }
7232        if let Some(ref val) = self.sub_dept {
7233            helpers::validate_length(
7234                val,
7235                "SubDept",
7236                Some(1),
7237                Some(70),
7238                &helpers::child_path(path, "SubDept"),
7239                config,
7240                collector,
7241            );
7242        }
7243        if let Some(ref val) = self.sub_dept {
7244            helpers::validate_pattern(
7245                val,
7246                "SubDept",
7247                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7248                &helpers::child_path(path, "SubDept"),
7249                config,
7250                collector,
7251            );
7252        }
7253        if let Some(ref val) = self.strt_nm {
7254            helpers::validate_length(
7255                val,
7256                "StrtNm",
7257                Some(1),
7258                Some(70),
7259                &helpers::child_path(path, "StrtNm"),
7260                config,
7261                collector,
7262            );
7263        }
7264        if let Some(ref val) = self.strt_nm {
7265            helpers::validate_pattern(
7266                val,
7267                "StrtNm",
7268                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7269                &helpers::child_path(path, "StrtNm"),
7270                config,
7271                collector,
7272            );
7273        }
7274        if let Some(ref val) = self.bldg_nb {
7275            helpers::validate_length(
7276                val,
7277                "BldgNb",
7278                Some(1),
7279                Some(16),
7280                &helpers::child_path(path, "BldgNb"),
7281                config,
7282                collector,
7283            );
7284        }
7285        if let Some(ref val) = self.bldg_nb {
7286            helpers::validate_pattern(
7287                val,
7288                "BldgNb",
7289                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7290                &helpers::child_path(path, "BldgNb"),
7291                config,
7292                collector,
7293            );
7294        }
7295        if let Some(ref val) = self.bldg_nm {
7296            helpers::validate_length(
7297                val,
7298                "BldgNm",
7299                Some(1),
7300                Some(35),
7301                &helpers::child_path(path, "BldgNm"),
7302                config,
7303                collector,
7304            );
7305        }
7306        if let Some(ref val) = self.bldg_nm {
7307            helpers::validate_pattern(
7308                val,
7309                "BldgNm",
7310                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7311                &helpers::child_path(path, "BldgNm"),
7312                config,
7313                collector,
7314            );
7315        }
7316        if let Some(ref val) = self.flr {
7317            helpers::validate_length(
7318                val,
7319                "Flr",
7320                Some(1),
7321                Some(70),
7322                &helpers::child_path(path, "Flr"),
7323                config,
7324                collector,
7325            );
7326        }
7327        if let Some(ref val) = self.flr {
7328            helpers::validate_pattern(
7329                val,
7330                "Flr",
7331                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7332                &helpers::child_path(path, "Flr"),
7333                config,
7334                collector,
7335            );
7336        }
7337        if let Some(ref val) = self.pst_bx {
7338            helpers::validate_length(
7339                val,
7340                "PstBx",
7341                Some(1),
7342                Some(16),
7343                &helpers::child_path(path, "PstBx"),
7344                config,
7345                collector,
7346            );
7347        }
7348        if let Some(ref val) = self.pst_bx {
7349            helpers::validate_pattern(
7350                val,
7351                "PstBx",
7352                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7353                &helpers::child_path(path, "PstBx"),
7354                config,
7355                collector,
7356            );
7357        }
7358        if let Some(ref val) = self.room {
7359            helpers::validate_length(
7360                val,
7361                "Room",
7362                Some(1),
7363                Some(70),
7364                &helpers::child_path(path, "Room"),
7365                config,
7366                collector,
7367            );
7368        }
7369        if let Some(ref val) = self.room {
7370            helpers::validate_pattern(
7371                val,
7372                "Room",
7373                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7374                &helpers::child_path(path, "Room"),
7375                config,
7376                collector,
7377            );
7378        }
7379        if let Some(ref val) = self.pst_cd {
7380            helpers::validate_length(
7381                val,
7382                "PstCd",
7383                Some(1),
7384                Some(16),
7385                &helpers::child_path(path, "PstCd"),
7386                config,
7387                collector,
7388            );
7389        }
7390        if let Some(ref val) = self.pst_cd {
7391            helpers::validate_pattern(
7392                val,
7393                "PstCd",
7394                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7395                &helpers::child_path(path, "PstCd"),
7396                config,
7397                collector,
7398            );
7399        }
7400        if let Some(ref val) = self.twn_nm {
7401            helpers::validate_length(
7402                val,
7403                "TwnNm",
7404                Some(1),
7405                Some(35),
7406                &helpers::child_path(path, "TwnNm"),
7407                config,
7408                collector,
7409            );
7410        }
7411        if let Some(ref val) = self.twn_nm {
7412            helpers::validate_pattern(
7413                val,
7414                "TwnNm",
7415                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7416                &helpers::child_path(path, "TwnNm"),
7417                config,
7418                collector,
7419            );
7420        }
7421        if let Some(ref val) = self.twn_lctn_nm {
7422            helpers::validate_length(
7423                val,
7424                "TwnLctnNm",
7425                Some(1),
7426                Some(35),
7427                &helpers::child_path(path, "TwnLctnNm"),
7428                config,
7429                collector,
7430            );
7431        }
7432        if let Some(ref val) = self.twn_lctn_nm {
7433            helpers::validate_pattern(
7434                val,
7435                "TwnLctnNm",
7436                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7437                &helpers::child_path(path, "TwnLctnNm"),
7438                config,
7439                collector,
7440            );
7441        }
7442        if let Some(ref val) = self.dstrct_nm {
7443            helpers::validate_length(
7444                val,
7445                "DstrctNm",
7446                Some(1),
7447                Some(35),
7448                &helpers::child_path(path, "DstrctNm"),
7449                config,
7450                collector,
7451            );
7452        }
7453        if let Some(ref val) = self.dstrct_nm {
7454            helpers::validate_pattern(
7455                val,
7456                "DstrctNm",
7457                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7458                &helpers::child_path(path, "DstrctNm"),
7459                config,
7460                collector,
7461            );
7462        }
7463        if let Some(ref val) = self.ctry_sub_dvsn {
7464            helpers::validate_length(
7465                val,
7466                "CtrySubDvsn",
7467                Some(1),
7468                Some(35),
7469                &helpers::child_path(path, "CtrySubDvsn"),
7470                config,
7471                collector,
7472            );
7473        }
7474        if let Some(ref val) = self.ctry_sub_dvsn {
7475            helpers::validate_pattern(
7476                val,
7477                "CtrySubDvsn",
7478                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7479                &helpers::child_path(path, "CtrySubDvsn"),
7480                config,
7481                collector,
7482            );
7483        }
7484        if let Some(ref val) = self.ctry {
7485            helpers::validate_pattern(
7486                val,
7487                "Ctry",
7488                "[A-Z]{2,2}",
7489                &helpers::child_path(path, "Ctry"),
7490                config,
7491                collector,
7492            );
7493        }
7494        if let Some(ref vec) = self.adr_line {
7495            for item in vec {
7496                helpers::validate_length(
7497                    item,
7498                    "AdrLine",
7499                    Some(1),
7500                    Some(70),
7501                    &helpers::child_path(path, "AdrLine"),
7502                    config,
7503                    collector,
7504                );
7505            }
7506        }
7507        if let Some(ref vec) = self.adr_line {
7508            for item in vec {
7509                helpers::validate_pattern(
7510                    item,
7511                    "AdrLine",
7512                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7513                    &helpers::child_path(path, "AdrLine"),
7514                    config,
7515                    collector,
7516                );
7517            }
7518        }
7519    }
7520}
7521
7522// PostalAddress242: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
7523#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7524pub struct PostalAddress242 {
7525    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
7526    pub adr_tp: Option<AddressType3Choice1>,
7527    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
7528    pub dept: Option<String>,
7529    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
7530    pub sub_dept: Option<String>,
7531    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
7532    pub strt_nm: Option<String>,
7533    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
7534    pub bldg_nb: Option<String>,
7535    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
7536    pub bldg_nm: Option<String>,
7537    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
7538    pub flr: Option<String>,
7539    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
7540    pub pst_bx: Option<String>,
7541    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
7542    pub room: Option<String>,
7543    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
7544    pub pst_cd: Option<String>,
7545    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
7546    pub twn_nm: Option<String>,
7547    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
7548    pub twn_lctn_nm: Option<String>,
7549    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
7550    pub dstrct_nm: Option<String>,
7551    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
7552    pub ctry_sub_dvsn: Option<String>,
7553    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
7554    pub ctry: Option<String>,
7555    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
7556    pub adr_line: Option<Vec<String>>,
7557}
7558
7559impl Validate for PostalAddress242 {
7560    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7561        if let Some(ref val) = self.adr_tp
7562            && config.validate_optional_fields
7563        {
7564            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
7565        }
7566        if let Some(ref val) = self.dept {
7567            helpers::validate_length(
7568                val,
7569                "Dept",
7570                Some(1),
7571                Some(70),
7572                &helpers::child_path(path, "Dept"),
7573                config,
7574                collector,
7575            );
7576        }
7577        if let Some(ref val) = self.dept {
7578            helpers::validate_pattern(
7579                val,
7580                "Dept",
7581                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7582                &helpers::child_path(path, "Dept"),
7583                config,
7584                collector,
7585            );
7586        }
7587        if let Some(ref val) = self.sub_dept {
7588            helpers::validate_length(
7589                val,
7590                "SubDept",
7591                Some(1),
7592                Some(70),
7593                &helpers::child_path(path, "SubDept"),
7594                config,
7595                collector,
7596            );
7597        }
7598        if let Some(ref val) = self.sub_dept {
7599            helpers::validate_pattern(
7600                val,
7601                "SubDept",
7602                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7603                &helpers::child_path(path, "SubDept"),
7604                config,
7605                collector,
7606            );
7607        }
7608        if let Some(ref val) = self.strt_nm {
7609            helpers::validate_length(
7610                val,
7611                "StrtNm",
7612                Some(1),
7613                Some(70),
7614                &helpers::child_path(path, "StrtNm"),
7615                config,
7616                collector,
7617            );
7618        }
7619        if let Some(ref val) = self.strt_nm {
7620            helpers::validate_pattern(
7621                val,
7622                "StrtNm",
7623                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7624                &helpers::child_path(path, "StrtNm"),
7625                config,
7626                collector,
7627            );
7628        }
7629        if let Some(ref val) = self.bldg_nb {
7630            helpers::validate_length(
7631                val,
7632                "BldgNb",
7633                Some(1),
7634                Some(16),
7635                &helpers::child_path(path, "BldgNb"),
7636                config,
7637                collector,
7638            );
7639        }
7640        if let Some(ref val) = self.bldg_nb {
7641            helpers::validate_pattern(
7642                val,
7643                "BldgNb",
7644                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7645                &helpers::child_path(path, "BldgNb"),
7646                config,
7647                collector,
7648            );
7649        }
7650        if let Some(ref val) = self.bldg_nm {
7651            helpers::validate_length(
7652                val,
7653                "BldgNm",
7654                Some(1),
7655                Some(35),
7656                &helpers::child_path(path, "BldgNm"),
7657                config,
7658                collector,
7659            );
7660        }
7661        if let Some(ref val) = self.bldg_nm {
7662            helpers::validate_pattern(
7663                val,
7664                "BldgNm",
7665                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7666                &helpers::child_path(path, "BldgNm"),
7667                config,
7668                collector,
7669            );
7670        }
7671        if let Some(ref val) = self.flr {
7672            helpers::validate_length(
7673                val,
7674                "Flr",
7675                Some(1),
7676                Some(70),
7677                &helpers::child_path(path, "Flr"),
7678                config,
7679                collector,
7680            );
7681        }
7682        if let Some(ref val) = self.flr {
7683            helpers::validate_pattern(
7684                val,
7685                "Flr",
7686                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7687                &helpers::child_path(path, "Flr"),
7688                config,
7689                collector,
7690            );
7691        }
7692        if let Some(ref val) = self.pst_bx {
7693            helpers::validate_length(
7694                val,
7695                "PstBx",
7696                Some(1),
7697                Some(16),
7698                &helpers::child_path(path, "PstBx"),
7699                config,
7700                collector,
7701            );
7702        }
7703        if let Some(ref val) = self.pst_bx {
7704            helpers::validate_pattern(
7705                val,
7706                "PstBx",
7707                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7708                &helpers::child_path(path, "PstBx"),
7709                config,
7710                collector,
7711            );
7712        }
7713        if let Some(ref val) = self.room {
7714            helpers::validate_length(
7715                val,
7716                "Room",
7717                Some(1),
7718                Some(70),
7719                &helpers::child_path(path, "Room"),
7720                config,
7721                collector,
7722            );
7723        }
7724        if let Some(ref val) = self.room {
7725            helpers::validate_pattern(
7726                val,
7727                "Room",
7728                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7729                &helpers::child_path(path, "Room"),
7730                config,
7731                collector,
7732            );
7733        }
7734        if let Some(ref val) = self.pst_cd {
7735            helpers::validate_length(
7736                val,
7737                "PstCd",
7738                Some(1),
7739                Some(16),
7740                &helpers::child_path(path, "PstCd"),
7741                config,
7742                collector,
7743            );
7744        }
7745        if let Some(ref val) = self.pst_cd {
7746            helpers::validate_pattern(
7747                val,
7748                "PstCd",
7749                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7750                &helpers::child_path(path, "PstCd"),
7751                config,
7752                collector,
7753            );
7754        }
7755        if let Some(ref val) = self.twn_nm {
7756            helpers::validate_length(
7757                val,
7758                "TwnNm",
7759                Some(1),
7760                Some(35),
7761                &helpers::child_path(path, "TwnNm"),
7762                config,
7763                collector,
7764            );
7765        }
7766        if let Some(ref val) = self.twn_nm {
7767            helpers::validate_pattern(
7768                val,
7769                "TwnNm",
7770                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7771                &helpers::child_path(path, "TwnNm"),
7772                config,
7773                collector,
7774            );
7775        }
7776        if let Some(ref val) = self.twn_lctn_nm {
7777            helpers::validate_length(
7778                val,
7779                "TwnLctnNm",
7780                Some(1),
7781                Some(35),
7782                &helpers::child_path(path, "TwnLctnNm"),
7783                config,
7784                collector,
7785            );
7786        }
7787        if let Some(ref val) = self.twn_lctn_nm {
7788            helpers::validate_pattern(
7789                val,
7790                "TwnLctnNm",
7791                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7792                &helpers::child_path(path, "TwnLctnNm"),
7793                config,
7794                collector,
7795            );
7796        }
7797        if let Some(ref val) = self.dstrct_nm {
7798            helpers::validate_length(
7799                val,
7800                "DstrctNm",
7801                Some(1),
7802                Some(35),
7803                &helpers::child_path(path, "DstrctNm"),
7804                config,
7805                collector,
7806            );
7807        }
7808        if let Some(ref val) = self.dstrct_nm {
7809            helpers::validate_pattern(
7810                val,
7811                "DstrctNm",
7812                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7813                &helpers::child_path(path, "DstrctNm"),
7814                config,
7815                collector,
7816            );
7817        }
7818        if let Some(ref val) = self.ctry_sub_dvsn {
7819            helpers::validate_length(
7820                val,
7821                "CtrySubDvsn",
7822                Some(1),
7823                Some(35),
7824                &helpers::child_path(path, "CtrySubDvsn"),
7825                config,
7826                collector,
7827            );
7828        }
7829        if let Some(ref val) = self.ctry_sub_dvsn {
7830            helpers::validate_pattern(
7831                val,
7832                "CtrySubDvsn",
7833                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7834                &helpers::child_path(path, "CtrySubDvsn"),
7835                config,
7836                collector,
7837            );
7838        }
7839        if let Some(ref val) = self.ctry {
7840            helpers::validate_pattern(
7841                val,
7842                "Ctry",
7843                "[A-Z]{2,2}",
7844                &helpers::child_path(path, "Ctry"),
7845                config,
7846                collector,
7847            );
7848        }
7849        if let Some(ref vec) = self.adr_line {
7850            for item in vec {
7851                helpers::validate_length(
7852                    item,
7853                    "AdrLine",
7854                    Some(1),
7855                    Some(70),
7856                    &helpers::child_path(path, "AdrLine"),
7857                    config,
7858                    collector,
7859                );
7860            }
7861        }
7862        if let Some(ref vec) = self.adr_line {
7863            for item in vec {
7864                helpers::validate_pattern(
7865                    item,
7866                    "AdrLine",
7867                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7868                    &helpers::child_path(path, "AdrLine"),
7869                    config,
7870                    collector,
7871                );
7872            }
7873        }
7874    }
7875}
7876
7877// PreferredContactMethod1Code: Preferred method used to reach the contact is per mobile or cell phone.
7878#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7879pub enum PreferredContactMethod1Code {
7880    #[default]
7881    #[serde(rename = "LETT")]
7882    CodeLETT,
7883    #[serde(rename = "MAIL")]
7884    CodeMAIL,
7885    #[serde(rename = "PHON")]
7886    CodePHON,
7887    #[serde(rename = "FAXX")]
7888    CodeFAXX,
7889    #[serde(rename = "CELL")]
7890    CodeCELL,
7891}
7892
7893impl Validate for PreferredContactMethod1Code {
7894    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7895        // Enum validation is typically empty
7896    }
7897}
7898
7899// Price71: Value of the price, for example, as a currency and value.
7900#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7901pub struct Price71 {
7902    #[serde(rename = "Tp")]
7903    pub tp: YieldedOrValueType1Choice,
7904    #[serde(rename = "Val")]
7905    pub val: PriceRateOrAmount3Choice1,
7906}
7907
7908impl Validate for Price71 {
7909    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7910        self.tp
7911            .validate(&helpers::child_path(path, "Tp"), config, collector);
7912        self.val
7913            .validate(&helpers::child_path(path, "Val"), config, collector);
7914    }
7915}
7916
7917// PriceRateOrAmount3Choice1: Price expressed as a currency and value.
7918#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7919pub struct PriceRateOrAmount3Choice1 {
7920    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
7921    pub rate: Option<f64>,
7922    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
7923    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
7924}
7925
7926impl Validate for PriceRateOrAmount3Choice1 {
7927    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7928        if let Some(ref val) = self.amt
7929            && config.validate_optional_fields
7930        {
7931            val.validate(&helpers::child_path(path, "Amt"), config, collector);
7932        }
7933    }
7934}
7935
7936// PriceValueType1Code: Price is the face amount.
7937#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7938pub enum PriceValueType1Code {
7939    #[default]
7940    #[serde(rename = "DISC")]
7941    CodeDISC,
7942    #[serde(rename = "PREM")]
7943    CodePREM,
7944    #[serde(rename = "PARV")]
7945    CodePARV,
7946}
7947
7948impl Validate for PriceValueType1Code {
7949    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7950        // Enum validation is typically empty
7951    }
7952}
7953
7954// Product21: Additional information related to the product.
7955#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7956pub struct Product21 {
7957    #[serde(rename = "PdctCd")]
7958    pub pdct_cd: String,
7959    #[serde(rename = "UnitOfMeasr", skip_serializing_if = "Option::is_none")]
7960    pub unit_of_measr: Option<UnitOfMeasure1Code>,
7961    #[serde(rename = "PdctQty", skip_serializing_if = "Option::is_none")]
7962    pub pdct_qty: Option<f64>,
7963    #[serde(rename = "UnitPric", skip_serializing_if = "Option::is_none")]
7964    pub unit_pric: Option<f64>,
7965    #[serde(rename = "PdctAmt", skip_serializing_if = "Option::is_none")]
7966    pub pdct_amt: Option<f64>,
7967    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
7968    pub tax_tp: Option<String>,
7969    #[serde(rename = "AddtlPdctInf", skip_serializing_if = "Option::is_none")]
7970    pub addtl_pdct_inf: Option<String>,
7971}
7972
7973impl Validate for Product21 {
7974    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7975        helpers::validate_length(
7976            &self.pdct_cd,
7977            "PdctCd",
7978            Some(1),
7979            Some(70),
7980            &helpers::child_path(path, "PdctCd"),
7981            config,
7982            collector,
7983        );
7984        helpers::validate_pattern(
7985            &self.pdct_cd,
7986            "PdctCd",
7987            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7988            &helpers::child_path(path, "PdctCd"),
7989            config,
7990            collector,
7991        );
7992        if let Some(ref val) = self.unit_of_measr
7993            && config.validate_optional_fields
7994        {
7995            val.validate(&helpers::child_path(path, "UnitOfMeasr"), config, collector);
7996        }
7997        if let Some(ref val) = self.tax_tp {
7998            helpers::validate_length(
7999                val,
8000                "TaxTp",
8001                Some(1),
8002                Some(35),
8003                &helpers::child_path(path, "TaxTp"),
8004                config,
8005                collector,
8006            );
8007        }
8008        if let Some(ref val) = self.tax_tp {
8009            helpers::validate_pattern(
8010                val,
8011                "TaxTp",
8012                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8013                &helpers::child_path(path, "TaxTp"),
8014                config,
8015                collector,
8016            );
8017        }
8018        if let Some(ref val) = self.addtl_pdct_inf {
8019            helpers::validate_length(
8020                val,
8021                "AddtlPdctInf",
8022                Some(1),
8023                Some(35),
8024                &helpers::child_path(path, "AddtlPdctInf"),
8025                config,
8026                collector,
8027            );
8028        }
8029        if let Some(ref val) = self.addtl_pdct_inf {
8030            helpers::validate_pattern(
8031                val,
8032                "AddtlPdctInf",
8033                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8034                &helpers::child_path(path, "AddtlPdctInf"),
8035                config,
8036                collector,
8037            );
8038        }
8039    }
8040}
8041
8042// ProprietaryAgent41: Organisation established primarily to provide financial services.
8043#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8044pub struct ProprietaryAgent41 {
8045    #[serde(rename = "Tp")]
8046    pub tp: String,
8047    #[serde(rename = "Agt")]
8048    pub agt: BranchAndFinancialInstitutionIdentification62,
8049}
8050
8051impl Validate for ProprietaryAgent41 {
8052    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8053        helpers::validate_length(
8054            &self.tp,
8055            "Tp",
8056            Some(1),
8057            Some(35),
8058            &helpers::child_path(path, "Tp"),
8059            config,
8060            collector,
8061        );
8062        helpers::validate_pattern(
8063            &self.tp,
8064            "Tp",
8065            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8066            &helpers::child_path(path, "Tp"),
8067            config,
8068            collector,
8069        );
8070        self.agt
8071            .validate(&helpers::child_path(path, "Agt"), config, collector);
8072    }
8073}
8074
8075// ProprietaryBankTransactionCodeStructure11: Identification of the issuer of the proprietary bank transaction code.
8076#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8077pub struct ProprietaryBankTransactionCodeStructure11 {
8078    #[serde(rename = "Cd")]
8079    pub cd: String,
8080    #[serde(rename = "Issr")]
8081    pub issr: String,
8082}
8083
8084impl Validate for ProprietaryBankTransactionCodeStructure11 {
8085    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8086        helpers::validate_length(
8087            &self.cd,
8088            "Cd",
8089            Some(1),
8090            Some(35),
8091            &helpers::child_path(path, "Cd"),
8092            config,
8093            collector,
8094        );
8095        helpers::validate_pattern(
8096            &self.cd,
8097            "Cd",
8098            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8099            &helpers::child_path(path, "Cd"),
8100            config,
8101            collector,
8102        );
8103        helpers::validate_length(
8104            &self.issr,
8105            "Issr",
8106            Some(1),
8107            Some(35),
8108            &helpers::child_path(path, "Issr"),
8109            config,
8110            collector,
8111        );
8112        helpers::validate_pattern(
8113            &self.issr,
8114            "Issr",
8115            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8116            &helpers::child_path(path, "Issr"),
8117            config,
8118            collector,
8119        );
8120    }
8121}
8122
8123// ProprietaryDate31: Date in ISO format.
8124#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8125pub struct ProprietaryDate31 {
8126    #[serde(rename = "Tp")]
8127    pub tp: String,
8128    #[serde(rename = "Dt")]
8129    pub dt: DateAndDateTime2Choice1,
8130}
8131
8132impl Validate for ProprietaryDate31 {
8133    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8134        helpers::validate_length(
8135            &self.tp,
8136            "Tp",
8137            Some(1),
8138            Some(35),
8139            &helpers::child_path(path, "Tp"),
8140            config,
8141            collector,
8142        );
8143        helpers::validate_pattern(
8144            &self.tp,
8145            "Tp",
8146            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8147            &helpers::child_path(path, "Tp"),
8148            config,
8149            collector,
8150        );
8151        self.dt
8152            .validate(&helpers::child_path(path, "Dt"), config, collector);
8153    }
8154}
8155
8156// ProprietaryParty51: Proprietary party.
8157#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8158pub struct ProprietaryParty51 {
8159    #[serde(rename = "Tp")]
8160    pub tp: String,
8161    #[serde(rename = "Pty")]
8162    pub pty: Party40Choice1,
8163}
8164
8165impl Validate for ProprietaryParty51 {
8166    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8167        helpers::validate_length(
8168            &self.tp,
8169            "Tp",
8170            Some(1),
8171            Some(35),
8172            &helpers::child_path(path, "Tp"),
8173            config,
8174            collector,
8175        );
8176        helpers::validate_pattern(
8177            &self.tp,
8178            "Tp",
8179            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8180            &helpers::child_path(path, "Tp"),
8181            config,
8182            collector,
8183        );
8184        self.pty
8185            .validate(&helpers::child_path(path, "Pty"), config, collector);
8186    }
8187}
8188
8189// ProprietaryPrice21: Proprietary price specification related to the underlying transaction.
8190#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8191pub struct ProprietaryPrice21 {
8192    #[serde(rename = "Tp")]
8193    pub tp: String,
8194    #[serde(rename = "Pric")]
8195    pub pric: ActiveOrHistoricCurrencyAndAmount,
8196}
8197
8198impl Validate for ProprietaryPrice21 {
8199    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8200        helpers::validate_length(
8201            &self.tp,
8202            "Tp",
8203            Some(1),
8204            Some(35),
8205            &helpers::child_path(path, "Tp"),
8206            config,
8207            collector,
8208        );
8209        helpers::validate_pattern(
8210            &self.tp,
8211            "Tp",
8212            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8213            &helpers::child_path(path, "Tp"),
8214            config,
8215            collector,
8216        );
8217        self.pric
8218            .validate(&helpers::child_path(path, "Pric"), config, collector);
8219    }
8220}
8221
8222// ProprietaryQuantity11: Provides the proprietary quantity in free format.
8223#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8224pub struct ProprietaryQuantity11 {
8225    #[serde(rename = "Tp")]
8226    pub tp: String,
8227    #[serde(rename = "Qty")]
8228    pub qty: String,
8229}
8230
8231impl Validate for ProprietaryQuantity11 {
8232    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8233        helpers::validate_length(
8234            &self.tp,
8235            "Tp",
8236            Some(1),
8237            Some(35),
8238            &helpers::child_path(path, "Tp"),
8239            config,
8240            collector,
8241        );
8242        helpers::validate_pattern(
8243            &self.tp,
8244            "Tp",
8245            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8246            &helpers::child_path(path, "Tp"),
8247            config,
8248            collector,
8249        );
8250        helpers::validate_length(
8251            &self.qty,
8252            "Qty",
8253            Some(1),
8254            Some(35),
8255            &helpers::child_path(path, "Qty"),
8256            config,
8257            collector,
8258        );
8259        helpers::validate_pattern(
8260            &self.qty,
8261            "Qty",
8262            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8263            &helpers::child_path(path, "Qty"),
8264            config,
8265            collector,
8266        );
8267    }
8268}
8269
8270// ProprietaryReference11: Proprietary reference specification related to the underlying transaction.
8271#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8272pub struct ProprietaryReference11 {
8273    #[serde(rename = "Tp")]
8274    pub tp: String,
8275    #[serde(rename = "Ref")]
8276    pub ref_attr: String,
8277}
8278
8279impl Validate for ProprietaryReference11 {
8280    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8281        helpers::validate_length(
8282            &self.tp,
8283            "Tp",
8284            Some(1),
8285            Some(35),
8286            &helpers::child_path(path, "Tp"),
8287            config,
8288            collector,
8289        );
8290        helpers::validate_pattern(
8291            &self.tp,
8292            "Tp",
8293            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8294            &helpers::child_path(path, "Tp"),
8295            config,
8296            collector,
8297        );
8298        helpers::validate_length(
8299            &self.ref_attr,
8300            "Ref",
8301            Some(1),
8302            Some(35),
8303            &helpers::child_path(path, "Ref"),
8304            config,
8305            collector,
8306        );
8307        helpers::validate_pattern(
8308            &self.ref_attr,
8309            "Ref",
8310            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8311            &helpers::child_path(path, "Ref"),
8312            config,
8313            collector,
8314        );
8315    }
8316}
8317
8318// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
8319#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8320pub struct ProxyAccountIdentification11 {
8321    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
8322    pub tp: Option<ProxyAccountType1Choice1>,
8323    #[serde(rename = "Id")]
8324    pub id: String,
8325}
8326
8327impl Validate for ProxyAccountIdentification11 {
8328    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8329        if let Some(ref val) = self.tp
8330            && config.validate_optional_fields
8331        {
8332            val.validate(&helpers::child_path(path, "Tp"), config, collector);
8333        }
8334        helpers::validate_length(
8335            &self.id,
8336            "Id",
8337            Some(1),
8338            Some(320),
8339            &helpers::child_path(path, "Id"),
8340            config,
8341            collector,
8342        );
8343        helpers::validate_pattern(
8344            &self.id,
8345            "Id",
8346            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8347            &helpers::child_path(path, "Id"),
8348            config,
8349            collector,
8350        );
8351    }
8352}
8353
8354// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
8355#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8356pub struct ProxyAccountType1Choice1 {
8357    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8358    pub cd: Option<String>,
8359    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8360    pub prtry: Option<String>,
8361}
8362
8363impl Validate for ProxyAccountType1Choice1 {
8364    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8365        if let Some(ref val) = self.cd {
8366            helpers::validate_length(
8367                val,
8368                "Cd",
8369                Some(1),
8370                Some(4),
8371                &helpers::child_path(path, "Cd"),
8372                config,
8373                collector,
8374            );
8375        }
8376        if let Some(ref val) = self.prtry {
8377            helpers::validate_length(
8378                val,
8379                "Prtry",
8380                Some(1),
8381                Some(35),
8382                &helpers::child_path(path, "Prtry"),
8383                config,
8384                collector,
8385            );
8386        }
8387        if let Some(ref val) = self.prtry {
8388            helpers::validate_pattern(
8389                val,
8390                "Prtry",
8391                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8392                &helpers::child_path(path, "Prtry"),
8393                config,
8394                collector,
8395            );
8396        }
8397    }
8398}
8399
8400// Purpose2Choice1: Purpose, in a proprietary form.
8401#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8402pub struct Purpose2Choice1 {
8403    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8404    pub cd: Option<String>,
8405    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8406    pub prtry: Option<String>,
8407}
8408
8409impl Validate for Purpose2Choice1 {
8410    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8411        if let Some(ref val) = self.cd {
8412            helpers::validate_length(
8413                val,
8414                "Cd",
8415                Some(1),
8416                Some(4),
8417                &helpers::child_path(path, "Cd"),
8418                config,
8419                collector,
8420            );
8421        }
8422        if let Some(ref val) = self.prtry {
8423            helpers::validate_length(
8424                val,
8425                "Prtry",
8426                Some(1),
8427                Some(35),
8428                &helpers::child_path(path, "Prtry"),
8429                config,
8430                collector,
8431            );
8432        }
8433        if let Some(ref val) = self.prtry {
8434            helpers::validate_pattern(
8435                val,
8436                "Prtry",
8437                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8438                &helpers::child_path(path, "Prtry"),
8439                config,
8440                collector,
8441            );
8442        }
8443    }
8444}
8445
8446// Rate41: An amount range where the interest rate is applicable.
8447#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8448pub struct Rate41 {
8449    #[serde(rename = "Tp")]
8450    pub tp: RateType4Choice1,
8451    #[serde(rename = "VldtyRg", skip_serializing_if = "Option::is_none")]
8452    pub vldty_rg: Option<ActiveOrHistoricCurrencyAndAmountRange2>,
8453}
8454
8455impl Validate for Rate41 {
8456    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8457        self.tp
8458            .validate(&helpers::child_path(path, "Tp"), config, collector);
8459        if let Some(ref val) = self.vldty_rg
8460            && config.validate_optional_fields
8461        {
8462            val.validate(&helpers::child_path(path, "VldtyRg"), config, collector);
8463        }
8464    }
8465}
8466
8467// RateType4Choice1: Rate type expressed, in an other form.
8468#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8469pub struct RateType4Choice1 {
8470    #[serde(rename = "Pctg", skip_serializing_if = "Option::is_none")]
8471    pub pctg: Option<f64>,
8472    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
8473    pub othr: Option<String>,
8474}
8475
8476impl Validate for RateType4Choice1 {
8477    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8478        if let Some(ref val) = self.othr {
8479            helpers::validate_length(
8480                val,
8481                "Othr",
8482                Some(1),
8483                Some(35),
8484                &helpers::child_path(path, "Othr"),
8485                config,
8486                collector,
8487            );
8488        }
8489        if let Some(ref val) = self.othr {
8490            helpers::validate_pattern(
8491                val,
8492                "Othr",
8493                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8494                &helpers::child_path(path, "Othr"),
8495                config,
8496                collector,
8497            );
8498        }
8499    }
8500}
8501
8502// ReferredDocumentInformation71: Set of elements used to provide the content of the referred document line.
8503#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8504pub struct ReferredDocumentInformation71 {
8505    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
8506    pub tp: Option<ReferredDocumentType41>,
8507    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
8508    pub nb: Option<String>,
8509    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
8510    pub rltd_dt: Option<String>,
8511    #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
8512    pub line_dtls: Option<Vec<DocumentLineInformation11>>,
8513}
8514
8515impl Validate for ReferredDocumentInformation71 {
8516    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8517        if let Some(ref val) = self.tp
8518            && config.validate_optional_fields
8519        {
8520            val.validate(&helpers::child_path(path, "Tp"), config, collector);
8521        }
8522        if let Some(ref val) = self.nb {
8523            helpers::validate_length(
8524                val,
8525                "Nb",
8526                Some(1),
8527                Some(35),
8528                &helpers::child_path(path, "Nb"),
8529                config,
8530                collector,
8531            );
8532        }
8533        if let Some(ref val) = self.nb {
8534            helpers::validate_pattern(
8535                val,
8536                "Nb",
8537                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8538                &helpers::child_path(path, "Nb"),
8539                config,
8540                collector,
8541            );
8542        }
8543        if let Some(ref vec) = self.line_dtls
8544            && config.validate_optional_fields
8545        {
8546            for item in vec {
8547                item.validate(&helpers::child_path(path, "LineDtls"), config, collector);
8548            }
8549        }
8550    }
8551}
8552
8553// ReferredDocumentType3Choice: Proprietary identification of the type of the remittance document.
8554#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8555pub struct ReferredDocumentType3Choice {
8556    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8557    pub cd: Option<DocumentType6Code>,
8558    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8559    pub prtry: Option<String>,
8560}
8561
8562impl Validate for ReferredDocumentType3Choice {
8563    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8564        if let Some(ref val) = self.cd
8565            && config.validate_optional_fields
8566        {
8567            val.validate(&helpers::child_path(path, "Cd"), config, collector);
8568        }
8569        if let Some(ref val) = self.prtry {
8570            helpers::validate_length(
8571                val,
8572                "Prtry",
8573                Some(1),
8574                Some(35),
8575                &helpers::child_path(path, "Prtry"),
8576                config,
8577                collector,
8578            );
8579        }
8580    }
8581}
8582
8583// ReferredDocumentType41: Identification of the issuer of the reference document type.
8584#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8585pub struct ReferredDocumentType41 {
8586    #[serde(rename = "CdOrPrtry")]
8587    pub cd_or_prtry: ReferredDocumentType3Choice,
8588    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
8589    pub issr: Option<String>,
8590}
8591
8592impl Validate for ReferredDocumentType41 {
8593    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8594        self.cd_or_prtry
8595            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
8596        if let Some(ref val) = self.issr {
8597            helpers::validate_length(
8598                val,
8599                "Issr",
8600                Some(1),
8601                Some(35),
8602                &helpers::child_path(path, "Issr"),
8603                config,
8604                collector,
8605            );
8606        }
8607        if let Some(ref val) = self.issr {
8608            helpers::validate_pattern(
8609                val,
8610                "Issr",
8611                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8612                &helpers::child_path(path, "Issr"),
8613                config,
8614                collector,
8615            );
8616        }
8617    }
8618}
8619
8620// RemittanceAmount21: Amount of money remitted for the referred document.
8621#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8622pub struct RemittanceAmount21 {
8623    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
8624    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8625    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
8626    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
8627    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
8628    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8629    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
8630    pub tax_amt: Option<Vec<TaxAmountAndType1>>,
8631    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
8632    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
8633    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
8634    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8635}
8636
8637impl Validate for RemittanceAmount21 {
8638    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8639        if let Some(ref val) = self.due_pybl_amt
8640            && config.validate_optional_fields
8641        {
8642            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
8643        }
8644        if let Some(ref vec) = self.dscnt_apld_amt
8645            && config.validate_optional_fields
8646        {
8647            for item in vec {
8648                item.validate(
8649                    &helpers::child_path(path, "DscntApldAmt"),
8650                    config,
8651                    collector,
8652                );
8653            }
8654        }
8655        if let Some(ref val) = self.cdt_note_amt
8656            && config.validate_optional_fields
8657        {
8658            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
8659        }
8660        if let Some(ref vec) = self.tax_amt
8661            && config.validate_optional_fields
8662        {
8663            for item in vec {
8664                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
8665            }
8666        }
8667        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
8668            && config.validate_optional_fields
8669        {
8670            for item in vec {
8671                item.validate(
8672                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
8673                    config,
8674                    collector,
8675                );
8676            }
8677        }
8678        if let Some(ref val) = self.rmtd_amt
8679            && config.validate_optional_fields
8680        {
8681            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
8682        }
8683    }
8684}
8685
8686// RemittanceAmount31: Amount of money remitted.
8687#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8688pub struct RemittanceAmount31 {
8689    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
8690    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8691    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
8692    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
8693    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
8694    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8695    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
8696    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
8697    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
8698    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
8699    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
8700    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8701}
8702
8703impl Validate for RemittanceAmount31 {
8704    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8705        if let Some(ref val) = self.due_pybl_amt
8706            && config.validate_optional_fields
8707        {
8708            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
8709        }
8710        if let Some(ref vec) = self.dscnt_apld_amt
8711            && config.validate_optional_fields
8712        {
8713            for item in vec {
8714                item.validate(
8715                    &helpers::child_path(path, "DscntApldAmt"),
8716                    config,
8717                    collector,
8718                );
8719            }
8720        }
8721        if let Some(ref val) = self.cdt_note_amt
8722            && config.validate_optional_fields
8723        {
8724            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
8725        }
8726        if let Some(ref vec) = self.tax_amt
8727            && config.validate_optional_fields
8728        {
8729            for item in vec {
8730                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
8731            }
8732        }
8733        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
8734            && config.validate_optional_fields
8735        {
8736            for item in vec {
8737                item.validate(
8738                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
8739                    config,
8740                    collector,
8741                );
8742            }
8743        }
8744        if let Some(ref val) = self.rmtd_amt
8745            && config.validate_optional_fields
8746        {
8747            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
8748        }
8749    }
8750}
8751
8752// 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.
8753#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8754pub struct RemittanceInformation161 {
8755    #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
8756    pub ustrd: Option<String>,
8757    #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
8758    pub strd: Option<Vec<StructuredRemittanceInformation161>>,
8759}
8760
8761impl Validate for RemittanceInformation161 {
8762    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8763        if let Some(ref val) = self.ustrd {
8764            helpers::validate_length(
8765                val,
8766                "Ustrd",
8767                Some(1),
8768                Some(140),
8769                &helpers::child_path(path, "Ustrd"),
8770                config,
8771                collector,
8772            );
8773        }
8774        if let Some(ref val) = self.ustrd {
8775            helpers::validate_pattern(
8776                val,
8777                "Ustrd",
8778                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8779                &helpers::child_path(path, "Ustrd"),
8780                config,
8781                collector,
8782            );
8783        }
8784        if let Some(ref vec) = self.strd
8785            && config.validate_optional_fields
8786        {
8787            for item in vec {
8788                item.validate(&helpers::child_path(path, "Strd"), config, collector);
8789            }
8790        }
8791    }
8792}
8793
8794// RemittanceLocation71: Set of elements used to provide information on the location and/or delivery of the remittance information.
8795#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8796pub struct RemittanceLocation71 {
8797    #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
8798    pub rmt_id: Option<String>,
8799    #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
8800    pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
8801}
8802
8803impl Validate for RemittanceLocation71 {
8804    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8805        if let Some(ref val) = self.rmt_id {
8806            helpers::validate_length(
8807                val,
8808                "RmtId",
8809                Some(1),
8810                Some(35),
8811                &helpers::child_path(path, "RmtId"),
8812                config,
8813                collector,
8814            );
8815        }
8816        if let Some(ref val) = self.rmt_id {
8817            helpers::validate_pattern(
8818                val,
8819                "RmtId",
8820                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8821                &helpers::child_path(path, "RmtId"),
8822                config,
8823                collector,
8824            );
8825        }
8826        if let Some(ref vec) = self.rmt_lctn_dtls
8827            && config.validate_optional_fields
8828        {
8829            for item in vec {
8830                item.validate(&helpers::child_path(path, "RmtLctnDtls"), config, collector);
8831            }
8832        }
8833    }
8834}
8835
8836// RemittanceLocationData11: Postal address to which an agent is to send the remittance information.
8837#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8838pub struct RemittanceLocationData11 {
8839    #[serde(rename = "Mtd")]
8840    pub mtd: RemittanceLocationMethod2Code,
8841    #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
8842    pub elctrnc_adr: Option<String>,
8843    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
8844    pub pstl_adr: Option<NameAndAddress161>,
8845}
8846
8847impl Validate for RemittanceLocationData11 {
8848    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8849        self.mtd
8850            .validate(&helpers::child_path(path, "Mtd"), config, collector);
8851        if let Some(ref val) = self.elctrnc_adr {
8852            helpers::validate_length(
8853                val,
8854                "ElctrncAdr",
8855                Some(1),
8856                Some(2048),
8857                &helpers::child_path(path, "ElctrncAdr"),
8858                config,
8859                collector,
8860            );
8861        }
8862        if let Some(ref val) = self.elctrnc_adr {
8863            helpers::validate_pattern(
8864                val,
8865                "ElctrncAdr",
8866                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8867                &helpers::child_path(path, "ElctrncAdr"),
8868                config,
8869                collector,
8870            );
8871        }
8872        if let Some(ref val) = self.pstl_adr
8873            && config.validate_optional_fields
8874        {
8875            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
8876        }
8877    }
8878}
8879
8880// RemittanceLocationMethod2Code: Remittance advice information must be sent through by phone as a short message service (SMS).
8881#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8882pub enum RemittanceLocationMethod2Code {
8883    #[default]
8884    #[serde(rename = "FAXI")]
8885    CodeFAXI,
8886    #[serde(rename = "EDIC")]
8887    CodeEDIC,
8888    #[serde(rename = "URID")]
8889    CodeURID,
8890    #[serde(rename = "EMAL")]
8891    CodeEMAL,
8892    #[serde(rename = "POST")]
8893    CodePOST,
8894    #[serde(rename = "SMSM")]
8895    CodeSMSM,
8896}
8897
8898impl Validate for RemittanceLocationMethod2Code {
8899    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
8900        // Enum validation is typically empty
8901    }
8902}
8903
8904// ReportEntry101: Further details of the entry.
8905#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8906pub struct ReportEntry101 {
8907    #[serde(rename = "NtryRef", skip_serializing_if = "Option::is_none")]
8908    pub ntry_ref: Option<String>,
8909    #[serde(rename = "Amt")]
8910    pub amt: ActiveOrHistoricCurrencyAndAmount,
8911    #[serde(rename = "CdtDbtInd")]
8912    pub cdt_dbt_ind: CreditDebitCode,
8913    #[serde(rename = "RvslInd", skip_serializing_if = "Option::is_none")]
8914    pub rvsl_ind: Option<bool>,
8915    #[serde(rename = "Sts")]
8916    pub sts: EntryStatus1Choice1,
8917    #[serde(rename = "BookgDt", skip_serializing_if = "Option::is_none")]
8918    pub bookg_dt: Option<DateAndDateTime2Choice1>,
8919    #[serde(rename = "ValDt")]
8920    pub val_dt: DateAndDateTime2Choice1,
8921    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
8922    pub acct_svcr_ref: Option<String>,
8923    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
8924    pub avlbty: Option<Vec<CashAvailability1>>,
8925    #[serde(rename = "BkTxCd")]
8926    pub bk_tx_cd: BankTransactionCodeStructure41,
8927    #[serde(rename = "ComssnWvrInd", skip_serializing_if = "Option::is_none")]
8928    pub comssn_wvr_ind: Option<bool>,
8929    #[serde(rename = "AddtlInfInd", skip_serializing_if = "Option::is_none")]
8930    pub addtl_inf_ind: Option<MessageIdentification21>,
8931    #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
8932    pub amt_dtls: Option<AmountAndCurrencyExchange31>,
8933    #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
8934    pub chrgs: Option<Charges61>,
8935    #[serde(rename = "TechInptChanl", skip_serializing_if = "Option::is_none")]
8936    pub tech_inpt_chanl: Option<TechnicalInputChannel1Choice1>,
8937    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
8938    pub intrst: Option<TransactionInterest41>,
8939    #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
8940    pub card_tx: Option<CardEntry41>,
8941    #[serde(rename = "NtryDtls", skip_serializing_if = "Option::is_none")]
8942    pub ntry_dtls: Option<Vec<EntryDetails91>>,
8943    #[serde(rename = "AddtlNtryInf", skip_serializing_if = "Option::is_none")]
8944    pub addtl_ntry_inf: Option<String>,
8945}
8946
8947impl Validate for ReportEntry101 {
8948    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8949        if let Some(ref val) = self.ntry_ref {
8950            helpers::validate_length(
8951                val,
8952                "NtryRef",
8953                Some(1),
8954                Some(35),
8955                &helpers::child_path(path, "NtryRef"),
8956                config,
8957                collector,
8958            );
8959        }
8960        if let Some(ref val) = self.ntry_ref {
8961            helpers::validate_pattern(
8962                val,
8963                "NtryRef",
8964                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8965                &helpers::child_path(path, "NtryRef"),
8966                config,
8967                collector,
8968            );
8969        }
8970        self.amt
8971            .validate(&helpers::child_path(path, "Amt"), config, collector);
8972        self.cdt_dbt_ind
8973            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
8974        self.sts
8975            .validate(&helpers::child_path(path, "Sts"), config, collector);
8976        if let Some(ref val) = self.bookg_dt
8977            && config.validate_optional_fields
8978        {
8979            val.validate(&helpers::child_path(path, "BookgDt"), config, collector);
8980        }
8981        self.val_dt
8982            .validate(&helpers::child_path(path, "ValDt"), config, collector);
8983        if let Some(ref val) = self.acct_svcr_ref {
8984            helpers::validate_length(
8985                val,
8986                "AcctSvcrRef",
8987                Some(1),
8988                Some(35),
8989                &helpers::child_path(path, "AcctSvcrRef"),
8990                config,
8991                collector,
8992            );
8993        }
8994        if let Some(ref val) = self.acct_svcr_ref {
8995            helpers::validate_pattern(
8996                val,
8997                "AcctSvcrRef",
8998                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8999                &helpers::child_path(path, "AcctSvcrRef"),
9000                config,
9001                collector,
9002            );
9003        }
9004        if let Some(ref vec) = self.avlbty
9005            && config.validate_optional_fields
9006        {
9007            for item in vec {
9008                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
9009            }
9010        }
9011        self.bk_tx_cd
9012            .validate(&helpers::child_path(path, "BkTxCd"), config, collector);
9013        if let Some(ref val) = self.addtl_inf_ind
9014            && config.validate_optional_fields
9015        {
9016            val.validate(&helpers::child_path(path, "AddtlInfInd"), config, collector);
9017        }
9018        if let Some(ref val) = self.amt_dtls
9019            && config.validate_optional_fields
9020        {
9021            val.validate(&helpers::child_path(path, "AmtDtls"), config, collector);
9022        }
9023        if let Some(ref val) = self.chrgs
9024            && config.validate_optional_fields
9025        {
9026            val.validate(&helpers::child_path(path, "Chrgs"), config, collector);
9027        }
9028        if let Some(ref val) = self.tech_inpt_chanl
9029            && config.validate_optional_fields
9030        {
9031            val.validate(
9032                &helpers::child_path(path, "TechInptChanl"),
9033                config,
9034                collector,
9035            );
9036        }
9037        if let Some(ref val) = self.intrst
9038            && config.validate_optional_fields
9039        {
9040            val.validate(&helpers::child_path(path, "Intrst"), config, collector);
9041        }
9042        if let Some(ref val) = self.card_tx
9043            && config.validate_optional_fields
9044        {
9045            val.validate(&helpers::child_path(path, "CardTx"), config, collector);
9046        }
9047        if let Some(ref vec) = self.ntry_dtls
9048            && config.validate_optional_fields
9049        {
9050            for item in vec {
9051                item.validate(&helpers::child_path(path, "NtryDtls"), config, collector);
9052            }
9053        }
9054        if let Some(ref val) = self.addtl_ntry_inf {
9055            helpers::validate_length(
9056                val,
9057                "AddtlNtryInf",
9058                Some(1),
9059                Some(500),
9060                &helpers::child_path(path, "AddtlNtryInf"),
9061                config,
9062                collector,
9063            );
9064        }
9065        if let Some(ref val) = self.addtl_ntry_inf {
9066            helpers::validate_pattern(
9067                val,
9068                "AddtlNtryInf",
9069                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9070                &helpers::child_path(path, "AddtlNtryInf"),
9071                config,
9072                collector,
9073            );
9074        }
9075    }
9076}
9077
9078// ReportingSource1Choice1: Reporting source, in a proprietary form.
9079#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9080pub struct ReportingSource1Choice1 {
9081    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9082    pub cd: Option<String>,
9083    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9084    pub prtry: Option<String>,
9085}
9086
9087impl Validate for ReportingSource1Choice1 {
9088    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9089        if let Some(ref val) = self.cd {
9090            helpers::validate_length(
9091                val,
9092                "Cd",
9093                Some(1),
9094                Some(4),
9095                &helpers::child_path(path, "Cd"),
9096                config,
9097                collector,
9098            );
9099        }
9100        if let Some(ref val) = self.prtry {
9101            helpers::validate_length(
9102                val,
9103                "Prtry",
9104                Some(1),
9105                Some(35),
9106                &helpers::child_path(path, "Prtry"),
9107                config,
9108                collector,
9109            );
9110        }
9111        if let Some(ref val) = self.prtry {
9112            helpers::validate_pattern(
9113                val,
9114                "Prtry",
9115                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9116                &helpers::child_path(path, "Prtry"),
9117                config,
9118                collector,
9119            );
9120        }
9121    }
9122}
9123
9124// ReturnReason5Choice1: Reason for the return, in a proprietary form.
9125#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9126pub struct ReturnReason5Choice1 {
9127    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9128    pub cd: Option<String>,
9129    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9130    pub prtry: Option<String>,
9131}
9132
9133impl Validate for ReturnReason5Choice1 {
9134    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9135        if let Some(ref val) = self.cd {
9136            helpers::validate_length(
9137                val,
9138                "Cd",
9139                Some(1),
9140                Some(4),
9141                &helpers::child_path(path, "Cd"),
9142                config,
9143                collector,
9144            );
9145        }
9146        if let Some(ref val) = self.prtry {
9147            helpers::validate_length(
9148                val,
9149                "Prtry",
9150                Some(1),
9151                Some(35),
9152                &helpers::child_path(path, "Prtry"),
9153                config,
9154                collector,
9155            );
9156        }
9157        if let Some(ref val) = self.prtry {
9158            helpers::validate_pattern(
9159                val,
9160                "Prtry",
9161                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9162                &helpers::child_path(path, "Prtry"),
9163                config,
9164                collector,
9165            );
9166        }
9167    }
9168}
9169
9170// SecuritiesAccount191: Description of the account.
9171#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9172pub struct SecuritiesAccount191 {
9173    #[serde(rename = "Id")]
9174    pub id: String,
9175    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9176    pub tp: Option<GenericIdentification302>,
9177    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9178    pub nm: Option<String>,
9179}
9180
9181impl Validate for SecuritiesAccount191 {
9182    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9183        helpers::validate_length(
9184            &self.id,
9185            "Id",
9186            Some(1),
9187            Some(35),
9188            &helpers::child_path(path, "Id"),
9189            config,
9190            collector,
9191        );
9192        helpers::validate_pattern(
9193            &self.id,
9194            "Id",
9195            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9196            &helpers::child_path(path, "Id"),
9197            config,
9198            collector,
9199        );
9200        if let Some(ref val) = self.tp
9201            && config.validate_optional_fields
9202        {
9203            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9204        }
9205        if let Some(ref val) = self.nm {
9206            helpers::validate_length(
9207                val,
9208                "Nm",
9209                Some(1),
9210                Some(70),
9211                &helpers::child_path(path, "Nm"),
9212                config,
9213                collector,
9214            );
9215        }
9216        if let Some(ref val) = self.nm {
9217            helpers::validate_pattern(
9218                val,
9219                "Nm",
9220                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9221                &helpers::child_path(path, "Nm"),
9222                config,
9223                collector,
9224            );
9225        }
9226    }
9227}
9228
9229// SecurityIdentification191: Textual description of a security instrument.
9230#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9231pub struct SecurityIdentification191 {
9232    #[serde(rename = "ISIN", skip_serializing_if = "Option::is_none")]
9233    pub isin: Option<String>,
9234    #[serde(rename = "OthrId", skip_serializing_if = "Option::is_none")]
9235    pub othr_id: Option<Vec<OtherIdentification11>>,
9236    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
9237    pub desc: Option<String>,
9238}
9239
9240impl Validate for SecurityIdentification191 {
9241    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9242        if let Some(ref val) = self.isin {
9243            helpers::validate_pattern(
9244                val,
9245                "ISIN",
9246                "[A-Z]{2,2}[A-Z0-9]{9,9}[0-9]{1,1}",
9247                &helpers::child_path(path, "ISIN"),
9248                config,
9249                collector,
9250            );
9251        }
9252        if let Some(ref vec) = self.othr_id
9253            && config.validate_optional_fields
9254        {
9255            for item in vec {
9256                item.validate(&helpers::child_path(path, "OthrId"), config, collector);
9257            }
9258        }
9259        if let Some(ref val) = self.desc {
9260            helpers::validate_length(
9261                val,
9262                "Desc",
9263                Some(1),
9264                Some(35),
9265                &helpers::child_path(path, "Desc"),
9266                config,
9267                collector,
9268            );
9269        }
9270        if let Some(ref val) = self.desc {
9271            helpers::validate_pattern(
9272                val,
9273                "Desc",
9274                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9275                &helpers::child_path(path, "Desc"),
9276                config,
9277                collector,
9278            );
9279        }
9280    }
9281}
9282
9283// SequenceRange1Choice1: Specified sequence to be excluded.
9284#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9285pub struct SequenceRange1Choice1 {
9286    #[serde(rename = "FrSeq", skip_serializing_if = "Option::is_none")]
9287    pub fr_seq: Option<String>,
9288    #[serde(rename = "ToSeq", skip_serializing_if = "Option::is_none")]
9289    pub to_seq: Option<String>,
9290    #[serde(rename = "FrToSeq", skip_serializing_if = "Option::is_none")]
9291    pub fr_to_seq: Option<Vec<SequenceRange11>>,
9292    #[serde(rename = "EQSeq", skip_serializing_if = "Option::is_none")]
9293    pub eq_seq: Option<Vec<String>>,
9294    #[serde(rename = "NEQSeq", skip_serializing_if = "Option::is_none")]
9295    pub neq_seq: Option<Vec<String>>,
9296}
9297
9298impl Validate for SequenceRange1Choice1 {
9299    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9300        if let Some(ref val) = self.fr_seq {
9301            helpers::validate_length(
9302                val,
9303                "FrSeq",
9304                Some(1),
9305                Some(35),
9306                &helpers::child_path(path, "FrSeq"),
9307                config,
9308                collector,
9309            );
9310        }
9311        if let Some(ref val) = self.fr_seq {
9312            helpers::validate_pattern(
9313                val,
9314                "FrSeq",
9315                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9316                &helpers::child_path(path, "FrSeq"),
9317                config,
9318                collector,
9319            );
9320        }
9321        if let Some(ref val) = self.to_seq {
9322            helpers::validate_length(
9323                val,
9324                "ToSeq",
9325                Some(1),
9326                Some(35),
9327                &helpers::child_path(path, "ToSeq"),
9328                config,
9329                collector,
9330            );
9331        }
9332        if let Some(ref val) = self.to_seq {
9333            helpers::validate_pattern(
9334                val,
9335                "ToSeq",
9336                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9337                &helpers::child_path(path, "ToSeq"),
9338                config,
9339                collector,
9340            );
9341        }
9342        if let Some(ref vec) = self.fr_to_seq
9343            && config.validate_optional_fields
9344        {
9345            for item in vec {
9346                item.validate(&helpers::child_path(path, "FrToSeq"), config, collector);
9347            }
9348        }
9349        if let Some(ref vec) = self.eq_seq {
9350            for item in vec {
9351                helpers::validate_length(
9352                    item,
9353                    "EQSeq",
9354                    Some(1),
9355                    Some(35),
9356                    &helpers::child_path(path, "EQSeq"),
9357                    config,
9358                    collector,
9359                );
9360            }
9361        }
9362        if let Some(ref vec) = self.eq_seq {
9363            for item in vec {
9364                helpers::validate_pattern(
9365                    item,
9366                    "EQSeq",
9367                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9368                    &helpers::child_path(path, "EQSeq"),
9369                    config,
9370                    collector,
9371                );
9372            }
9373        }
9374        if let Some(ref vec) = self.neq_seq {
9375            for item in vec {
9376                helpers::validate_length(
9377                    item,
9378                    "NEQSeq",
9379                    Some(1),
9380                    Some(35),
9381                    &helpers::child_path(path, "NEQSeq"),
9382                    config,
9383                    collector,
9384                );
9385            }
9386        }
9387        if let Some(ref vec) = self.neq_seq {
9388            for item in vec {
9389                helpers::validate_pattern(
9390                    item,
9391                    "NEQSeq",
9392                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9393                    &helpers::child_path(path, "NEQSeq"),
9394                    config,
9395                    collector,
9396                );
9397            }
9398        }
9399    }
9400}
9401
9402// SequenceRange11: End sequence of the range.
9403#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9404pub struct SequenceRange11 {
9405    #[serde(rename = "FrSeq")]
9406    pub fr_seq: String,
9407    #[serde(rename = "ToSeq")]
9408    pub to_seq: String,
9409}
9410
9411impl Validate for SequenceRange11 {
9412    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9413        helpers::validate_length(
9414            &self.fr_seq,
9415            "FrSeq",
9416            Some(1),
9417            Some(35),
9418            &helpers::child_path(path, "FrSeq"),
9419            config,
9420            collector,
9421        );
9422        helpers::validate_pattern(
9423            &self.fr_seq,
9424            "FrSeq",
9425            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9426            &helpers::child_path(path, "FrSeq"),
9427            config,
9428            collector,
9429        );
9430        helpers::validate_length(
9431            &self.to_seq,
9432            "ToSeq",
9433            Some(1),
9434            Some(35),
9435            &helpers::child_path(path, "ToSeq"),
9436            config,
9437            collector,
9438        );
9439        helpers::validate_pattern(
9440            &self.to_seq,
9441            "ToSeq",
9442            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9443            &helpers::child_path(path, "ToSeq"),
9444            config,
9445            collector,
9446        );
9447    }
9448}
9449
9450// StructuredRemittanceInformation161: Additional information, in free text form, to complement the structured remittance information.
9451#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9452pub struct StructuredRemittanceInformation161 {
9453    #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
9454    pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
9455    #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
9456    pub rfrd_doc_amt: Option<RemittanceAmount21>,
9457    #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
9458    pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
9459    #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
9460    pub invcr: Option<PartyIdentification1353>,
9461    #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
9462    pub invcee: Option<PartyIdentification1353>,
9463    #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
9464    pub tax_rmt: Option<TaxInformation71>,
9465    #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
9466    pub grnshmt_rmt: Option<Garnishment31>,
9467    #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
9468    pub addtl_rmt_inf: Option<Vec<String>>,
9469}
9470
9471impl Validate for StructuredRemittanceInformation161 {
9472    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9473        if let Some(ref vec) = self.rfrd_doc_inf
9474            && config.validate_optional_fields
9475        {
9476            for item in vec {
9477                item.validate(&helpers::child_path(path, "RfrdDocInf"), config, collector);
9478            }
9479        }
9480        if let Some(ref val) = self.rfrd_doc_amt
9481            && config.validate_optional_fields
9482        {
9483            val.validate(&helpers::child_path(path, "RfrdDocAmt"), config, collector);
9484        }
9485        if let Some(ref val) = self.cdtr_ref_inf
9486            && config.validate_optional_fields
9487        {
9488            val.validate(&helpers::child_path(path, "CdtrRefInf"), config, collector);
9489        }
9490        if let Some(ref val) = self.invcr
9491            && config.validate_optional_fields
9492        {
9493            val.validate(&helpers::child_path(path, "Invcr"), config, collector);
9494        }
9495        if let Some(ref val) = self.invcee
9496            && config.validate_optional_fields
9497        {
9498            val.validate(&helpers::child_path(path, "Invcee"), config, collector);
9499        }
9500        if let Some(ref val) = self.tax_rmt
9501            && config.validate_optional_fields
9502        {
9503            val.validate(&helpers::child_path(path, "TaxRmt"), config, collector);
9504        }
9505        if let Some(ref val) = self.grnshmt_rmt
9506            && config.validate_optional_fields
9507        {
9508            val.validate(&helpers::child_path(path, "GrnshmtRmt"), config, collector);
9509        }
9510        if let Some(ref vec) = self.addtl_rmt_inf {
9511            for item in vec {
9512                helpers::validate_length(
9513                    item,
9514                    "AddtlRmtInf",
9515                    Some(1),
9516                    Some(140),
9517                    &helpers::child_path(path, "AddtlRmtInf"),
9518                    config,
9519                    collector,
9520                );
9521            }
9522        }
9523        if let Some(ref vec) = self.addtl_rmt_inf {
9524            for item in vec {
9525                helpers::validate_pattern(
9526                    item,
9527                    "AddtlRmtInf",
9528                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9529                    &helpers::child_path(path, "AddtlRmtInf"),
9530                    config,
9531                    collector,
9532                );
9533            }
9534        }
9535    }
9536}
9537
9538// TaxAmount2: Set of elements used to provide details on the tax period and amount.
9539#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9540pub struct TaxAmount2 {
9541    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9542    pub rate: Option<f64>,
9543    #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
9544    pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9545    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
9546    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9547    #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
9548    pub dtls: Option<Vec<TaxRecordDetails2>>,
9549}
9550
9551impl Validate for TaxAmount2 {
9552    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9553        if let Some(ref val) = self.taxbl_base_amt
9554            && config.validate_optional_fields
9555        {
9556            val.validate(
9557                &helpers::child_path(path, "TaxblBaseAmt"),
9558                config,
9559                collector,
9560            );
9561        }
9562        if let Some(ref val) = self.ttl_amt
9563            && config.validate_optional_fields
9564        {
9565            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
9566        }
9567        if let Some(ref vec) = self.dtls
9568            && config.validate_optional_fields
9569        {
9570            for item in vec {
9571                item.validate(&helpers::child_path(path, "Dtls"), config, collector);
9572            }
9573        }
9574    }
9575}
9576
9577// TaxAmountAndType1: Amount of money, which has been typed.
9578#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9579pub struct TaxAmountAndType1 {
9580    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9581    pub tp: Option<TaxAmountType1Choice>,
9582    #[serde(rename = "Amt")]
9583    pub amt: ActiveOrHistoricCurrencyAndAmount,
9584}
9585
9586impl Validate for TaxAmountAndType1 {
9587    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9588        if let Some(ref val) = self.tp
9589            && config.validate_optional_fields
9590        {
9591            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9592        }
9593        self.amt
9594            .validate(&helpers::child_path(path, "Amt"), config, collector);
9595    }
9596}
9597
9598// TaxAmountAndType11: Amount of money, which has been typed.
9599#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9600pub struct TaxAmountAndType11 {
9601    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9602    pub tp: Option<TaxAmountType1Choice1>,
9603    #[serde(rename = "Amt")]
9604    pub amt: ActiveOrHistoricCurrencyAndAmount,
9605}
9606
9607impl Validate for TaxAmountAndType11 {
9608    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9609        if let Some(ref val) = self.tp
9610            && config.validate_optional_fields
9611        {
9612            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9613        }
9614        self.amt
9615            .validate(&helpers::child_path(path, "Amt"), config, collector);
9616    }
9617}
9618
9619// TaxAmountType1Choice: Specifies the amount type, in a free-text form.
9620#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9621pub struct TaxAmountType1Choice {
9622    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9623    pub cd: Option<String>,
9624    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9625    pub prtry: Option<String>,
9626}
9627
9628impl Validate for TaxAmountType1Choice {
9629    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9630        if let Some(ref val) = self.cd {
9631            helpers::validate_length(
9632                val,
9633                "Cd",
9634                Some(1),
9635                Some(4),
9636                &helpers::child_path(path, "Cd"),
9637                config,
9638                collector,
9639            );
9640        }
9641        if let Some(ref val) = self.prtry {
9642            helpers::validate_length(
9643                val,
9644                "Prtry",
9645                Some(1),
9646                Some(35),
9647                &helpers::child_path(path, "Prtry"),
9648                config,
9649                collector,
9650            );
9651        }
9652    }
9653}
9654
9655// TaxAmountType1Choice1: Specifies the amount type, in a free-text form.
9656#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9657pub struct TaxAmountType1Choice1 {
9658    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9659    pub cd: Option<String>,
9660    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9661    pub prtry: Option<String>,
9662}
9663
9664impl Validate for TaxAmountType1Choice1 {
9665    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9666        if let Some(ref val) = self.cd {
9667            helpers::validate_length(
9668                val,
9669                "Cd",
9670                Some(1),
9671                Some(4),
9672                &helpers::child_path(path, "Cd"),
9673                config,
9674                collector,
9675            );
9676        }
9677        if let Some(ref val) = self.prtry {
9678            helpers::validate_length(
9679                val,
9680                "Prtry",
9681                Some(1),
9682                Some(35),
9683                &helpers::child_path(path, "Prtry"),
9684                config,
9685                collector,
9686            );
9687        }
9688        if let Some(ref val) = self.prtry {
9689            helpers::validate_pattern(
9690                val,
9691                "Prtry",
9692                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9693                &helpers::child_path(path, "Prtry"),
9694                config,
9695                collector,
9696            );
9697        }
9698    }
9699}
9700
9701// TaxAuthorisation11: Name of the debtor or the debtor's authorised representative.
9702#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9703pub struct TaxAuthorisation11 {
9704    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
9705    pub titl: Option<String>,
9706    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9707    pub nm: Option<String>,
9708}
9709
9710impl Validate for TaxAuthorisation11 {
9711    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9712        if let Some(ref val) = self.titl {
9713            helpers::validate_length(
9714                val,
9715                "Titl",
9716                Some(1),
9717                Some(35),
9718                &helpers::child_path(path, "Titl"),
9719                config,
9720                collector,
9721            );
9722        }
9723        if let Some(ref val) = self.titl {
9724            helpers::validate_pattern(
9725                val,
9726                "Titl",
9727                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9728                &helpers::child_path(path, "Titl"),
9729                config,
9730                collector,
9731            );
9732        }
9733        if let Some(ref val) = self.nm {
9734            helpers::validate_length(
9735                val,
9736                "Nm",
9737                Some(1),
9738                Some(140),
9739                &helpers::child_path(path, "Nm"),
9740                config,
9741                collector,
9742            );
9743        }
9744        if let Some(ref val) = self.nm {
9745            helpers::validate_pattern(
9746                val,
9747                "Nm",
9748                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9749                &helpers::child_path(path, "Nm"),
9750                config,
9751                collector,
9752            );
9753        }
9754    }
9755}
9756
9757// TaxAuthorisation12: Name of the debtor or the debtor's authorised representative.
9758#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9759pub struct TaxAuthorisation12 {
9760    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
9761    pub titl: Option<String>,
9762    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9763    pub nm: Option<String>,
9764}
9765
9766impl Validate for TaxAuthorisation12 {
9767    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9768        if let Some(ref val) = self.titl {
9769            helpers::validate_length(
9770                val,
9771                "Titl",
9772                Some(1),
9773                Some(35),
9774                &helpers::child_path(path, "Titl"),
9775                config,
9776                collector,
9777            );
9778        }
9779        if let Some(ref val) = self.titl {
9780            helpers::validate_pattern(
9781                val,
9782                "Titl",
9783                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9784                &helpers::child_path(path, "Titl"),
9785                config,
9786                collector,
9787            );
9788        }
9789        if let Some(ref val) = self.nm {
9790            helpers::validate_length(
9791                val,
9792                "Nm",
9793                Some(1),
9794                Some(140),
9795                &helpers::child_path(path, "Nm"),
9796                config,
9797                collector,
9798            );
9799        }
9800        if let Some(ref val) = self.nm {
9801            helpers::validate_pattern(
9802                val,
9803                "Nm",
9804                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9805                &helpers::child_path(path, "Nm"),
9806                config,
9807                collector,
9808            );
9809        }
9810    }
9811}
9812
9813// TaxCharges21: Amount of money resulting from the calculation of the tax.
9814#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9815pub struct TaxCharges21 {
9816    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
9817    pub id: Option<String>,
9818    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9819    pub rate: Option<f64>,
9820    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
9821    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9822}
9823
9824impl Validate for TaxCharges21 {
9825    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9826        if let Some(ref val) = self.id {
9827            helpers::validate_length(
9828                val,
9829                "Id",
9830                Some(1),
9831                Some(35),
9832                &helpers::child_path(path, "Id"),
9833                config,
9834                collector,
9835            );
9836        }
9837        if let Some(ref val) = self.id {
9838            helpers::validate_pattern(
9839                val,
9840                "Id",
9841                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9842                &helpers::child_path(path, "Id"),
9843                config,
9844                collector,
9845            );
9846        }
9847        if let Some(ref val) = self.amt
9848            && config.validate_optional_fields
9849        {
9850            val.validate(&helpers::child_path(path, "Amt"), config, collector);
9851        }
9852    }
9853}
9854
9855// TaxInformation71: Record of tax details.
9856#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9857pub struct TaxInformation71 {
9858    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
9859    pub cdtr: Option<TaxParty11>,
9860    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
9861    pub dbtr: Option<TaxParty21>,
9862    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
9863    pub ultmt_dbtr: Option<TaxParty21>,
9864    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
9865    pub admstn_zone: Option<String>,
9866    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
9867    pub ref_nb: Option<String>,
9868    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
9869    pub mtd: Option<String>,
9870    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
9871    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9872    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
9873    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9874    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
9875    pub dt: Option<String>,
9876    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
9877    pub seq_nb: Option<f64>,
9878    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
9879    pub rcrd: Option<Vec<TaxRecord21>>,
9880}
9881
9882impl Validate for TaxInformation71 {
9883    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9884        if let Some(ref val) = self.cdtr
9885            && config.validate_optional_fields
9886        {
9887            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
9888        }
9889        if let Some(ref val) = self.dbtr
9890            && config.validate_optional_fields
9891        {
9892            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
9893        }
9894        if let Some(ref val) = self.ultmt_dbtr
9895            && config.validate_optional_fields
9896        {
9897            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
9898        }
9899        if let Some(ref val) = self.admstn_zone {
9900            helpers::validate_length(
9901                val,
9902                "AdmstnZone",
9903                Some(1),
9904                Some(35),
9905                &helpers::child_path(path, "AdmstnZone"),
9906                config,
9907                collector,
9908            );
9909        }
9910        if let Some(ref val) = self.admstn_zone {
9911            helpers::validate_pattern(
9912                val,
9913                "AdmstnZone",
9914                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9915                &helpers::child_path(path, "AdmstnZone"),
9916                config,
9917                collector,
9918            );
9919        }
9920        if let Some(ref val) = self.ref_nb {
9921            helpers::validate_length(
9922                val,
9923                "RefNb",
9924                Some(1),
9925                Some(140),
9926                &helpers::child_path(path, "RefNb"),
9927                config,
9928                collector,
9929            );
9930        }
9931        if let Some(ref val) = self.ref_nb {
9932            helpers::validate_pattern(
9933                val,
9934                "RefNb",
9935                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9936                &helpers::child_path(path, "RefNb"),
9937                config,
9938                collector,
9939            );
9940        }
9941        if let Some(ref val) = self.mtd {
9942            helpers::validate_length(
9943                val,
9944                "Mtd",
9945                Some(1),
9946                Some(35),
9947                &helpers::child_path(path, "Mtd"),
9948                config,
9949                collector,
9950            );
9951        }
9952        if let Some(ref val) = self.mtd {
9953            helpers::validate_pattern(
9954                val,
9955                "Mtd",
9956                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9957                &helpers::child_path(path, "Mtd"),
9958                config,
9959                collector,
9960            );
9961        }
9962        if let Some(ref val) = self.ttl_taxbl_base_amt
9963            && config.validate_optional_fields
9964        {
9965            val.validate(
9966                &helpers::child_path(path, "TtlTaxblBaseAmt"),
9967                config,
9968                collector,
9969            );
9970        }
9971        if let Some(ref val) = self.ttl_tax_amt
9972            && config.validate_optional_fields
9973        {
9974            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
9975        }
9976        if let Some(ref vec) = self.rcrd
9977            && config.validate_optional_fields
9978        {
9979            for item in vec {
9980                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
9981            }
9982        }
9983    }
9984}
9985
9986// TaxInformation81: Record of tax details.
9987#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9988pub struct TaxInformation81 {
9989    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
9990    pub cdtr: Option<TaxParty12>,
9991    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
9992    pub dbtr: Option<TaxParty22>,
9993    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
9994    pub admstn_zone: Option<String>,
9995    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
9996    pub ref_nb: Option<String>,
9997    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
9998    pub mtd: Option<String>,
9999    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
10000    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10001    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
10002    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10003    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
10004    pub dt: Option<String>,
10005    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
10006    pub seq_nb: Option<f64>,
10007    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
10008    pub rcrd: Option<Vec<TaxRecord22>>,
10009}
10010
10011impl Validate for TaxInformation81 {
10012    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10013        if let Some(ref val) = self.cdtr
10014            && config.validate_optional_fields
10015        {
10016            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
10017        }
10018        if let Some(ref val) = self.dbtr
10019            && config.validate_optional_fields
10020        {
10021            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
10022        }
10023        if let Some(ref val) = self.admstn_zone {
10024            helpers::validate_length(
10025                val,
10026                "AdmstnZone",
10027                Some(1),
10028                Some(35),
10029                &helpers::child_path(path, "AdmstnZone"),
10030                config,
10031                collector,
10032            );
10033        }
10034        if let Some(ref val) = self.admstn_zone {
10035            helpers::validate_pattern(
10036                val,
10037                "AdmstnZone",
10038                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10039                &helpers::child_path(path, "AdmstnZone"),
10040                config,
10041                collector,
10042            );
10043        }
10044        if let Some(ref val) = self.ref_nb {
10045            helpers::validate_length(
10046                val,
10047                "RefNb",
10048                Some(1),
10049                Some(140),
10050                &helpers::child_path(path, "RefNb"),
10051                config,
10052                collector,
10053            );
10054        }
10055        if let Some(ref val) = self.ref_nb {
10056            helpers::validate_pattern(
10057                val,
10058                "RefNb",
10059                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10060                &helpers::child_path(path, "RefNb"),
10061                config,
10062                collector,
10063            );
10064        }
10065        if let Some(ref val) = self.mtd {
10066            helpers::validate_length(
10067                val,
10068                "Mtd",
10069                Some(1),
10070                Some(35),
10071                &helpers::child_path(path, "Mtd"),
10072                config,
10073                collector,
10074            );
10075        }
10076        if let Some(ref val) = self.mtd {
10077            helpers::validate_pattern(
10078                val,
10079                "Mtd",
10080                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10081                &helpers::child_path(path, "Mtd"),
10082                config,
10083                collector,
10084            );
10085        }
10086        if let Some(ref val) = self.ttl_taxbl_base_amt
10087            && config.validate_optional_fields
10088        {
10089            val.validate(
10090                &helpers::child_path(path, "TtlTaxblBaseAmt"),
10091                config,
10092                collector,
10093            );
10094        }
10095        if let Some(ref val) = self.ttl_tax_amt
10096            && config.validate_optional_fields
10097        {
10098            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
10099        }
10100        if let Some(ref vec) = self.rcrd
10101            && config.validate_optional_fields
10102        {
10103            for item in vec {
10104                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
10105            }
10106        }
10107    }
10108}
10109
10110// TaxParty11: Type of tax payer.
10111#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10112pub struct TaxParty11 {
10113    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10114    pub tax_id: Option<String>,
10115    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10116    pub regn_id: Option<String>,
10117    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10118    pub tax_tp: Option<String>,
10119}
10120
10121impl Validate for TaxParty11 {
10122    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10123        if let Some(ref val) = self.tax_id {
10124            helpers::validate_length(
10125                val,
10126                "TaxId",
10127                Some(1),
10128                Some(35),
10129                &helpers::child_path(path, "TaxId"),
10130                config,
10131                collector,
10132            );
10133        }
10134        if let Some(ref val) = self.tax_id {
10135            helpers::validate_pattern(
10136                val,
10137                "TaxId",
10138                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10139                &helpers::child_path(path, "TaxId"),
10140                config,
10141                collector,
10142            );
10143        }
10144        if let Some(ref val) = self.regn_id {
10145            helpers::validate_length(
10146                val,
10147                "RegnId",
10148                Some(1),
10149                Some(35),
10150                &helpers::child_path(path, "RegnId"),
10151                config,
10152                collector,
10153            );
10154        }
10155        if let Some(ref val) = self.regn_id {
10156            helpers::validate_pattern(
10157                val,
10158                "RegnId",
10159                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10160                &helpers::child_path(path, "RegnId"),
10161                config,
10162                collector,
10163            );
10164        }
10165        if let Some(ref val) = self.tax_tp {
10166            helpers::validate_length(
10167                val,
10168                "TaxTp",
10169                Some(1),
10170                Some(35),
10171                &helpers::child_path(path, "TaxTp"),
10172                config,
10173                collector,
10174            );
10175        }
10176        if let Some(ref val) = self.tax_tp {
10177            helpers::validate_pattern(
10178                val,
10179                "TaxTp",
10180                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10181                &helpers::child_path(path, "TaxTp"),
10182                config,
10183                collector,
10184            );
10185        }
10186    }
10187}
10188
10189// TaxParty12: Type of tax payer.
10190#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10191pub struct TaxParty12 {
10192    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10193    pub tax_id: Option<String>,
10194    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10195    pub regn_id: Option<String>,
10196    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10197    pub tax_tp: Option<String>,
10198}
10199
10200impl Validate for TaxParty12 {
10201    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10202        if let Some(ref val) = self.tax_id {
10203            helpers::validate_length(
10204                val,
10205                "TaxId",
10206                Some(1),
10207                Some(35),
10208                &helpers::child_path(path, "TaxId"),
10209                config,
10210                collector,
10211            );
10212        }
10213        if let Some(ref val) = self.tax_id {
10214            helpers::validate_pattern(
10215                val,
10216                "TaxId",
10217                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10218                &helpers::child_path(path, "TaxId"),
10219                config,
10220                collector,
10221            );
10222        }
10223        if let Some(ref val) = self.regn_id {
10224            helpers::validate_length(
10225                val,
10226                "RegnId",
10227                Some(1),
10228                Some(35),
10229                &helpers::child_path(path, "RegnId"),
10230                config,
10231                collector,
10232            );
10233        }
10234        if let Some(ref val) = self.regn_id {
10235            helpers::validate_pattern(
10236                val,
10237                "RegnId",
10238                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10239                &helpers::child_path(path, "RegnId"),
10240                config,
10241                collector,
10242            );
10243        }
10244        if let Some(ref val) = self.tax_tp {
10245            helpers::validate_length(
10246                val,
10247                "TaxTp",
10248                Some(1),
10249                Some(35),
10250                &helpers::child_path(path, "TaxTp"),
10251                config,
10252                collector,
10253            );
10254        }
10255        if let Some(ref val) = self.tax_tp {
10256            helpers::validate_pattern(
10257                val,
10258                "TaxTp",
10259                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10260                &helpers::child_path(path, "TaxTp"),
10261                config,
10262                collector,
10263            );
10264        }
10265    }
10266}
10267
10268// TaxParty21: Details of the authorised tax paying party.
10269#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10270pub struct TaxParty21 {
10271    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10272    pub tax_id: Option<String>,
10273    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10274    pub regn_id: Option<String>,
10275    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10276    pub tax_tp: Option<String>,
10277    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
10278    pub authstn: Option<TaxAuthorisation11>,
10279}
10280
10281impl Validate for TaxParty21 {
10282    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10283        if let Some(ref val) = self.tax_id {
10284            helpers::validate_length(
10285                val,
10286                "TaxId",
10287                Some(1),
10288                Some(35),
10289                &helpers::child_path(path, "TaxId"),
10290                config,
10291                collector,
10292            );
10293        }
10294        if let Some(ref val) = self.tax_id {
10295            helpers::validate_pattern(
10296                val,
10297                "TaxId",
10298                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10299                &helpers::child_path(path, "TaxId"),
10300                config,
10301                collector,
10302            );
10303        }
10304        if let Some(ref val) = self.regn_id {
10305            helpers::validate_length(
10306                val,
10307                "RegnId",
10308                Some(1),
10309                Some(35),
10310                &helpers::child_path(path, "RegnId"),
10311                config,
10312                collector,
10313            );
10314        }
10315        if let Some(ref val) = self.regn_id {
10316            helpers::validate_pattern(
10317                val,
10318                "RegnId",
10319                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10320                &helpers::child_path(path, "RegnId"),
10321                config,
10322                collector,
10323            );
10324        }
10325        if let Some(ref val) = self.tax_tp {
10326            helpers::validate_length(
10327                val,
10328                "TaxTp",
10329                Some(1),
10330                Some(35),
10331                &helpers::child_path(path, "TaxTp"),
10332                config,
10333                collector,
10334            );
10335        }
10336        if let Some(ref val) = self.tax_tp {
10337            helpers::validate_pattern(
10338                val,
10339                "TaxTp",
10340                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10341                &helpers::child_path(path, "TaxTp"),
10342                config,
10343                collector,
10344            );
10345        }
10346        if let Some(ref val) = self.authstn
10347            && config.validate_optional_fields
10348        {
10349            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
10350        }
10351    }
10352}
10353
10354// TaxParty22: Details of the authorised tax paying party.
10355#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10356pub struct TaxParty22 {
10357    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10358    pub tax_id: Option<String>,
10359    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10360    pub regn_id: Option<String>,
10361    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10362    pub tax_tp: Option<String>,
10363    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
10364    pub authstn: Option<TaxAuthorisation12>,
10365}
10366
10367impl Validate for TaxParty22 {
10368    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10369        if let Some(ref val) = self.tax_id {
10370            helpers::validate_length(
10371                val,
10372                "TaxId",
10373                Some(1),
10374                Some(35),
10375                &helpers::child_path(path, "TaxId"),
10376                config,
10377                collector,
10378            );
10379        }
10380        if let Some(ref val) = self.tax_id {
10381            helpers::validate_pattern(
10382                val,
10383                "TaxId",
10384                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10385                &helpers::child_path(path, "TaxId"),
10386                config,
10387                collector,
10388            );
10389        }
10390        if let Some(ref val) = self.regn_id {
10391            helpers::validate_length(
10392                val,
10393                "RegnId",
10394                Some(1),
10395                Some(35),
10396                &helpers::child_path(path, "RegnId"),
10397                config,
10398                collector,
10399            );
10400        }
10401        if let Some(ref val) = self.regn_id {
10402            helpers::validate_pattern(
10403                val,
10404                "RegnId",
10405                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10406                &helpers::child_path(path, "RegnId"),
10407                config,
10408                collector,
10409            );
10410        }
10411        if let Some(ref val) = self.tax_tp {
10412            helpers::validate_length(
10413                val,
10414                "TaxTp",
10415                Some(1),
10416                Some(35),
10417                &helpers::child_path(path, "TaxTp"),
10418                config,
10419                collector,
10420            );
10421        }
10422        if let Some(ref val) = self.tax_tp {
10423            helpers::validate_pattern(
10424                val,
10425                "TaxTp",
10426                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10427                &helpers::child_path(path, "TaxTp"),
10428                config,
10429                collector,
10430            );
10431        }
10432        if let Some(ref val) = self.authstn
10433            && config.validate_optional_fields
10434        {
10435            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
10436        }
10437    }
10438}
10439
10440// TaxPeriod2: Range of time between a start date and an end date for which the tax report is provided.
10441#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10442pub struct TaxPeriod2 {
10443    #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
10444    pub yr: Option<String>,
10445    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10446    pub tp: Option<TaxRecordPeriod1Code>,
10447    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
10448    pub fr_to_dt: Option<DatePeriod2>,
10449}
10450
10451impl Validate for TaxPeriod2 {
10452    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10453        if let Some(ref val) = self.tp
10454            && config.validate_optional_fields
10455        {
10456            val.validate(&helpers::child_path(path, "Tp"), config, collector);
10457        }
10458        if let Some(ref val) = self.fr_to_dt
10459            && config.validate_optional_fields
10460        {
10461            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
10462        }
10463    }
10464}
10465
10466// TaxRecord21: Further details of the tax record.
10467#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10468pub struct TaxRecord21 {
10469    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10470    pub tp: Option<String>,
10471    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
10472    pub ctgy: Option<String>,
10473    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
10474    pub ctgy_dtls: Option<String>,
10475    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
10476    pub dbtr_sts: Option<String>,
10477    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
10478    pub cert_id: Option<String>,
10479    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
10480    pub frms_cd: Option<String>,
10481    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10482    pub prd: Option<TaxPeriod2>,
10483    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10484    pub tax_amt: Option<TaxAmount2>,
10485    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
10486    pub addtl_inf: Option<String>,
10487}
10488
10489impl Validate for TaxRecord21 {
10490    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10491        if let Some(ref val) = self.tp {
10492            helpers::validate_length(
10493                val,
10494                "Tp",
10495                Some(1),
10496                Some(35),
10497                &helpers::child_path(path, "Tp"),
10498                config,
10499                collector,
10500            );
10501        }
10502        if let Some(ref val) = self.tp {
10503            helpers::validate_pattern(
10504                val,
10505                "Tp",
10506                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10507                &helpers::child_path(path, "Tp"),
10508                config,
10509                collector,
10510            );
10511        }
10512        if let Some(ref val) = self.ctgy {
10513            helpers::validate_length(
10514                val,
10515                "Ctgy",
10516                Some(1),
10517                Some(35),
10518                &helpers::child_path(path, "Ctgy"),
10519                config,
10520                collector,
10521            );
10522        }
10523        if let Some(ref val) = self.ctgy {
10524            helpers::validate_pattern(
10525                val,
10526                "Ctgy",
10527                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10528                &helpers::child_path(path, "Ctgy"),
10529                config,
10530                collector,
10531            );
10532        }
10533        if let Some(ref val) = self.ctgy_dtls {
10534            helpers::validate_length(
10535                val,
10536                "CtgyDtls",
10537                Some(1),
10538                Some(35),
10539                &helpers::child_path(path, "CtgyDtls"),
10540                config,
10541                collector,
10542            );
10543        }
10544        if let Some(ref val) = self.ctgy_dtls {
10545            helpers::validate_pattern(
10546                val,
10547                "CtgyDtls",
10548                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10549                &helpers::child_path(path, "CtgyDtls"),
10550                config,
10551                collector,
10552            );
10553        }
10554        if let Some(ref val) = self.dbtr_sts {
10555            helpers::validate_length(
10556                val,
10557                "DbtrSts",
10558                Some(1),
10559                Some(35),
10560                &helpers::child_path(path, "DbtrSts"),
10561                config,
10562                collector,
10563            );
10564        }
10565        if let Some(ref val) = self.dbtr_sts {
10566            helpers::validate_pattern(
10567                val,
10568                "DbtrSts",
10569                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10570                &helpers::child_path(path, "DbtrSts"),
10571                config,
10572                collector,
10573            );
10574        }
10575        if let Some(ref val) = self.cert_id {
10576            helpers::validate_length(
10577                val,
10578                "CertId",
10579                Some(1),
10580                Some(35),
10581                &helpers::child_path(path, "CertId"),
10582                config,
10583                collector,
10584            );
10585        }
10586        if let Some(ref val) = self.cert_id {
10587            helpers::validate_pattern(
10588                val,
10589                "CertId",
10590                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10591                &helpers::child_path(path, "CertId"),
10592                config,
10593                collector,
10594            );
10595        }
10596        if let Some(ref val) = self.frms_cd {
10597            helpers::validate_length(
10598                val,
10599                "FrmsCd",
10600                Some(1),
10601                Some(35),
10602                &helpers::child_path(path, "FrmsCd"),
10603                config,
10604                collector,
10605            );
10606        }
10607        if let Some(ref val) = self.frms_cd {
10608            helpers::validate_pattern(
10609                val,
10610                "FrmsCd",
10611                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10612                &helpers::child_path(path, "FrmsCd"),
10613                config,
10614                collector,
10615            );
10616        }
10617        if let Some(ref val) = self.prd
10618            && config.validate_optional_fields
10619        {
10620            val.validate(&helpers::child_path(path, "Prd"), config, collector);
10621        }
10622        if let Some(ref val) = self.tax_amt
10623            && config.validate_optional_fields
10624        {
10625            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
10626        }
10627        if let Some(ref val) = self.addtl_inf {
10628            helpers::validate_length(
10629                val,
10630                "AddtlInf",
10631                Some(1),
10632                Some(140),
10633                &helpers::child_path(path, "AddtlInf"),
10634                config,
10635                collector,
10636            );
10637        }
10638        if let Some(ref val) = self.addtl_inf {
10639            helpers::validate_pattern(
10640                val,
10641                "AddtlInf",
10642                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10643                &helpers::child_path(path, "AddtlInf"),
10644                config,
10645                collector,
10646            );
10647        }
10648    }
10649}
10650
10651// TaxRecord22: Further details of the tax record.
10652#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10653pub struct TaxRecord22 {
10654    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10655    pub tp: Option<String>,
10656    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
10657    pub ctgy: Option<String>,
10658    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
10659    pub ctgy_dtls: Option<String>,
10660    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
10661    pub dbtr_sts: Option<String>,
10662    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
10663    pub cert_id: Option<String>,
10664    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
10665    pub frms_cd: Option<String>,
10666    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10667    pub prd: Option<TaxPeriod2>,
10668    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10669    pub tax_amt: Option<TaxAmount2>,
10670    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
10671    pub addtl_inf: Option<String>,
10672}
10673
10674impl Validate for TaxRecord22 {
10675    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10676        if let Some(ref val) = self.tp {
10677            helpers::validate_length(
10678                val,
10679                "Tp",
10680                Some(1),
10681                Some(35),
10682                &helpers::child_path(path, "Tp"),
10683                config,
10684                collector,
10685            );
10686        }
10687        if let Some(ref val) = self.tp {
10688            helpers::validate_pattern(
10689                val,
10690                "Tp",
10691                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10692                &helpers::child_path(path, "Tp"),
10693                config,
10694                collector,
10695            );
10696        }
10697        if let Some(ref val) = self.ctgy {
10698            helpers::validate_length(
10699                val,
10700                "Ctgy",
10701                Some(1),
10702                Some(35),
10703                &helpers::child_path(path, "Ctgy"),
10704                config,
10705                collector,
10706            );
10707        }
10708        if let Some(ref val) = self.ctgy {
10709            helpers::validate_pattern(
10710                val,
10711                "Ctgy",
10712                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10713                &helpers::child_path(path, "Ctgy"),
10714                config,
10715                collector,
10716            );
10717        }
10718        if let Some(ref val) = self.ctgy_dtls {
10719            helpers::validate_length(
10720                val,
10721                "CtgyDtls",
10722                Some(1),
10723                Some(35),
10724                &helpers::child_path(path, "CtgyDtls"),
10725                config,
10726                collector,
10727            );
10728        }
10729        if let Some(ref val) = self.ctgy_dtls {
10730            helpers::validate_pattern(
10731                val,
10732                "CtgyDtls",
10733                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10734                &helpers::child_path(path, "CtgyDtls"),
10735                config,
10736                collector,
10737            );
10738        }
10739        if let Some(ref val) = self.dbtr_sts {
10740            helpers::validate_length(
10741                val,
10742                "DbtrSts",
10743                Some(1),
10744                Some(35),
10745                &helpers::child_path(path, "DbtrSts"),
10746                config,
10747                collector,
10748            );
10749        }
10750        if let Some(ref val) = self.dbtr_sts {
10751            helpers::validate_pattern(
10752                val,
10753                "DbtrSts",
10754                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10755                &helpers::child_path(path, "DbtrSts"),
10756                config,
10757                collector,
10758            );
10759        }
10760        if let Some(ref val) = self.cert_id {
10761            helpers::validate_length(
10762                val,
10763                "CertId",
10764                Some(1),
10765                Some(35),
10766                &helpers::child_path(path, "CertId"),
10767                config,
10768                collector,
10769            );
10770        }
10771        if let Some(ref val) = self.cert_id {
10772            helpers::validate_pattern(
10773                val,
10774                "CertId",
10775                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10776                &helpers::child_path(path, "CertId"),
10777                config,
10778                collector,
10779            );
10780        }
10781        if let Some(ref val) = self.frms_cd {
10782            helpers::validate_length(
10783                val,
10784                "FrmsCd",
10785                Some(1),
10786                Some(35),
10787                &helpers::child_path(path, "FrmsCd"),
10788                config,
10789                collector,
10790            );
10791        }
10792        if let Some(ref val) = self.frms_cd {
10793            helpers::validate_pattern(
10794                val,
10795                "FrmsCd",
10796                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10797                &helpers::child_path(path, "FrmsCd"),
10798                config,
10799                collector,
10800            );
10801        }
10802        if let Some(ref val) = self.prd
10803            && config.validate_optional_fields
10804        {
10805            val.validate(&helpers::child_path(path, "Prd"), config, collector);
10806        }
10807        if let Some(ref val) = self.tax_amt
10808            && config.validate_optional_fields
10809        {
10810            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
10811        }
10812        if let Some(ref val) = self.addtl_inf {
10813            helpers::validate_length(
10814                val,
10815                "AddtlInf",
10816                Some(1),
10817                Some(140),
10818                &helpers::child_path(path, "AddtlInf"),
10819                config,
10820                collector,
10821            );
10822        }
10823        if let Some(ref val) = self.addtl_inf {
10824            helpers::validate_pattern(
10825                val,
10826                "AddtlInf",
10827                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10828                &helpers::child_path(path, "AddtlInf"),
10829                config,
10830                collector,
10831            );
10832        }
10833    }
10834}
10835
10836// TaxRecordDetails2: Underlying tax amount related to the specified period.
10837#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10838pub struct TaxRecordDetails2 {
10839    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10840    pub prd: Option<TaxPeriod2>,
10841    #[serde(rename = "Amt")]
10842    pub amt: ActiveOrHistoricCurrencyAndAmount,
10843}
10844
10845impl Validate for TaxRecordDetails2 {
10846    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10847        if let Some(ref val) = self.prd
10848            && config.validate_optional_fields
10849        {
10850            val.validate(&helpers::child_path(path, "Prd"), config, collector);
10851        }
10852        self.amt
10853            .validate(&helpers::child_path(path, "Amt"), config, collector);
10854    }
10855}
10856
10857// TaxRecordPeriod1Code: Tax is related to the second half of the period.
10858#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10859pub enum TaxRecordPeriod1Code {
10860    #[default]
10861    #[serde(rename = "MM01")]
10862    CodeMM01,
10863    #[serde(rename = "MM02")]
10864    CodeMM02,
10865    #[serde(rename = "MM03")]
10866    CodeMM03,
10867    #[serde(rename = "MM04")]
10868    CodeMM04,
10869    #[serde(rename = "MM05")]
10870    CodeMM05,
10871    #[serde(rename = "MM06")]
10872    CodeMM06,
10873    #[serde(rename = "MM07")]
10874    CodeMM07,
10875    #[serde(rename = "MM08")]
10876    CodeMM08,
10877    #[serde(rename = "MM09")]
10878    CodeMM09,
10879    #[serde(rename = "MM10")]
10880    CodeMM10,
10881    #[serde(rename = "MM11")]
10882    CodeMM11,
10883    #[serde(rename = "MM12")]
10884    CodeMM12,
10885    #[serde(rename = "QTR1")]
10886    CodeQTR1,
10887    #[serde(rename = "QTR2")]
10888    CodeQTR2,
10889    #[serde(rename = "QTR3")]
10890    CodeQTR3,
10891    #[serde(rename = "QTR4")]
10892    CodeQTR4,
10893    #[serde(rename = "HLF1")]
10894    CodeHLF1,
10895    #[serde(rename = "HLF2")]
10896    CodeHLF2,
10897}
10898
10899impl Validate for TaxRecordPeriod1Code {
10900    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
10901        // Enum validation is typically empty
10902    }
10903}
10904
10905// TechnicalInputChannel1Choice1: Technical channel used to input the instruction, in a proprietary form.
10906#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10907pub struct TechnicalInputChannel1Choice1 {
10908    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10909    pub cd: Option<String>,
10910    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10911    pub prtry: Option<String>,
10912}
10913
10914impl Validate for TechnicalInputChannel1Choice1 {
10915    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10916        if let Some(ref val) = self.cd {
10917            helpers::validate_length(
10918                val,
10919                "Cd",
10920                Some(1),
10921                Some(4),
10922                &helpers::child_path(path, "Cd"),
10923                config,
10924                collector,
10925            );
10926        }
10927        if let Some(ref val) = self.prtry {
10928            helpers::validate_length(
10929                val,
10930                "Prtry",
10931                Some(1),
10932                Some(35),
10933                &helpers::child_path(path, "Prtry"),
10934                config,
10935                collector,
10936            );
10937        }
10938        if let Some(ref val) = self.prtry {
10939            helpers::validate_pattern(
10940                val,
10941                "Prtry",
10942                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10943                &helpers::child_path(path, "Prtry"),
10944                config,
10945                collector,
10946            );
10947        }
10948    }
10949}
10950
10951// TotalTransactions61: Specifies the total number and sum of entries per bank transaction code.
10952#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10953pub struct TotalTransactions61 {
10954    #[serde(rename = "TtlNtries", skip_serializing_if = "Option::is_none")]
10955    pub ttl_ntries: Option<NumberAndSumOfTransactions4>,
10956    #[serde(rename = "TtlCdtNtries", skip_serializing_if = "Option::is_none")]
10957    pub ttl_cdt_ntries: Option<NumberAndSumOfTransactions1>,
10958    #[serde(rename = "TtlDbtNtries", skip_serializing_if = "Option::is_none")]
10959    pub ttl_dbt_ntries: Option<NumberAndSumOfTransactions1>,
10960    #[serde(rename = "TtlNtriesPerBkTxCd", skip_serializing_if = "Option::is_none")]
10961    pub ttl_ntries_per_bk_tx_cd: Option<Vec<TotalsPerBankTransactionCode51>>,
10962}
10963
10964impl Validate for TotalTransactions61 {
10965    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10966        if let Some(ref val) = self.ttl_ntries
10967            && config.validate_optional_fields
10968        {
10969            val.validate(&helpers::child_path(path, "TtlNtries"), config, collector);
10970        }
10971        if let Some(ref val) = self.ttl_cdt_ntries
10972            && config.validate_optional_fields
10973        {
10974            val.validate(
10975                &helpers::child_path(path, "TtlCdtNtries"),
10976                config,
10977                collector,
10978            );
10979        }
10980        if let Some(ref val) = self.ttl_dbt_ntries
10981            && config.validate_optional_fields
10982        {
10983            val.validate(
10984                &helpers::child_path(path, "TtlDbtNtries"),
10985                config,
10986                collector,
10987            );
10988        }
10989        if let Some(ref vec) = self.ttl_ntries_per_bk_tx_cd
10990            && config.validate_optional_fields
10991        {
10992            for item in vec {
10993                item.validate(
10994                    &helpers::child_path(path, "TtlNtriesPerBkTxCd"),
10995                    config,
10996                    collector,
10997                );
10998            }
10999        }
11000    }
11001}
11002
11003// TotalsPerBankTransactionCode51: Indicates the date (and time) of the transaction summary.
11004#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11005pub struct TotalsPerBankTransactionCode51 {
11006    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
11007    pub nb_of_ntries: Option<String>,
11008    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
11009    pub sum: Option<f64>,
11010    #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
11011    pub ttl_net_ntry: Option<AmountAndDirection35>,
11012    #[serde(rename = "CdtNtries", skip_serializing_if = "Option::is_none")]
11013    pub cdt_ntries: Option<NumberAndSumOfTransactions1>,
11014    #[serde(rename = "DbtNtries", skip_serializing_if = "Option::is_none")]
11015    pub dbt_ntries: Option<NumberAndSumOfTransactions1>,
11016    #[serde(rename = "FcstInd", skip_serializing_if = "Option::is_none")]
11017    pub fcst_ind: Option<bool>,
11018    #[serde(rename = "BkTxCd")]
11019    pub bk_tx_cd: BankTransactionCodeStructure41,
11020    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
11021    pub avlbty: Option<Vec<CashAvailability1>>,
11022    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
11023    pub dt: Option<DateAndDateTime2Choice1>,
11024}
11025
11026impl Validate for TotalsPerBankTransactionCode51 {
11027    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11028        if let Some(ref val) = self.nb_of_ntries {
11029            helpers::validate_pattern(
11030                val,
11031                "NbOfNtries",
11032                "[0-9]{1,15}",
11033                &helpers::child_path(path, "NbOfNtries"),
11034                config,
11035                collector,
11036            );
11037        }
11038        if let Some(ref val) = self.ttl_net_ntry
11039            && config.validate_optional_fields
11040        {
11041            val.validate(&helpers::child_path(path, "TtlNetNtry"), config, collector);
11042        }
11043        if let Some(ref val) = self.cdt_ntries
11044            && config.validate_optional_fields
11045        {
11046            val.validate(&helpers::child_path(path, "CdtNtries"), config, collector);
11047        }
11048        if let Some(ref val) = self.dbt_ntries
11049            && config.validate_optional_fields
11050        {
11051            val.validate(&helpers::child_path(path, "DbtNtries"), config, collector);
11052        }
11053        self.bk_tx_cd
11054            .validate(&helpers::child_path(path, "BkTxCd"), config, collector);
11055        if let Some(ref vec) = self.avlbty
11056            && config.validate_optional_fields
11057        {
11058            for item in vec {
11059                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
11060            }
11061        }
11062        if let Some(ref val) = self.dt
11063            && config.validate_optional_fields
11064        {
11065            val.validate(&helpers::child_path(path, "Dt"), config, collector);
11066        }
11067    }
11068}
11069
11070// TrackData11: Card track content or equivalent.
11071#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11072pub struct TrackData11 {
11073    #[serde(rename = "TrckNb", skip_serializing_if = "Option::is_none")]
11074    pub trck_nb: Option<String>,
11075    #[serde(rename = "TrckVal")]
11076    pub trck_val: String,
11077}
11078
11079impl Validate for TrackData11 {
11080    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11081        if let Some(ref val) = self.trck_nb {
11082            helpers::validate_pattern(
11083                val,
11084                "TrckNb",
11085                "[0-9]",
11086                &helpers::child_path(path, "TrckNb"),
11087                config,
11088                collector,
11089            );
11090        }
11091        helpers::validate_length(
11092            &self.trck_val,
11093            "TrckVal",
11094            Some(1),
11095            Some(140),
11096            &helpers::child_path(path, "TrckVal"),
11097            config,
11098            collector,
11099        );
11100        helpers::validate_pattern(
11101            &self.trck_val,
11102            "TrckVal",
11103            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11104            &helpers::child_path(path, "TrckVal"),
11105            config,
11106            collector,
11107        );
11108    }
11109}
11110
11111// TransactionAgents51: Proprietary agent related to the underlying transaction.
11112#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11113pub struct TransactionAgents51 {
11114    #[serde(rename = "InstgAgt", skip_serializing_if = "Option::is_none")]
11115    pub instg_agt: Option<BranchAndFinancialInstitutionIdentification64>,
11116    #[serde(rename = "InstdAgt", skip_serializing_if = "Option::is_none")]
11117    pub instd_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11118    #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
11119    pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11120    #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
11121    pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11122    #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
11123    pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification62>,
11124    #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
11125    pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification63>,
11126    #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
11127    pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification62>,
11128    #[serde(rename = "RcvgAgt", skip_serializing_if = "Option::is_none")]
11129    pub rcvg_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11130    #[serde(rename = "DlvrgAgt", skip_serializing_if = "Option::is_none")]
11131    pub dlvrg_agt: Option<BranchAndFinancialInstitutionIdentification63>,
11132    #[serde(rename = "IssgAgt", skip_serializing_if = "Option::is_none")]
11133    pub issg_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11134    #[serde(rename = "SttlmPlc", skip_serializing_if = "Option::is_none")]
11135    pub sttlm_plc: Option<BranchAndFinancialInstitutionIdentification63>,
11136    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11137    pub prtry: Option<Vec<ProprietaryAgent41>>,
11138}
11139
11140impl Validate for TransactionAgents51 {
11141    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11142        if let Some(ref val) = self.instg_agt
11143            && config.validate_optional_fields
11144        {
11145            val.validate(&helpers::child_path(path, "InstgAgt"), config, collector);
11146        }
11147        if let Some(ref val) = self.instd_agt
11148            && config.validate_optional_fields
11149        {
11150            val.validate(&helpers::child_path(path, "InstdAgt"), config, collector);
11151        }
11152        if let Some(ref val) = self.dbtr_agt
11153            && config.validate_optional_fields
11154        {
11155            val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
11156        }
11157        if let Some(ref val) = self.cdtr_agt
11158            && config.validate_optional_fields
11159        {
11160            val.validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
11161        }
11162        if let Some(ref val) = self.intrmy_agt1
11163            && config.validate_optional_fields
11164        {
11165            val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
11166        }
11167        if let Some(ref val) = self.intrmy_agt2
11168            && config.validate_optional_fields
11169        {
11170            val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
11171        }
11172        if let Some(ref val) = self.intrmy_agt3
11173            && config.validate_optional_fields
11174        {
11175            val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
11176        }
11177        if let Some(ref val) = self.rcvg_agt
11178            && config.validate_optional_fields
11179        {
11180            val.validate(&helpers::child_path(path, "RcvgAgt"), config, collector);
11181        }
11182        if let Some(ref val) = self.dlvrg_agt
11183            && config.validate_optional_fields
11184        {
11185            val.validate(&helpers::child_path(path, "DlvrgAgt"), config, collector);
11186        }
11187        if let Some(ref val) = self.issg_agt
11188            && config.validate_optional_fields
11189        {
11190            val.validate(&helpers::child_path(path, "IssgAgt"), config, collector);
11191        }
11192        if let Some(ref val) = self.sttlm_plc
11193            && config.validate_optional_fields
11194        {
11195            val.validate(&helpers::child_path(path, "SttlmPlc"), config, collector);
11196        }
11197        if let Some(ref vec) = self.prtry
11198            && config.validate_optional_fields
11199        {
11200            for item in vec {
11201                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11202            }
11203        }
11204    }
11205}
11206
11207// TransactionChannel1Code: Payment on television.
11208#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11209pub enum TransactionChannel1Code {
11210    #[default]
11211    #[serde(rename = "MAIL")]
11212    CodeMAIL,
11213    #[serde(rename = "TLPH")]
11214    CodeTLPH,
11215    #[serde(rename = "ECOM")]
11216    CodeECOM,
11217    #[serde(rename = "TVPY")]
11218    CodeTVPY,
11219}
11220
11221impl Validate for TransactionChannel1Code {
11222    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
11223        // Enum validation is typically empty
11224    }
11225}
11226
11227// TransactionDates31: Proprietary date related to the underlying transaction.
11228#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11229pub struct TransactionDates31 {
11230    #[serde(rename = "AccptncDtTm", skip_serializing_if = "Option::is_none")]
11231    pub accptnc_dt_tm: Option<String>,
11232    #[serde(
11233        rename = "TradActvtyCtrctlSttlmDt",
11234        skip_serializing_if = "Option::is_none"
11235    )]
11236    pub trad_actvty_ctrctl_sttlm_dt: Option<String>,
11237    #[serde(rename = "TradDt", skip_serializing_if = "Option::is_none")]
11238    pub trad_dt: Option<String>,
11239    #[serde(rename = "IntrBkSttlmDt", skip_serializing_if = "Option::is_none")]
11240    pub intr_bk_sttlm_dt: Option<String>,
11241    #[serde(rename = "StartDt", skip_serializing_if = "Option::is_none")]
11242    pub start_dt: Option<String>,
11243    #[serde(rename = "EndDt", skip_serializing_if = "Option::is_none")]
11244    pub end_dt: Option<String>,
11245    #[serde(rename = "TxDtTm", skip_serializing_if = "Option::is_none")]
11246    pub tx_dt_tm: Option<String>,
11247    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11248    pub prtry: Option<Vec<ProprietaryDate31>>,
11249}
11250
11251impl Validate for TransactionDates31 {
11252    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11253        if let Some(ref val) = self.accptnc_dt_tm {
11254            helpers::validate_pattern(
11255                val,
11256                "AccptncDtTm",
11257                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
11258                &helpers::child_path(path, "AccptncDtTm"),
11259                config,
11260                collector,
11261            );
11262        }
11263        if let Some(ref val) = self.tx_dt_tm {
11264            helpers::validate_pattern(
11265                val,
11266                "TxDtTm",
11267                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
11268                &helpers::child_path(path, "TxDtTm"),
11269                config,
11270                collector,
11271            );
11272        }
11273        if let Some(ref vec) = self.prtry
11274            && config.validate_optional_fields
11275        {
11276            for item in vec {
11277                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11278            }
11279        }
11280    }
11281}
11282
11283// TransactionEnvironment1Code: Public environment.
11284#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11285pub enum TransactionEnvironment1Code {
11286    #[default]
11287    #[serde(rename = "MERC")]
11288    CodeMERC,
11289    #[serde(rename = "PRIV")]
11290    CodePRIV,
11291    #[serde(rename = "PUBL")]
11292    CodePUBL,
11293}
11294
11295impl Validate for TransactionEnvironment1Code {
11296    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
11297        // Enum validation is typically empty
11298    }
11299}
11300
11301// TransactionIdentifier11: Identification of the transaction that has to be unique for a time period.
11302#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11303pub struct TransactionIdentifier11 {
11304    #[serde(rename = "TxDtTm")]
11305    pub tx_dt_tm: String,
11306    #[serde(rename = "TxRef")]
11307    pub tx_ref: String,
11308}
11309
11310impl Validate for TransactionIdentifier11 {
11311    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11312        helpers::validate_pattern(
11313            &self.tx_dt_tm,
11314            "TxDtTm",
11315            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
11316            &helpers::child_path(path, "TxDtTm"),
11317            config,
11318            collector,
11319        );
11320        helpers::validate_length(
11321            &self.tx_ref,
11322            "TxRef",
11323            Some(1),
11324            Some(35),
11325            &helpers::child_path(path, "TxRef"),
11326            config,
11327            collector,
11328        );
11329        helpers::validate_pattern(
11330            &self.tx_ref,
11331            "TxRef",
11332            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11333            &helpers::child_path(path, "TxRef"),
11334            config,
11335            collector,
11336        );
11337    }
11338}
11339
11340// TransactionInterest41: Individual interest record.
11341#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11342pub struct TransactionInterest41 {
11343    #[serde(rename = "TtlIntrstAndTaxAmt", skip_serializing_if = "Option::is_none")]
11344    pub ttl_intrst_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11345    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11346    pub rcrd: Option<Vec<InterestRecord21>>,
11347}
11348
11349impl Validate for TransactionInterest41 {
11350    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11351        if let Some(ref val) = self.ttl_intrst_and_tax_amt
11352            && config.validate_optional_fields
11353        {
11354            val.validate(
11355                &helpers::child_path(path, "TtlIntrstAndTaxAmt"),
11356                config,
11357                collector,
11358            );
11359        }
11360        if let Some(ref vec) = self.rcrd
11361            && config.validate_optional_fields
11362        {
11363            for item in vec {
11364                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
11365            }
11366        }
11367    }
11368}
11369
11370// TransactionParties61: Proprietary party related to the underlying transaction.
11371#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11372pub struct TransactionParties61 {
11373    #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
11374    pub initg_pty: Option<Party40Choice1>,
11375    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11376    pub dbtr: Option<Party40Choice2>,
11377    #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
11378    pub dbtr_acct: Option<CashAccount382>,
11379    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
11380    pub ultmt_dbtr: Option<Party40Choice1>,
11381    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11382    pub cdtr: Option<Party40Choice1>,
11383    #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
11384    pub cdtr_acct: Option<CashAccount382>,
11385    #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
11386    pub ultmt_cdtr: Option<Party40Choice1>,
11387    #[serde(rename = "TradgPty", skip_serializing_if = "Option::is_none")]
11388    pub tradg_pty: Option<Party40Choice3>,
11389    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11390    pub prtry: Option<Vec<ProprietaryParty51>>,
11391}
11392
11393impl Validate for TransactionParties61 {
11394    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11395        if let Some(ref val) = self.initg_pty
11396            && config.validate_optional_fields
11397        {
11398            val.validate(&helpers::child_path(path, "InitgPty"), config, collector);
11399        }
11400        if let Some(ref val) = self.dbtr
11401            && config.validate_optional_fields
11402        {
11403            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
11404        }
11405        if let Some(ref val) = self.dbtr_acct
11406            && config.validate_optional_fields
11407        {
11408            val.validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
11409        }
11410        if let Some(ref val) = self.ultmt_dbtr
11411            && config.validate_optional_fields
11412        {
11413            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
11414        }
11415        if let Some(ref val) = self.cdtr
11416            && config.validate_optional_fields
11417        {
11418            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
11419        }
11420        if let Some(ref val) = self.cdtr_acct
11421            && config.validate_optional_fields
11422        {
11423            val.validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
11424        }
11425        if let Some(ref val) = self.ultmt_cdtr
11426            && config.validate_optional_fields
11427        {
11428            val.validate(&helpers::child_path(path, "UltmtCdtr"), config, collector);
11429        }
11430        if let Some(ref val) = self.tradg_pty
11431            && config.validate_optional_fields
11432        {
11433            val.validate(&helpers::child_path(path, "TradgPty"), config, collector);
11434        }
11435        if let Some(ref vec) = self.prtry
11436            && config.validate_optional_fields
11437        {
11438            for item in vec {
11439                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11440            }
11441        }
11442    }
11443}
11444
11445// TransactionPrice4Choice1: Proprietary price specification related to the underlying transaction.
11446#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11447pub struct TransactionPrice4Choice1 {
11448    #[serde(rename = "DealPric", skip_serializing_if = "Option::is_none")]
11449    pub deal_pric: Option<Price71>,
11450    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11451    pub prtry: Option<Vec<ProprietaryPrice21>>,
11452}
11453
11454impl Validate for TransactionPrice4Choice1 {
11455    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11456        if let Some(ref val) = self.deal_pric
11457            && config.validate_optional_fields
11458        {
11459            val.validate(&helpers::child_path(path, "DealPric"), config, collector);
11460        }
11461        if let Some(ref vec) = self.prtry
11462            && config.validate_optional_fields
11463        {
11464            for item in vec {
11465                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11466            }
11467        }
11468    }
11469}
11470
11471// TransactionQuantities3Choice1: Proprietary quantities specification defined in the underlying transaction.
11472#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11473pub struct TransactionQuantities3Choice1 {
11474    #[serde(rename = "Qty", skip_serializing_if = "Option::is_none")]
11475    pub qty: Option<FinancialInstrumentQuantity1Choice>,
11476    #[serde(rename = "OrgnlAndCurFaceAmt", skip_serializing_if = "Option::is_none")]
11477    pub orgnl_and_cur_face_amt: Option<OriginalAndCurrentQuantities1>,
11478    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11479    pub prtry: Option<ProprietaryQuantity11>,
11480}
11481
11482impl Validate for TransactionQuantities3Choice1 {
11483    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11484        if let Some(ref val) = self.qty
11485            && config.validate_optional_fields
11486        {
11487            val.validate(&helpers::child_path(path, "Qty"), config, collector);
11488        }
11489        if let Some(ref val) = self.orgnl_and_cur_face_amt
11490            && config.validate_optional_fields
11491        {
11492            val.validate(
11493                &helpers::child_path(path, "OrgnlAndCurFaceAmt"),
11494                config,
11495                collector,
11496            );
11497        }
11498        if let Some(ref val) = self.prtry
11499            && config.validate_optional_fields
11500        {
11501            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
11502        }
11503    }
11504}
11505
11506// TransactionReferences61: Proprietary reference related to the underlying transaction.
11507#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11508pub struct TransactionReferences61 {
11509    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
11510    pub msg_id: Option<String>,
11511    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
11512    pub acct_svcr_ref: Option<String>,
11513    #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
11514    pub pmt_inf_id: Option<String>,
11515    #[serde(rename = "InstrId", skip_serializing_if = "Option::is_none")]
11516    pub instr_id: Option<String>,
11517    #[serde(rename = "EndToEndId", skip_serializing_if = "Option::is_none")]
11518    pub end_to_end_id: Option<String>,
11519    #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
11520    pub uetr: Option<String>,
11521    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
11522    pub tx_id: Option<String>,
11523    #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
11524    pub mndt_id: Option<String>,
11525    #[serde(rename = "ChqNb", skip_serializing_if = "Option::is_none")]
11526    pub chq_nb: Option<String>,
11527    #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
11528    pub clr_sys_ref: Option<String>,
11529    #[serde(rename = "AcctOwnrTxId", skip_serializing_if = "Option::is_none")]
11530    pub acct_ownr_tx_id: Option<String>,
11531    #[serde(rename = "AcctSvcrTxId", skip_serializing_if = "Option::is_none")]
11532    pub acct_svcr_tx_id: Option<String>,
11533    #[serde(rename = "MktInfrstrctrTxId", skip_serializing_if = "Option::is_none")]
11534    pub mkt_infrstrctr_tx_id: Option<String>,
11535    #[serde(rename = "PrcgId", skip_serializing_if = "Option::is_none")]
11536    pub prcg_id: Option<String>,
11537    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11538    pub prtry: Option<Vec<ProprietaryReference11>>,
11539}
11540
11541impl Validate for TransactionReferences61 {
11542    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11543        if let Some(ref val) = self.msg_id {
11544            helpers::validate_length(
11545                val,
11546                "MsgId",
11547                Some(1),
11548                Some(35),
11549                &helpers::child_path(path, "MsgId"),
11550                config,
11551                collector,
11552            );
11553        }
11554        if let Some(ref val) = self.msg_id {
11555            helpers::validate_pattern(
11556                val,
11557                "MsgId",
11558                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11559                &helpers::child_path(path, "MsgId"),
11560                config,
11561                collector,
11562            );
11563        }
11564        if let Some(ref val) = self.acct_svcr_ref {
11565            helpers::validate_length(
11566                val,
11567                "AcctSvcrRef",
11568                Some(1),
11569                Some(35),
11570                &helpers::child_path(path, "AcctSvcrRef"),
11571                config,
11572                collector,
11573            );
11574        }
11575        if let Some(ref val) = self.acct_svcr_ref {
11576            helpers::validate_pattern(
11577                val,
11578                "AcctSvcrRef",
11579                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11580                &helpers::child_path(path, "AcctSvcrRef"),
11581                config,
11582                collector,
11583            );
11584        }
11585        if let Some(ref val) = self.pmt_inf_id {
11586            helpers::validate_length(
11587                val,
11588                "PmtInfId",
11589                Some(1),
11590                Some(35),
11591                &helpers::child_path(path, "PmtInfId"),
11592                config,
11593                collector,
11594            );
11595        }
11596        if let Some(ref val) = self.pmt_inf_id {
11597            helpers::validate_pattern(
11598                val,
11599                "PmtInfId",
11600                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11601                &helpers::child_path(path, "PmtInfId"),
11602                config,
11603                collector,
11604            );
11605        }
11606        if let Some(ref val) = self.instr_id {
11607            helpers::validate_length(
11608                val,
11609                "InstrId",
11610                Some(1),
11611                Some(35),
11612                &helpers::child_path(path, "InstrId"),
11613                config,
11614                collector,
11615            );
11616        }
11617        if let Some(ref val) = self.instr_id {
11618            helpers::validate_pattern(
11619                val,
11620                "InstrId",
11621                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11622                &helpers::child_path(path, "InstrId"),
11623                config,
11624                collector,
11625            );
11626        }
11627        if let Some(ref val) = self.end_to_end_id {
11628            helpers::validate_length(
11629                val,
11630                "EndToEndId",
11631                Some(1),
11632                Some(35),
11633                &helpers::child_path(path, "EndToEndId"),
11634                config,
11635                collector,
11636            );
11637        }
11638        if let Some(ref val) = self.end_to_end_id {
11639            helpers::validate_pattern(
11640                val,
11641                "EndToEndId",
11642                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11643                &helpers::child_path(path, "EndToEndId"),
11644                config,
11645                collector,
11646            );
11647        }
11648        if let Some(ref val) = self.uetr {
11649            helpers::validate_pattern(
11650                val,
11651                "UETR",
11652                "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
11653                &helpers::child_path(path, "UETR"),
11654                config,
11655                collector,
11656            );
11657        }
11658        if let Some(ref val) = self.tx_id {
11659            helpers::validate_length(
11660                val,
11661                "TxId",
11662                Some(1),
11663                Some(35),
11664                &helpers::child_path(path, "TxId"),
11665                config,
11666                collector,
11667            );
11668        }
11669        if let Some(ref val) = self.tx_id {
11670            helpers::validate_pattern(
11671                val,
11672                "TxId",
11673                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11674                &helpers::child_path(path, "TxId"),
11675                config,
11676                collector,
11677            );
11678        }
11679        if let Some(ref val) = self.mndt_id {
11680            helpers::validate_length(
11681                val,
11682                "MndtId",
11683                Some(1),
11684                Some(35),
11685                &helpers::child_path(path, "MndtId"),
11686                config,
11687                collector,
11688            );
11689        }
11690        if let Some(ref val) = self.mndt_id {
11691            helpers::validate_pattern(
11692                val,
11693                "MndtId",
11694                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11695                &helpers::child_path(path, "MndtId"),
11696                config,
11697                collector,
11698            );
11699        }
11700        if let Some(ref val) = self.chq_nb {
11701            helpers::validate_length(
11702                val,
11703                "ChqNb",
11704                Some(1),
11705                Some(35),
11706                &helpers::child_path(path, "ChqNb"),
11707                config,
11708                collector,
11709            );
11710        }
11711        if let Some(ref val) = self.chq_nb {
11712            helpers::validate_pattern(
11713                val,
11714                "ChqNb",
11715                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11716                &helpers::child_path(path, "ChqNb"),
11717                config,
11718                collector,
11719            );
11720        }
11721        if let Some(ref val) = self.clr_sys_ref {
11722            helpers::validate_length(
11723                val,
11724                "ClrSysRef",
11725                Some(1),
11726                Some(35),
11727                &helpers::child_path(path, "ClrSysRef"),
11728                config,
11729                collector,
11730            );
11731        }
11732        if let Some(ref val) = self.clr_sys_ref {
11733            helpers::validate_pattern(
11734                val,
11735                "ClrSysRef",
11736                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11737                &helpers::child_path(path, "ClrSysRef"),
11738                config,
11739                collector,
11740            );
11741        }
11742        if let Some(ref val) = self.acct_ownr_tx_id {
11743            helpers::validate_length(
11744                val,
11745                "AcctOwnrTxId",
11746                Some(1),
11747                Some(35),
11748                &helpers::child_path(path, "AcctOwnrTxId"),
11749                config,
11750                collector,
11751            );
11752        }
11753        if let Some(ref val) = self.acct_ownr_tx_id {
11754            helpers::validate_pattern(
11755                val,
11756                "AcctOwnrTxId",
11757                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11758                &helpers::child_path(path, "AcctOwnrTxId"),
11759                config,
11760                collector,
11761            );
11762        }
11763        if let Some(ref val) = self.acct_svcr_tx_id {
11764            helpers::validate_length(
11765                val,
11766                "AcctSvcrTxId",
11767                Some(1),
11768                Some(35),
11769                &helpers::child_path(path, "AcctSvcrTxId"),
11770                config,
11771                collector,
11772            );
11773        }
11774        if let Some(ref val) = self.acct_svcr_tx_id {
11775            helpers::validate_pattern(
11776                val,
11777                "AcctSvcrTxId",
11778                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11779                &helpers::child_path(path, "AcctSvcrTxId"),
11780                config,
11781                collector,
11782            );
11783        }
11784        if let Some(ref val) = self.mkt_infrstrctr_tx_id {
11785            helpers::validate_length(
11786                val,
11787                "MktInfrstrctrTxId",
11788                Some(1),
11789                Some(35),
11790                &helpers::child_path(path, "MktInfrstrctrTxId"),
11791                config,
11792                collector,
11793            );
11794        }
11795        if let Some(ref val) = self.mkt_infrstrctr_tx_id {
11796            helpers::validate_pattern(
11797                val,
11798                "MktInfrstrctrTxId",
11799                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11800                &helpers::child_path(path, "MktInfrstrctrTxId"),
11801                config,
11802                collector,
11803            );
11804        }
11805        if let Some(ref val) = self.prcg_id {
11806            helpers::validate_length(
11807                val,
11808                "PrcgId",
11809                Some(1),
11810                Some(35),
11811                &helpers::child_path(path, "PrcgId"),
11812                config,
11813                collector,
11814            );
11815        }
11816        if let Some(ref val) = self.prcg_id {
11817            helpers::validate_pattern(
11818                val,
11819                "PrcgId",
11820                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11821                &helpers::child_path(path, "PrcgId"),
11822                config,
11823                collector,
11824            );
11825        }
11826        if let Some(ref vec) = self.prtry
11827            && config.validate_optional_fields
11828        {
11829            for item in vec {
11830                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11831            }
11832        }
11833    }
11834}
11835
11836// UnitOfMeasure1Code: Unit of measure equal to 4, 840 square yards.
11837#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11838pub enum UnitOfMeasure1Code {
11839    #[default]
11840    #[serde(rename = "PIEC")]
11841    CodePIEC,
11842    #[serde(rename = "TONS")]
11843    CodeTONS,
11844    #[serde(rename = "FOOT")]
11845    CodeFOOT,
11846    #[serde(rename = "GBGA")]
11847    CodeGBGA,
11848    #[serde(rename = "USGA")]
11849    CodeUSGA,
11850    #[serde(rename = "GRAM")]
11851    CodeGRAM,
11852    #[serde(rename = "INCH")]
11853    CodeINCH,
11854    #[serde(rename = "KILO")]
11855    CodeKILO,
11856    #[serde(rename = "PUND")]
11857    CodePUND,
11858    #[serde(rename = "METR")]
11859    CodeMETR,
11860    #[serde(rename = "CMET")]
11861    CodeCMET,
11862    #[serde(rename = "MMET")]
11863    CodeMMET,
11864    #[serde(rename = "LITR")]
11865    CodeLITR,
11866    #[serde(rename = "CELI")]
11867    CodeCELI,
11868    #[serde(rename = "MILI")]
11869    CodeMILI,
11870    #[serde(rename = "GBOU")]
11871    CodeGBOU,
11872    #[serde(rename = "USOU")]
11873    CodeUSOU,
11874    #[serde(rename = "GBQA")]
11875    CodeGBQA,
11876    #[serde(rename = "USQA")]
11877    CodeUSQA,
11878    #[serde(rename = "GBPI")]
11879    CodeGBPI,
11880    #[serde(rename = "USPI")]
11881    CodeUSPI,
11882    #[serde(rename = "MILE")]
11883    CodeMILE,
11884    #[serde(rename = "KMET")]
11885    CodeKMET,
11886    #[serde(rename = "YARD")]
11887    CodeYARD,
11888    #[serde(rename = "SQKI")]
11889    CodeSQKI,
11890    #[serde(rename = "HECT")]
11891    CodeHECT,
11892    #[serde(rename = "ARES")]
11893    CodeARES,
11894    #[serde(rename = "SMET")]
11895    CodeSMET,
11896    #[serde(rename = "SCMT")]
11897    CodeSCMT,
11898    #[serde(rename = "SMIL")]
11899    CodeSMIL,
11900    #[serde(rename = "SQMI")]
11901    CodeSQMI,
11902    #[serde(rename = "SQYA")]
11903    CodeSQYA,
11904    #[serde(rename = "SQFO")]
11905    CodeSQFO,
11906    #[serde(rename = "SQIN")]
11907    CodeSQIN,
11908    #[serde(rename = "ACRE")]
11909    CodeACRE,
11910}
11911
11912impl Validate for UnitOfMeasure1Code {
11913    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
11914        // Enum validation is typically empty
11915    }
11916}
11917
11918// UserInterface2Code: Cardholder display or interface.
11919#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11920pub enum UserInterface2Code {
11921    #[default]
11922    #[serde(rename = "MDSP")]
11923    CodeMDSP,
11924    #[serde(rename = "CDSP")]
11925    CodeCDSP,
11926}
11927
11928impl Validate for UserInterface2Code {
11929    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
11930        // Enum validation is typically empty
11931    }
11932}
11933
11934// YieldedOrValueType1Choice: Type of value in which the price is expressed.
11935#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11936pub struct YieldedOrValueType1Choice {
11937    #[serde(rename = "Yldd", skip_serializing_if = "Option::is_none")]
11938    pub yldd: Option<bool>,
11939    #[serde(rename = "ValTp", skip_serializing_if = "Option::is_none")]
11940    pub val_tp: Option<PriceValueType1Code>,
11941}
11942
11943impl Validate for YieldedOrValueType1Choice {
11944    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11945        if let Some(ref val) = self.val_tp
11946            && config.validate_optional_fields
11947        {
11948            val.validate(&helpers::child_path(path, "ValTp"), config, collector);
11949        }
11950    }
11951}