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<Box<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
1467// Usage: The sequential number is increased incrementally for each transaction.
1468#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1469pub struct CardIndividualTransaction21 {
1470    #[serde(rename = "ICCRltdData", skip_serializing_if = "Option::is_none")]
1471    pub icc_rltd_data: Option<String>,
1472    #[serde(rename = "PmtCntxt", skip_serializing_if = "Option::is_none")]
1473    pub pmt_cntxt: Option<PaymentContext3>,
1474    #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1475    pub addtl_svc: Option<CardPaymentServiceType2Code>,
1476    #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1477    pub tx_ctgy: Option<String>,
1478    #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1479    pub sale_rcncltn_id: Option<String>,
1480    #[serde(rename = "SaleRefNb", skip_serializing_if = "Option::is_none")]
1481    pub sale_ref_nb: Option<String>,
1482    #[serde(rename = "RePresntmntRsn", skip_serializing_if = "Option::is_none")]
1483    pub re_presntmnt_rsn: Option<String>,
1484    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
1485    pub seq_nb: Option<String>,
1486    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
1487    pub tx_id: Option<TransactionIdentifier11>,
1488    #[serde(rename = "Pdct", skip_serializing_if = "Option::is_none")]
1489    pub pdct: Option<Product21>,
1490    #[serde(rename = "VldtnDt", skip_serializing_if = "Option::is_none")]
1491    pub vldtn_dt: Option<String>,
1492    #[serde(rename = "VldtnSeqNb", skip_serializing_if = "Option::is_none")]
1493    pub vldtn_seq_nb: Option<String>,
1494}
1495
1496impl Validate for CardIndividualTransaction21 {
1497    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1498        if let Some(ref val) = self.icc_rltd_data {
1499            helpers::validate_length(
1500                val,
1501                "ICCRltdData",
1502                Some(1),
1503                Some(1025),
1504                &helpers::child_path(path, "ICCRltdData"),
1505                config,
1506                collector,
1507            );
1508        }
1509        if let Some(ref val) = self.icc_rltd_data {
1510            helpers::validate_pattern(
1511                val,
1512                "ICCRltdData",
1513                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1514                &helpers::child_path(path, "ICCRltdData"),
1515                config,
1516                collector,
1517            );
1518        }
1519        if let Some(ref val) = self.pmt_cntxt
1520            && config.validate_optional_fields
1521        {
1522            val.validate(&helpers::child_path(path, "PmtCntxt"), config, collector);
1523        }
1524        if let Some(ref val) = self.addtl_svc
1525            && config.validate_optional_fields
1526        {
1527            val.validate(&helpers::child_path(path, "AddtlSvc"), config, collector);
1528        }
1529        if let Some(ref val) = self.tx_ctgy {
1530            helpers::validate_length(
1531                val,
1532                "TxCtgy",
1533                Some(1),
1534                Some(4),
1535                &helpers::child_path(path, "TxCtgy"),
1536                config,
1537                collector,
1538            );
1539        }
1540        if let Some(ref val) = self.sale_rcncltn_id {
1541            helpers::validate_length(
1542                val,
1543                "SaleRcncltnId",
1544                Some(1),
1545                Some(35),
1546                &helpers::child_path(path, "SaleRcncltnId"),
1547                config,
1548                collector,
1549            );
1550        }
1551        if let Some(ref val) = self.sale_rcncltn_id {
1552            helpers::validate_pattern(
1553                val,
1554                "SaleRcncltnId",
1555                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1556                &helpers::child_path(path, "SaleRcncltnId"),
1557                config,
1558                collector,
1559            );
1560        }
1561        if let Some(ref val) = self.sale_ref_nb {
1562            helpers::validate_length(
1563                val,
1564                "SaleRefNb",
1565                Some(1),
1566                Some(35),
1567                &helpers::child_path(path, "SaleRefNb"),
1568                config,
1569                collector,
1570            );
1571        }
1572        if let Some(ref val) = self.sale_ref_nb {
1573            helpers::validate_pattern(
1574                val,
1575                "SaleRefNb",
1576                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1577                &helpers::child_path(path, "SaleRefNb"),
1578                config,
1579                collector,
1580            );
1581        }
1582        if let Some(ref val) = self.re_presntmnt_rsn {
1583            helpers::validate_length(
1584                val,
1585                "RePresntmntRsn",
1586                Some(1),
1587                Some(4),
1588                &helpers::child_path(path, "RePresntmntRsn"),
1589                config,
1590                collector,
1591            );
1592        }
1593        if let Some(ref val) = self.seq_nb {
1594            helpers::validate_length(
1595                val,
1596                "SeqNb",
1597                Some(1),
1598                Some(35),
1599                &helpers::child_path(path, "SeqNb"),
1600                config,
1601                collector,
1602            );
1603        }
1604        if let Some(ref val) = self.seq_nb {
1605            helpers::validate_pattern(
1606                val,
1607                "SeqNb",
1608                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1609                &helpers::child_path(path, "SeqNb"),
1610                config,
1611                collector,
1612            );
1613        }
1614        if let Some(ref val) = self.tx_id
1615            && config.validate_optional_fields
1616        {
1617            val.validate(&helpers::child_path(path, "TxId"), config, collector);
1618        }
1619        if let Some(ref val) = self.pdct
1620            && config.validate_optional_fields
1621        {
1622            val.validate(&helpers::child_path(path, "Pdct"), config, collector);
1623        }
1624        if let Some(ref val) = self.vldtn_seq_nb {
1625            helpers::validate_length(
1626                val,
1627                "VldtnSeqNb",
1628                Some(1),
1629                Some(35),
1630                &helpers::child_path(path, "VldtnSeqNb"),
1631                config,
1632                collector,
1633            );
1634        }
1635        if let Some(ref val) = self.vldtn_seq_nb {
1636            helpers::validate_pattern(
1637                val,
1638                "VldtnSeqNb",
1639                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1640                &helpers::child_path(path, "VldtnSeqNb"),
1641                config,
1642                collector,
1643            );
1644        }
1645    }
1646}
1647
1648// CardPaymentServiceType2Code: Voice authorisation.
1649#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1650pub enum CardPaymentServiceType2Code {
1651    #[default]
1652    #[serde(rename = "AGGR")]
1653    CodeAGGR,
1654    #[serde(rename = "DCCV")]
1655    CodeDCCV,
1656    #[serde(rename = "GRTT")]
1657    CodeGRTT,
1658    #[serde(rename = "INSP")]
1659    CodeINSP,
1660    #[serde(rename = "LOYT")]
1661    CodeLOYT,
1662    #[serde(rename = "NRES")]
1663    CodeNRES,
1664    #[serde(rename = "PUCO")]
1665    CodePUCO,
1666    #[serde(rename = "RECP")]
1667    CodeRECP,
1668    #[serde(rename = "SOAF")]
1669    CodeSOAF,
1670    #[serde(rename = "UNAF")]
1671    CodeUNAF,
1672    #[serde(rename = "VCAU")]
1673    CodeVCAU,
1674}
1675
1676impl Validate for CardPaymentServiceType2Code {
1677    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1678        // Enum validation is typically empty
1679    }
1680}
1681
1682// CardSecurityInformation1: Card security code (CSC).
1683#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1684pub struct CardSecurityInformation1 {
1685    #[serde(rename = "CSCMgmt")]
1686    pub csc_mgmt: CSCManagement1Code,
1687    #[serde(rename = "CSCVal", skip_serializing_if = "Option::is_none")]
1688    pub csc_val: Option<String>,
1689}
1690
1691impl Validate for CardSecurityInformation1 {
1692    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1693        self.csc_mgmt
1694            .validate(&helpers::child_path(path, "CSCMgmt"), config, collector);
1695        if let Some(ref val) = self.csc_val {
1696            helpers::validate_pattern(
1697                val,
1698                "CSCVal",
1699                "[0-9]{3,4}",
1700                &helpers::child_path(path, "CSCVal"),
1701                config,
1702                collector,
1703            );
1704        }
1705    }
1706}
1707
1708// CardSequenceNumberRange11: CardSequenceNumberRange1: LastTransactionSequenceNumberMessage element to be finalised once feedback from Card SEG has been received.
1709#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1710pub struct CardSequenceNumberRange11 {
1711    #[serde(rename = "FrstTx", skip_serializing_if = "Option::is_none")]
1712    pub frst_tx: Option<String>,
1713    #[serde(rename = "LastTx", skip_serializing_if = "Option::is_none")]
1714    pub last_tx: Option<String>,
1715}
1716
1717impl Validate for CardSequenceNumberRange11 {
1718    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1719        if let Some(ref val) = self.frst_tx {
1720            helpers::validate_length(
1721                val,
1722                "FrstTx",
1723                Some(1),
1724                Some(35),
1725                &helpers::child_path(path, "FrstTx"),
1726                config,
1727                collector,
1728            );
1729        }
1730        if let Some(ref val) = self.frst_tx {
1731            helpers::validate_pattern(
1732                val,
1733                "FrstTx",
1734                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1735                &helpers::child_path(path, "FrstTx"),
1736                config,
1737                collector,
1738            );
1739        }
1740        if let Some(ref val) = self.last_tx {
1741            helpers::validate_length(
1742                val,
1743                "LastTx",
1744                Some(1),
1745                Some(35),
1746                &helpers::child_path(path, "LastTx"),
1747                config,
1748                collector,
1749            );
1750        }
1751        if let Some(ref val) = self.last_tx {
1752            helpers::validate_pattern(
1753                val,
1754                "LastTx",
1755                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1756                &helpers::child_path(path, "LastTx"),
1757                config,
1758                collector,
1759            );
1760        }
1761    }
1762}
1763
1764// CardTransaction171: Prepaid account for the transfer or loading of an amount of money.
1765#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1766pub struct CardTransaction171 {
1767    #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1768    pub card: Option<PaymentCard41>,
1769    #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1770    pub poi: Option<PointOfInteraction11>,
1771    #[serde(rename = "Tx", skip_serializing_if = "Option::is_none")]
1772    pub tx: Option<CardTransaction3Choice1>,
1773    #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1774    pub pre_pd_acct: Option<CashAccount382>,
1775}
1776
1777impl Validate for CardTransaction171 {
1778    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1779        if let Some(ref val) = self.card
1780            && config.validate_optional_fields
1781        {
1782            val.validate(&helpers::child_path(path, "Card"), config, collector);
1783        }
1784        if let Some(ref val) = self.poi
1785            && config.validate_optional_fields
1786        {
1787            val.validate(&helpers::child_path(path, "POI"), config, collector);
1788        }
1789        if let Some(ref val) = self.tx
1790            && config.validate_optional_fields
1791        {
1792            val.validate(&helpers::child_path(path, "Tx"), config, collector);
1793        }
1794        if let Some(ref val) = self.pre_pd_acct
1795            && config.validate_optional_fields
1796        {
1797            val.validate(&helpers::child_path(path, "PrePdAcct"), config, collector);
1798        }
1799    }
1800}
1801
1802// CardTransaction3Choice1: Card transaction details for the individual transaction, as recorded at the POI (point of interaction).
1803#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1804pub struct CardTransaction3Choice1 {
1805    #[serde(rename = "Aggtd", skip_serializing_if = "Option::is_none")]
1806    pub aggtd: Option<CardAggregated21>,
1807    #[serde(rename = "Indv", skip_serializing_if = "Option::is_none")]
1808    pub indv: Option<CardIndividualTransaction21>,
1809}
1810
1811impl Validate for CardTransaction3Choice1 {
1812    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1813        if let Some(ref val) = self.aggtd
1814            && config.validate_optional_fields
1815        {
1816            val.validate(&helpers::child_path(path, "Aggtd"), config, collector);
1817        }
1818        if let Some(ref val) = self.indv
1819            && config.validate_optional_fields
1820        {
1821            val.validate(&helpers::child_path(path, "Indv"), config, collector);
1822        }
1823    }
1824}
1825
1826// CardholderAuthentication2: Entity or object in charge of verifying the cardholder authenticity.
1827#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1828pub struct CardholderAuthentication2 {
1829    #[serde(rename = "AuthntcnMtd")]
1830    pub authntcn_mtd: AuthenticationMethod1Code,
1831    #[serde(rename = "AuthntcnNtty")]
1832    pub authntcn_ntty: AuthenticationEntity1Code,
1833}
1834
1835impl Validate for CardholderAuthentication2 {
1836    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1837        self.authntcn_mtd
1838            .validate(&helpers::child_path(path, "AuthntcnMtd"), config, collector);
1839        self.authntcn_ntty.validate(
1840            &helpers::child_path(path, "AuthntcnNtty"),
1841            config,
1842            collector,
1843        );
1844    }
1845}
1846
1847// CardholderVerificationCapability1Code: Three domain secure (three domain secure authentication of the cardholder).
1848#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1849pub enum CardholderVerificationCapability1Code {
1850    #[default]
1851    #[serde(rename = "MNSG")]
1852    CodeMNSG,
1853    #[serde(rename = "NPIN")]
1854    CodeNPIN,
1855    #[serde(rename = "FCPN")]
1856    CodeFCPN,
1857    #[serde(rename = "FEPN")]
1858    CodeFEPN,
1859    #[serde(rename = "FDSG")]
1860    CodeFDSG,
1861    #[serde(rename = "FBIO")]
1862    CodeFBIO,
1863    #[serde(rename = "MNVR")]
1864    CodeMNVR,
1865    #[serde(rename = "FBIG")]
1866    CodeFBIG,
1867    #[serde(rename = "APKI")]
1868    CodeAPKI,
1869    #[serde(rename = "PKIS")]
1870    CodePKIS,
1871    #[serde(rename = "CHDT")]
1872    CodeCHDT,
1873    #[serde(rename = "SCEC")]
1874    CodeSCEC,
1875}
1876
1877impl Validate for CardholderVerificationCapability1Code {
1878    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1879        // Enum validation is typically empty
1880    }
1881}
1882
1883// CashAccount381: Specifies an alternate assumed name for the identification of the account.
1884#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1885pub struct CashAccount381 {
1886    #[serde(rename = "Id")]
1887    pub id: AccountIdentification4Choice1,
1888    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1889    pub tp: Option<CashAccountType2Choice1>,
1890    #[serde(rename = "Ccy")]
1891    pub ccy: String,
1892    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1893    pub nm: Option<String>,
1894    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1895    pub prxy: Option<ProxyAccountIdentification11>,
1896}
1897
1898impl Validate for CashAccount381 {
1899    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1900        self.id
1901            .validate(&helpers::child_path(path, "Id"), config, collector);
1902        if let Some(ref val) = self.tp
1903            && config.validate_optional_fields
1904        {
1905            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1906        }
1907        helpers::validate_pattern(
1908            &self.ccy,
1909            "Ccy",
1910            "[A-Z]{3,3}",
1911            &helpers::child_path(path, "Ccy"),
1912            config,
1913            collector,
1914        );
1915        if let Some(ref val) = self.nm {
1916            helpers::validate_length(
1917                val,
1918                "Nm",
1919                Some(1),
1920                Some(70),
1921                &helpers::child_path(path, "Nm"),
1922                config,
1923                collector,
1924            );
1925        }
1926        if let Some(ref val) = self.nm {
1927            helpers::validate_pattern(
1928                val,
1929                "Nm",
1930                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1931                &helpers::child_path(path, "Nm"),
1932                config,
1933                collector,
1934            );
1935        }
1936        if let Some(ref val) = self.prxy
1937            && config.validate_optional_fields
1938        {
1939            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
1940        }
1941    }
1942}
1943
1944// CashAccount382: Specifies an alternate assumed name for the identification of the account.
1945#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1946pub struct CashAccount382 {
1947    #[serde(rename = "Id")]
1948    pub id: AccountIdentification4Choice1,
1949    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1950    pub tp: Option<CashAccountType2Choice1>,
1951    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1952    pub ccy: Option<String>,
1953    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1954    pub nm: Option<String>,
1955    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1956    pub prxy: Option<ProxyAccountIdentification11>,
1957}
1958
1959impl Validate for CashAccount382 {
1960    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1961        self.id
1962            .validate(&helpers::child_path(path, "Id"), config, collector);
1963        if let Some(ref val) = self.tp
1964            && config.validate_optional_fields
1965        {
1966            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1967        }
1968        if let Some(ref val) = self.ccy {
1969            helpers::validate_pattern(
1970                val,
1971                "Ccy",
1972                "[A-Z]{3,3}",
1973                &helpers::child_path(path, "Ccy"),
1974                config,
1975                collector,
1976            );
1977        }
1978        if let Some(ref val) = self.nm {
1979            helpers::validate_length(
1980                val,
1981                "Nm",
1982                Some(1),
1983                Some(70),
1984                &helpers::child_path(path, "Nm"),
1985                config,
1986                collector,
1987            );
1988        }
1989        if let Some(ref val) = self.nm {
1990            helpers::validate_pattern(
1991                val,
1992                "Nm",
1993                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1994                &helpers::child_path(path, "Nm"),
1995                config,
1996                collector,
1997            );
1998        }
1999        if let Some(ref val) = self.prxy
2000            && config.validate_optional_fields
2001        {
2002            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2003        }
2004    }
2005}
2006
2007// 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.
2008#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2009pub struct CashAccount391 {
2010    #[serde(rename = "Id")]
2011    pub id: AccountIdentification4Choice1,
2012    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2013    pub tp: Option<CashAccountType2Choice1>,
2014    #[serde(rename = "Ccy")]
2015    pub ccy: String,
2016    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2017    pub nm: Option<String>,
2018    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
2019    pub prxy: Option<ProxyAccountIdentification11>,
2020    #[serde(rename = "Ownr", skip_serializing_if = "Option::is_none")]
2021    pub ownr: Option<PartyIdentification1352>,
2022    #[serde(rename = "Svcr", skip_serializing_if = "Option::is_none")]
2023    pub svcr: Option<BranchAndFinancialInstitutionIdentification61>,
2024}
2025
2026impl Validate for CashAccount391 {
2027    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2028        self.id
2029            .validate(&helpers::child_path(path, "Id"), config, collector);
2030        if let Some(ref val) = self.tp
2031            && config.validate_optional_fields
2032        {
2033            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2034        }
2035        helpers::validate_pattern(
2036            &self.ccy,
2037            "Ccy",
2038            "[A-Z]{3,3}",
2039            &helpers::child_path(path, "Ccy"),
2040            config,
2041            collector,
2042        );
2043        if let Some(ref val) = self.nm {
2044            helpers::validate_length(
2045                val,
2046                "Nm",
2047                Some(1),
2048                Some(70),
2049                &helpers::child_path(path, "Nm"),
2050                config,
2051                collector,
2052            );
2053        }
2054        if let Some(ref val) = self.nm {
2055            helpers::validate_pattern(
2056                val,
2057                "Nm",
2058                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2059                &helpers::child_path(path, "Nm"),
2060                config,
2061                collector,
2062            );
2063        }
2064        if let Some(ref val) = self.prxy
2065            && config.validate_optional_fields
2066        {
2067            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2068        }
2069        if let Some(ref val) = self.ownr
2070            && config.validate_optional_fields
2071        {
2072            val.validate(&helpers::child_path(path, "Ownr"), config, collector);
2073        }
2074        if let Some(ref val) = self.svcr
2075            && config.validate_optional_fields
2076        {
2077            val.validate(&helpers::child_path(path, "Svcr"), config, collector);
2078        }
2079    }
2080}
2081
2082// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
2083#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2084pub struct CashAccountType2Choice1 {
2085    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2086    pub cd: Option<String>,
2087    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2088    pub prtry: Option<String>,
2089}
2090
2091impl Validate for CashAccountType2Choice1 {
2092    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2093        if let Some(ref val) = self.cd {
2094            helpers::validate_length(
2095                val,
2096                "Cd",
2097                Some(1),
2098                Some(4),
2099                &helpers::child_path(path, "Cd"),
2100                config,
2101                collector,
2102            );
2103        }
2104        if let Some(ref val) = self.prtry {
2105            helpers::validate_length(
2106                val,
2107                "Prtry",
2108                Some(1),
2109                Some(35),
2110                &helpers::child_path(path, "Prtry"),
2111                config,
2112                collector,
2113            );
2114        }
2115        if let Some(ref val) = self.prtry {
2116            helpers::validate_pattern(
2117                val,
2118                "Prtry",
2119                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2120                &helpers::child_path(path, "Prtry"),
2121                config,
2122                collector,
2123            );
2124        }
2125    }
2126}
2127
2128// CashAvailability1: Indicates whether the availability balance is a credit or a debit balance.
2129// Usage: A zero balance is considered to be a credit balance.
2130#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2131pub struct CashAvailability1 {
2132    #[serde(rename = "Dt")]
2133    pub dt: CashAvailabilityDate1Choice,
2134    #[serde(rename = "Amt")]
2135    pub amt: ActiveOrHistoricCurrencyAndAmount,
2136    #[serde(rename = "CdtDbtInd")]
2137    pub cdt_dbt_ind: CreditDebitCode,
2138}
2139
2140impl Validate for CashAvailability1 {
2141    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2142        self.dt
2143            .validate(&helpers::child_path(path, "Dt"), config, collector);
2144        self.amt
2145            .validate(&helpers::child_path(path, "Amt"), config, collector);
2146        self.cdt_dbt_ind
2147            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2148    }
2149}
2150
2151// CashAvailabilityDate1Choice: Identifies the actual availability date.
2152#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2153pub struct CashAvailabilityDate1Choice {
2154    #[serde(rename = "NbOfDays", skip_serializing_if = "Option::is_none")]
2155    pub nb_of_days: Option<String>,
2156    #[serde(rename = "ActlDt", skip_serializing_if = "Option::is_none")]
2157    pub actl_dt: Option<String>,
2158}
2159
2160impl Validate for CashAvailabilityDate1Choice {
2161    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2162        if let Some(ref val) = self.nb_of_days {
2163            helpers::validate_pattern(
2164                val,
2165                "NbOfDays",
2166                "[\\+]{0,1}[0-9]{1,15}",
2167                &helpers::child_path(path, "NbOfDays"),
2168                config,
2169                collector,
2170            );
2171        }
2172    }
2173}
2174
2175// 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.
2176//
2177// Usage: This type of information is used in the US and is linked to particular instruments such as cheques.
2178// 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).
2179#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2180pub struct CashBalance81 {
2181    #[serde(rename = "Tp")]
2182    pub tp: BalanceType131,
2183    #[serde(rename = "CdtLine", skip_serializing_if = "Option::is_none")]
2184    pub cdt_line: Option<Vec<CreditLine31>>,
2185    #[serde(rename = "Amt")]
2186    pub amt: ActiveOrHistoricCurrencyAndAmount,
2187    #[serde(rename = "CdtDbtInd")]
2188    pub cdt_dbt_ind: CreditDebitCode,
2189    #[serde(rename = "Dt")]
2190    pub dt: DateAndDateTime2Choice1,
2191    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
2192    pub avlbty: Option<Vec<CashAvailability1>>,
2193}
2194
2195impl Validate for CashBalance81 {
2196    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2197        self.tp
2198            .validate(&helpers::child_path(path, "Tp"), config, collector);
2199        if let Some(ref vec) = self.cdt_line
2200            && config.validate_optional_fields
2201        {
2202            for item in vec {
2203                item.validate(&helpers::child_path(path, "CdtLine"), config, collector);
2204            }
2205        }
2206        self.amt
2207            .validate(&helpers::child_path(path, "Amt"), config, collector);
2208        self.cdt_dbt_ind
2209            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2210        self.dt
2211            .validate(&helpers::child_path(path, "Dt"), config, collector);
2212        if let Some(ref vec) = self.avlbty
2213            && config.validate_optional_fields
2214        {
2215            for item in vec {
2216                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
2217            }
2218        }
2219    }
2220}
2221
2222// CashDeposit11: Specifies the total amount of money in the cash deposit, that is the note denomination times the number of notes.
2223#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2224pub struct CashDeposit11 {
2225    #[serde(rename = "NoteDnmtn")]
2226    pub note_dnmtn: ActiveOrHistoricCurrencyAndAmount,
2227    #[serde(rename = "NbOfNotes")]
2228    pub nb_of_notes: String,
2229    #[serde(rename = "Amt")]
2230    pub amt: ActiveOrHistoricCurrencyAndAmount,
2231}
2232
2233impl Validate for CashDeposit11 {
2234    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2235        self.note_dnmtn
2236            .validate(&helpers::child_path(path, "NoteDnmtn"), config, collector);
2237        helpers::validate_pattern(
2238            &self.nb_of_notes,
2239            "NbOfNotes",
2240            "[0-9]{1,15}",
2241            &helpers::child_path(path, "NbOfNotes"),
2242            config,
2243            collector,
2244        );
2245        self.amt
2246            .validate(&helpers::child_path(path, "Amt"), config, collector);
2247    }
2248}
2249
2250// ChargeBearerType1Code: Charges are to be applied following the rules agreed in the service level and/or scheme.
2251#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2252pub enum ChargeBearerType1Code {
2253    #[default]
2254    #[serde(rename = "DEBT")]
2255    CodeDEBT,
2256    #[serde(rename = "CRED")]
2257    CodeCRED,
2258    #[serde(rename = "SHAR")]
2259    CodeSHAR,
2260    #[serde(rename = "SLEV")]
2261    CodeSLEV,
2262}
2263
2264impl Validate for ChargeBearerType1Code {
2265    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2266        // Enum validation is typically empty
2267    }
2268}
2269
2270// ChargeType3Choice1: Type of charge in a proprietary form, as defined by the issuer.
2271#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2272pub struct ChargeType3Choice1 {
2273    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2274    pub cd: Option<String>,
2275    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2276    pub prtry: Option<GenericIdentification31>,
2277}
2278
2279impl Validate for ChargeType3Choice1 {
2280    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2281        if let Some(ref val) = self.cd {
2282            helpers::validate_length(
2283                val,
2284                "Cd",
2285                Some(1),
2286                Some(4),
2287                &helpers::child_path(path, "Cd"),
2288                config,
2289                collector,
2290            );
2291        }
2292        if let Some(ref val) = self.prtry
2293            && config.validate_optional_fields
2294        {
2295            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
2296        }
2297    }
2298}
2299
2300// Charges61: Provides details of the individual charges record.
2301#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2302pub struct Charges61 {
2303    #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2304    pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2305    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2306    pub rcrd: Option<Vec<ChargesRecord31>>,
2307}
2308
2309impl Validate for Charges61 {
2310    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2311        if let Some(ref val) = self.ttl_chrgs_and_tax_amt
2312            && config.validate_optional_fields
2313        {
2314            val.validate(
2315                &helpers::child_path(path, "TtlChrgsAndTaxAmt"),
2316                config,
2317                collector,
2318            );
2319        }
2320        if let Some(ref vec) = self.rcrd
2321            && config.validate_optional_fields
2322        {
2323            for item in vec {
2324                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
2325            }
2326        }
2327    }
2328}
2329
2330// ChargesRecord31: Provides details on the tax applied to charges.
2331#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2332pub struct ChargesRecord31 {
2333    #[serde(rename = "Amt")]
2334    pub amt: ActiveOrHistoricCurrencyAndAmount,
2335    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2336    pub cdt_dbt_ind: Option<CreditDebitCode>,
2337    #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2338    pub chrg_incl_ind: Option<bool>,
2339    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2340    pub tp: Option<ChargeType3Choice1>,
2341    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2342    pub rate: Option<f64>,
2343    #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2344    pub br: Option<ChargeBearerType1Code>,
2345    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2346    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
2347    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2348    pub tax: Option<TaxCharges21>,
2349}
2350
2351impl Validate for ChargesRecord31 {
2352    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2353        self.amt
2354            .validate(&helpers::child_path(path, "Amt"), config, collector);
2355        if let Some(ref val) = self.cdt_dbt_ind
2356            && config.validate_optional_fields
2357        {
2358            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2359        }
2360        if let Some(ref val) = self.tp
2361            && config.validate_optional_fields
2362        {
2363            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2364        }
2365        if let Some(ref val) = self.br
2366            && config.validate_optional_fields
2367        {
2368            val.validate(&helpers::child_path(path, "Br"), config, collector);
2369        }
2370        if let Some(ref val) = self.agt
2371            && config.validate_optional_fields
2372        {
2373            val.validate(&helpers::child_path(path, "Agt"), config, collector);
2374        }
2375        if let Some(ref val) = self.tax
2376            && config.validate_optional_fields
2377        {
2378            val.validate(&helpers::child_path(path, "Tax"), config, collector);
2379        }
2380    }
2381}
2382
2383// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
2384#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2385pub struct ClearingSystemIdentification2Choice1 {
2386    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2387    pub cd: Option<String>,
2388}
2389
2390impl Validate for ClearingSystemIdentification2Choice1 {
2391    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2392        if let Some(ref val) = self.cd {
2393            helpers::validate_length(
2394                val,
2395                "Cd",
2396                Some(1),
2397                Some(5),
2398                &helpers::child_path(path, "Cd"),
2399                config,
2400                collector,
2401            );
2402        }
2403    }
2404}
2405
2406// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
2407#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2408pub struct ClearingSystemMemberIdentification21 {
2409    #[serde(rename = "ClrSysId")]
2410    pub clr_sys_id: ClearingSystemIdentification2Choice1,
2411    #[serde(rename = "MmbId")]
2412    pub mmb_id: String,
2413}
2414
2415impl Validate for ClearingSystemMemberIdentification21 {
2416    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2417        self.clr_sys_id
2418            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2419        helpers::validate_length(
2420            &self.mmb_id,
2421            "MmbId",
2422            Some(1),
2423            Some(28),
2424            &helpers::child_path(path, "MmbId"),
2425            config,
2426            collector,
2427        );
2428        helpers::validate_pattern(
2429            &self.mmb_id,
2430            "MmbId",
2431            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2432            &helpers::child_path(path, "MmbId"),
2433            config,
2434            collector,
2435        );
2436    }
2437}
2438
2439// ClearingSystemMemberIdentification22: Identification of a member of a clearing system.
2440#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2441pub struct ClearingSystemMemberIdentification22 {
2442    #[serde(rename = "ClrSysId")]
2443    pub clr_sys_id: ClearingSystemIdentification2Choice1,
2444    #[serde(rename = "MmbId")]
2445    pub mmb_id: String,
2446}
2447
2448impl Validate for ClearingSystemMemberIdentification22 {
2449    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2450        self.clr_sys_id
2451            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2452        helpers::validate_length(
2453            &self.mmb_id,
2454            "MmbId",
2455            Some(1),
2456            Some(35),
2457            &helpers::child_path(path, "MmbId"),
2458            config,
2459            collector,
2460        );
2461    }
2462}
2463
2464// Contact41: Name by which a party is known and which is usually used to identify that party.
2465#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2466pub struct Contact41 {
2467    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2468    pub nm: Option<String>,
2469}
2470
2471impl Validate for Contact41 {
2472    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2473        if let Some(ref val) = self.nm {
2474            helpers::validate_length(
2475                val,
2476                "Nm",
2477                Some(1),
2478                Some(140),
2479                &helpers::child_path(path, "Nm"),
2480                config,
2481                collector,
2482            );
2483        }
2484    }
2485}
2486
2487// Contact42: Name by which a party is known and which is usually used to identify that party.
2488#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2489pub struct Contact42 {
2490    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2491    pub nm: Option<String>,
2492}
2493
2494impl Validate for Contact42 {
2495    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2496        if let Some(ref val) = self.nm {
2497            helpers::validate_length(
2498                val,
2499                "Nm",
2500                Some(1),
2501                Some(140),
2502                &helpers::child_path(path, "Nm"),
2503                config,
2504                collector,
2505            );
2506        }
2507        if let Some(ref val) = self.nm {
2508            helpers::validate_pattern(
2509                val,
2510                "Nm",
2511                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2512                &helpers::child_path(path, "Nm"),
2513                config,
2514                collector,
2515            );
2516        }
2517    }
2518}
2519
2520// Contact43: Preferred method used to reach the contact.
2521#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2522pub struct Contact43 {
2523    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2524    pub nm: Option<String>,
2525    #[serde(rename = "PrefrdMtd", skip_serializing_if = "Option::is_none")]
2526    pub prefrd_mtd: Option<PreferredContactMethod1Code>,
2527}
2528
2529impl Validate for Contact43 {
2530    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2531        if let Some(ref val) = self.nm {
2532            helpers::validate_length(
2533                val,
2534                "Nm",
2535                Some(1),
2536                Some(140),
2537                &helpers::child_path(path, "Nm"),
2538                config,
2539                collector,
2540            );
2541        }
2542        if let Some(ref val) = self.nm {
2543            helpers::validate_pattern(
2544                val,
2545                "Nm",
2546                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2547                &helpers::child_path(path, "Nm"),
2548                config,
2549                collector,
2550            );
2551        }
2552        if let Some(ref val) = self.prefrd_mtd
2553            && config.validate_optional_fields
2554        {
2555            val.validate(&helpers::child_path(path, "PrefrdMtd"), config, collector);
2556        }
2557    }
2558}
2559
2560// CopyDuplicate1Code: Message is for information/confirmation purposes. It is a duplicate of a message previously sent.
2561#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2562pub enum CopyDuplicate1Code {
2563    #[default]
2564    #[serde(rename = "CODU")]
2565    CodeCODU,
2566    #[serde(rename = "COPY")]
2567    CodeCOPY,
2568    #[serde(rename = "DUPL")]
2569    CodeDUPL,
2570}
2571
2572impl Validate for CopyDuplicate1Code {
2573    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2574        // Enum validation is typically empty
2575    }
2576}
2577
2578// CorporateAction91: Identification of a corporate action assigned by an official central body/entity within a given market.
2579#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2580pub struct CorporateAction91 {
2581    #[serde(rename = "EvtTp")]
2582    pub evt_tp: String,
2583    #[serde(rename = "EvtId")]
2584    pub evt_id: String,
2585}
2586
2587impl Validate for CorporateAction91 {
2588    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2589        helpers::validate_length(
2590            &self.evt_tp,
2591            "EvtTp",
2592            Some(1),
2593            Some(35),
2594            &helpers::child_path(path, "EvtTp"),
2595            config,
2596            collector,
2597        );
2598        helpers::validate_pattern(
2599            &self.evt_tp,
2600            "EvtTp",
2601            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2602            &helpers::child_path(path, "EvtTp"),
2603            config,
2604            collector,
2605        );
2606        helpers::validate_length(
2607            &self.evt_id,
2608            "EvtId",
2609            Some(1),
2610            Some(35),
2611            &helpers::child_path(path, "EvtId"),
2612            config,
2613            collector,
2614        );
2615        helpers::validate_pattern(
2616            &self.evt_id,
2617            "EvtId",
2618            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2619            &helpers::child_path(path, "EvtId"),
2620            config,
2621            collector,
2622        );
2623    }
2624}
2625
2626// CreditDebitCode: Operation is a decrease.
2627#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2628pub enum CreditDebitCode {
2629    #[default]
2630    #[serde(rename = "CRDT")]
2631    CodeCRDT,
2632    #[serde(rename = "DBIT")]
2633    CodeDBIT,
2634}
2635
2636impl Validate for CreditDebitCode {
2637    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2638        // Enum validation is typically empty
2639    }
2640}
2641
2642// CreditLine31: Date of the credit line provided when multiple credit lines may be provided.
2643#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2644pub struct CreditLine31 {
2645    #[serde(rename = "Incl")]
2646    pub incl: bool,
2647    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2648    pub tp: Option<CreditLineType1Choice1>,
2649    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
2650    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2651    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2652    pub dt: Option<DateAndDateTime2Choice1>,
2653}
2654
2655impl Validate for CreditLine31 {
2656    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2657        if let Some(ref val) = self.tp
2658            && config.validate_optional_fields
2659        {
2660            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2661        }
2662        if let Some(ref val) = self.amt
2663            && config.validate_optional_fields
2664        {
2665            val.validate(&helpers::child_path(path, "Amt"), config, collector);
2666        }
2667        if let Some(ref val) = self.dt
2668            && config.validate_optional_fields
2669        {
2670            val.validate(&helpers::child_path(path, "Dt"), config, collector);
2671        }
2672    }
2673}
2674
2675// CreditLineType1Choice1: Type of the credit line, in a proprietary form.
2676#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2677pub struct CreditLineType1Choice1 {
2678    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2679    pub cd: Option<String>,
2680    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2681    pub prtry: Option<String>,
2682}
2683
2684impl Validate for CreditLineType1Choice1 {
2685    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2686        if let Some(ref val) = self.cd {
2687            helpers::validate_length(
2688                val,
2689                "Cd",
2690                Some(1),
2691                Some(4),
2692                &helpers::child_path(path, "Cd"),
2693                config,
2694                collector,
2695            );
2696        }
2697        if let Some(ref val) = self.prtry {
2698            helpers::validate_length(
2699                val,
2700                "Prtry",
2701                Some(1),
2702                Some(35),
2703                &helpers::child_path(path, "Prtry"),
2704                config,
2705                collector,
2706            );
2707        }
2708        if let Some(ref val) = self.prtry {
2709            helpers::validate_pattern(
2710                val,
2711                "Prtry",
2712                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2713                &helpers::child_path(path, "Prtry"),
2714                config,
2715                collector,
2716            );
2717        }
2718    }
2719}
2720
2721// CreditorReferenceInformation21: Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction.
2722//
2723// 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.
2724//
2725// 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.
2726#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2727pub struct CreditorReferenceInformation21 {
2728    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2729    pub tp: Option<CreditorReferenceType21>,
2730    #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
2731    pub ref_attr: Option<String>,
2732}
2733
2734impl Validate for CreditorReferenceInformation21 {
2735    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2736        if let Some(ref val) = self.tp
2737            && config.validate_optional_fields
2738        {
2739            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2740        }
2741        if let Some(ref val) = self.ref_attr {
2742            helpers::validate_length(
2743                val,
2744                "Ref",
2745                Some(1),
2746                Some(35),
2747                &helpers::child_path(path, "Ref"),
2748                config,
2749                collector,
2750            );
2751        }
2752        if let Some(ref val) = self.ref_attr {
2753            helpers::validate_pattern(
2754                val,
2755                "Ref",
2756                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2757                &helpers::child_path(path, "Ref"),
2758                config,
2759                collector,
2760            );
2761        }
2762    }
2763}
2764
2765// CreditorReferenceType1Choice1: Creditor reference type, in a proprietary form.
2766#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2767pub struct CreditorReferenceType1Choice1 {
2768    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2769    pub cd: Option<DocumentType3Code>,
2770    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2771    pub prtry: Option<String>,
2772}
2773
2774impl Validate for CreditorReferenceType1Choice1 {
2775    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2776        if let Some(ref val) = self.cd
2777            && config.validate_optional_fields
2778        {
2779            val.validate(&helpers::child_path(path, "Cd"), config, collector);
2780        }
2781        if let Some(ref val) = self.prtry {
2782            helpers::validate_length(
2783                val,
2784                "Prtry",
2785                Some(1),
2786                Some(35),
2787                &helpers::child_path(path, "Prtry"),
2788                config,
2789                collector,
2790            );
2791        }
2792        if let Some(ref val) = self.prtry {
2793            helpers::validate_pattern(
2794                val,
2795                "Prtry",
2796                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2797                &helpers::child_path(path, "Prtry"),
2798                config,
2799                collector,
2800            );
2801        }
2802    }
2803}
2804
2805// CreditorReferenceType21: Entity that assigns the credit reference type.
2806#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2807pub struct CreditorReferenceType21 {
2808    #[serde(rename = "CdOrPrtry")]
2809    pub cd_or_prtry: CreditorReferenceType1Choice1,
2810    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2811    pub issr: Option<String>,
2812}
2813
2814impl Validate for CreditorReferenceType21 {
2815    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2816        self.cd_or_prtry
2817            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
2818        if let Some(ref val) = self.issr {
2819            helpers::validate_length(
2820                val,
2821                "Issr",
2822                Some(1),
2823                Some(35),
2824                &helpers::child_path(path, "Issr"),
2825                config,
2826                collector,
2827            );
2828        }
2829        if let Some(ref val) = self.issr {
2830            helpers::validate_pattern(
2831                val,
2832                "Issr",
2833                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2834                &helpers::child_path(path, "Issr"),
2835                config,
2836                collector,
2837            );
2838        }
2839    }
2840}
2841
2842// CurrencyExchange51: Date and time at which an exchange rate is quoted.
2843#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2844pub struct CurrencyExchange51 {
2845    #[serde(rename = "SrcCcy")]
2846    pub src_ccy: String,
2847    #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2848    pub trgt_ccy: Option<String>,
2849    #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2850    pub unit_ccy: Option<String>,
2851    #[serde(rename = "XchgRate")]
2852    pub xchg_rate: f64,
2853    #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2854    pub ctrct_id: Option<String>,
2855    #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2856    pub qtn_dt: Option<String>,
2857}
2858
2859impl Validate for CurrencyExchange51 {
2860    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2861        helpers::validate_pattern(
2862            &self.src_ccy,
2863            "SrcCcy",
2864            "[A-Z]{3,3}",
2865            &helpers::child_path(path, "SrcCcy"),
2866            config,
2867            collector,
2868        );
2869        if let Some(ref val) = self.trgt_ccy {
2870            helpers::validate_pattern(
2871                val,
2872                "TrgtCcy",
2873                "[A-Z]{3,3}",
2874                &helpers::child_path(path, "TrgtCcy"),
2875                config,
2876                collector,
2877            );
2878        }
2879        if let Some(ref val) = self.unit_ccy {
2880            helpers::validate_pattern(
2881                val,
2882                "UnitCcy",
2883                "[A-Z]{3,3}",
2884                &helpers::child_path(path, "UnitCcy"),
2885                config,
2886                collector,
2887            );
2888        }
2889        if let Some(ref val) = self.ctrct_id {
2890            helpers::validate_length(
2891                val,
2892                "CtrctId",
2893                Some(1),
2894                Some(35),
2895                &helpers::child_path(path, "CtrctId"),
2896                config,
2897                collector,
2898            );
2899        }
2900        if let Some(ref val) = self.ctrct_id {
2901            helpers::validate_pattern(
2902                val,
2903                "CtrctId",
2904                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2905                &helpers::child_path(path, "CtrctId"),
2906                config,
2907                collector,
2908            );
2909        }
2910        if let Some(ref val) = self.qtn_dt {
2911            helpers::validate_pattern(
2912                val,
2913                "QtnDt",
2914                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
2915                &helpers::child_path(path, "QtnDt"),
2916                config,
2917                collector,
2918            );
2919        }
2920    }
2921}
2922
2923// CurrencyExchange52: Date and time at which an exchange rate is quoted.
2924#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2925pub struct CurrencyExchange52 {
2926    #[serde(rename = "SrcCcy")]
2927    pub src_ccy: String,
2928    #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2929    pub trgt_ccy: Option<String>,
2930    #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2931    pub unit_ccy: Option<String>,
2932    #[serde(rename = "XchgRate")]
2933    pub xchg_rate: f64,
2934    #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2935    pub ctrct_id: Option<String>,
2936    #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2937    pub qtn_dt: Option<String>,
2938}
2939
2940impl Validate for CurrencyExchange52 {
2941    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2942        helpers::validate_pattern(
2943            &self.src_ccy,
2944            "SrcCcy",
2945            "[A-Z]{3,3}",
2946            &helpers::child_path(path, "SrcCcy"),
2947            config,
2948            collector,
2949        );
2950        if let Some(ref val) = self.trgt_ccy {
2951            helpers::validate_pattern(
2952                val,
2953                "TrgtCcy",
2954                "[A-Z]{3,3}",
2955                &helpers::child_path(path, "TrgtCcy"),
2956                config,
2957                collector,
2958            );
2959        }
2960        if let Some(ref val) = self.unit_ccy {
2961            helpers::validate_pattern(
2962                val,
2963                "UnitCcy",
2964                "[A-Z]{3,3}",
2965                &helpers::child_path(path, "UnitCcy"),
2966                config,
2967                collector,
2968            );
2969        }
2970        if let Some(ref val) = self.ctrct_id {
2971            helpers::validate_length(
2972                val,
2973                "CtrctId",
2974                Some(1),
2975                Some(35),
2976                &helpers::child_path(path, "CtrctId"),
2977                config,
2978                collector,
2979            );
2980        }
2981        if let Some(ref val) = self.ctrct_id {
2982            helpers::validate_pattern(
2983                val,
2984                "CtrctId",
2985                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2986                &helpers::child_path(path, "CtrctId"),
2987                config,
2988                collector,
2989            );
2990        }
2991    }
2992}
2993
2994// DateAndDateTime2Choice1: Specified date and time.
2995#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2996pub struct DateAndDateTime2Choice1 {
2997    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2998    pub dt: Option<String>,
2999    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3000    pub dt_tm: Option<String>,
3001}
3002
3003impl Validate for DateAndDateTime2Choice1 {
3004    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3005        if let Some(ref val) = self.dt_tm {
3006            helpers::validate_pattern(
3007                val,
3008                "DtTm",
3009                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3010                &helpers::child_path(path, "DtTm"),
3011                config,
3012                collector,
3013            );
3014        }
3015    }
3016}
3017
3018// DateAndPlaceOfBirth1: Country where a person was born.
3019#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3020pub struct DateAndPlaceOfBirth1 {
3021    #[serde(rename = "BirthDt")]
3022    pub birth_dt: String,
3023    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
3024    pub prvc_of_birth: Option<String>,
3025    #[serde(rename = "CityOfBirth")]
3026    pub city_of_birth: String,
3027    #[serde(rename = "CtryOfBirth")]
3028    pub ctry_of_birth: String,
3029}
3030
3031impl Validate for DateAndPlaceOfBirth1 {
3032    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3033        if let Some(ref val) = self.prvc_of_birth {
3034            helpers::validate_length(
3035                val,
3036                "PrvcOfBirth",
3037                Some(1),
3038                Some(35),
3039                &helpers::child_path(path, "PrvcOfBirth"),
3040                config,
3041                collector,
3042            );
3043        }
3044        helpers::validate_length(
3045            &self.city_of_birth,
3046            "CityOfBirth",
3047            Some(1),
3048            Some(35),
3049            &helpers::child_path(path, "CityOfBirth"),
3050            config,
3051            collector,
3052        );
3053        helpers::validate_pattern(
3054            &self.ctry_of_birth,
3055            "CtryOfBirth",
3056            "[A-Z]{2,2}",
3057            &helpers::child_path(path, "CtryOfBirth"),
3058            config,
3059            collector,
3060        );
3061    }
3062}
3063
3064// DateAndPlaceOfBirth11: Country where a person was born.
3065#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3066pub struct DateAndPlaceOfBirth11 {
3067    #[serde(rename = "BirthDt")]
3068    pub birth_dt: String,
3069    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
3070    pub prvc_of_birth: Option<String>,
3071    #[serde(rename = "CityOfBirth")]
3072    pub city_of_birth: String,
3073    #[serde(rename = "CtryOfBirth")]
3074    pub ctry_of_birth: String,
3075}
3076
3077impl Validate for DateAndPlaceOfBirth11 {
3078    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3079        if let Some(ref val) = self.prvc_of_birth {
3080            helpers::validate_length(
3081                val,
3082                "PrvcOfBirth",
3083                Some(1),
3084                Some(35),
3085                &helpers::child_path(path, "PrvcOfBirth"),
3086                config,
3087                collector,
3088            );
3089        }
3090        if let Some(ref val) = self.prvc_of_birth {
3091            helpers::validate_pattern(
3092                val,
3093                "PrvcOfBirth",
3094                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3095                &helpers::child_path(path, "PrvcOfBirth"),
3096                config,
3097                collector,
3098            );
3099        }
3100        helpers::validate_length(
3101            &self.city_of_birth,
3102            "CityOfBirth",
3103            Some(1),
3104            Some(35),
3105            &helpers::child_path(path, "CityOfBirth"),
3106            config,
3107            collector,
3108        );
3109        helpers::validate_pattern(
3110            &self.city_of_birth,
3111            "CityOfBirth",
3112            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3113            &helpers::child_path(path, "CityOfBirth"),
3114            config,
3115            collector,
3116        );
3117        helpers::validate_pattern(
3118            &self.ctry_of_birth,
3119            "CtryOfBirth",
3120            "[A-Z]{2,2}",
3121            &helpers::child_path(path, "CtryOfBirth"),
3122            config,
3123            collector,
3124        );
3125    }
3126}
3127
3128// DateOrDateTimePeriod1Choice1: Period expressed a dates and times.
3129#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3130pub struct DateOrDateTimePeriod1Choice1 {
3131    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3132    pub dt: Option<DatePeriod2>,
3133    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3134    pub dt_tm: Option<DateTimePeriod11>,
3135}
3136
3137impl Validate for DateOrDateTimePeriod1Choice1 {
3138    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3139        if let Some(ref val) = self.dt
3140            && config.validate_optional_fields
3141        {
3142            val.validate(&helpers::child_path(path, "Dt"), config, collector);
3143        }
3144        if let Some(ref val) = self.dt_tm
3145            && config.validate_optional_fields
3146        {
3147            val.validate(&helpers::child_path(path, "DtTm"), config, collector);
3148        }
3149    }
3150}
3151
3152// DatePeriod2: End date of the range.
3153#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3154pub struct DatePeriod2 {
3155    #[serde(rename = "FrDt")]
3156    pub fr_dt: String,
3157    #[serde(rename = "ToDt")]
3158    pub to_dt: String,
3159}
3160
3161impl Validate for DatePeriod2 {
3162    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
3163}
3164
3165// DateTimePeriod11: Date and time at which the period ends.
3166#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3167pub struct DateTimePeriod11 {
3168    #[serde(rename = "FrDtTm")]
3169    pub fr_dt_tm: String,
3170    #[serde(rename = "ToDtTm")]
3171    pub to_dt_tm: String,
3172}
3173
3174impl Validate for DateTimePeriod11 {
3175    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3176        helpers::validate_pattern(
3177            &self.fr_dt_tm,
3178            "FrDtTm",
3179            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3180            &helpers::child_path(path, "FrDtTm"),
3181            config,
3182            collector,
3183        );
3184        helpers::validate_pattern(
3185            &self.to_dt_tm,
3186            "ToDtTm",
3187            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3188            &helpers::child_path(path, "ToDtTm"),
3189            config,
3190            collector,
3191        );
3192    }
3193}
3194
3195// DiscountAmountAndType1: Amount of money, which has been typed.
3196#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3197pub struct DiscountAmountAndType1 {
3198    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3199    pub tp: Option<DiscountAmountType1Choice>,
3200    #[serde(rename = "Amt")]
3201    pub amt: ActiveOrHistoricCurrencyAndAmount,
3202}
3203
3204impl Validate for DiscountAmountAndType1 {
3205    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3206        if let Some(ref val) = self.tp
3207            && config.validate_optional_fields
3208        {
3209            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3210        }
3211        self.amt
3212            .validate(&helpers::child_path(path, "Amt"), config, collector);
3213    }
3214}
3215
3216// DiscountAmountAndType11: Amount of money, which has been typed.
3217#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3218pub struct DiscountAmountAndType11 {
3219    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3220    pub tp: Option<DiscountAmountType1Choice1>,
3221    #[serde(rename = "Amt")]
3222    pub amt: ActiveOrHistoricCurrencyAndAmount,
3223}
3224
3225impl Validate for DiscountAmountAndType11 {
3226    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3227        if let Some(ref val) = self.tp
3228            && config.validate_optional_fields
3229        {
3230            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3231        }
3232        self.amt
3233            .validate(&helpers::child_path(path, "Amt"), config, collector);
3234    }
3235}
3236
3237// DiscountAmountType1Choice: Specifies the amount type, in a free-text form.
3238#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3239pub struct DiscountAmountType1Choice {
3240    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3241    pub cd: Option<String>,
3242    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3243    pub prtry: Option<String>,
3244}
3245
3246impl Validate for DiscountAmountType1Choice {
3247    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3248        if let Some(ref val) = self.cd {
3249            helpers::validate_length(
3250                val,
3251                "Cd",
3252                Some(1),
3253                Some(4),
3254                &helpers::child_path(path, "Cd"),
3255                config,
3256                collector,
3257            );
3258        }
3259        if let Some(ref val) = self.prtry {
3260            helpers::validate_length(
3261                val,
3262                "Prtry",
3263                Some(1),
3264                Some(35),
3265                &helpers::child_path(path, "Prtry"),
3266                config,
3267                collector,
3268            );
3269        }
3270    }
3271}
3272
3273// DiscountAmountType1Choice1: Specifies the amount type, in a free-text form.
3274#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3275pub struct DiscountAmountType1Choice1 {
3276    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3277    pub cd: Option<String>,
3278    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3279    pub prtry: Option<String>,
3280}
3281
3282impl Validate for DiscountAmountType1Choice1 {
3283    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3284        if let Some(ref val) = self.cd {
3285            helpers::validate_length(
3286                val,
3287                "Cd",
3288                Some(1),
3289                Some(4),
3290                &helpers::child_path(path, "Cd"),
3291                config,
3292                collector,
3293            );
3294        }
3295        if let Some(ref val) = self.prtry {
3296            helpers::validate_length(
3297                val,
3298                "Prtry",
3299                Some(1),
3300                Some(35),
3301                &helpers::child_path(path, "Prtry"),
3302                config,
3303                collector,
3304            );
3305        }
3306        if let Some(ref val) = self.prtry {
3307            helpers::validate_pattern(
3308                val,
3309                "Prtry",
3310                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3311                &helpers::child_path(path, "Prtry"),
3312                config,
3313                collector,
3314            );
3315        }
3316    }
3317}
3318
3319// DisplayCapabilities1: Number of columns of the display component.
3320#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3321pub struct DisplayCapabilities1 {
3322    #[serde(rename = "DispTp")]
3323    pub disp_tp: UserInterface2Code,
3324    #[serde(rename = "NbOfLines")]
3325    pub nb_of_lines: String,
3326    #[serde(rename = "LineWidth")]
3327    pub line_width: String,
3328}
3329
3330impl Validate for DisplayCapabilities1 {
3331    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3332        self.disp_tp
3333            .validate(&helpers::child_path(path, "DispTp"), config, collector);
3334        helpers::validate_pattern(
3335            &self.nb_of_lines,
3336            "NbOfLines",
3337            "[0-9]{1,3}",
3338            &helpers::child_path(path, "NbOfLines"),
3339            config,
3340            collector,
3341        );
3342        helpers::validate_pattern(
3343            &self.line_width,
3344            "LineWidth",
3345            "[0-9]{1,3}",
3346            &helpers::child_path(path, "LineWidth"),
3347            config,
3348            collector,
3349        );
3350    }
3351}
3352
3353// DocumentAdjustment11: Provides further details on the document adjustment.
3354#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3355pub struct DocumentAdjustment11 {
3356    #[serde(rename = "Amt")]
3357    pub amt: ActiveOrHistoricCurrencyAndAmount,
3358    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
3359    pub cdt_dbt_ind: Option<CreditDebitCode>,
3360    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
3361    pub rsn: Option<String>,
3362    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
3363    pub addtl_inf: Option<String>,
3364}
3365
3366impl Validate for DocumentAdjustment11 {
3367    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3368        self.amt
3369            .validate(&helpers::child_path(path, "Amt"), config, collector);
3370        if let Some(ref val) = self.cdt_dbt_ind
3371            && config.validate_optional_fields
3372        {
3373            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
3374        }
3375        if let Some(ref val) = self.rsn {
3376            helpers::validate_length(
3377                val,
3378                "Rsn",
3379                Some(1),
3380                Some(4),
3381                &helpers::child_path(path, "Rsn"),
3382                config,
3383                collector,
3384            );
3385        }
3386        if let Some(ref val) = self.rsn {
3387            helpers::validate_pattern(
3388                val,
3389                "Rsn",
3390                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3391                &helpers::child_path(path, "Rsn"),
3392                config,
3393                collector,
3394            );
3395        }
3396        if let Some(ref val) = self.addtl_inf {
3397            helpers::validate_length(
3398                val,
3399                "AddtlInf",
3400                Some(1),
3401                Some(140),
3402                &helpers::child_path(path, "AddtlInf"),
3403                config,
3404                collector,
3405            );
3406        }
3407        if let Some(ref val) = self.addtl_inf {
3408            helpers::validate_pattern(
3409                val,
3410                "AddtlInf",
3411                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3412                &helpers::child_path(path, "AddtlInf"),
3413                config,
3414                collector,
3415            );
3416        }
3417    }
3418}
3419
3420// DocumentLineIdentification11: Date associated with the referred document line.
3421#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3422pub struct DocumentLineIdentification11 {
3423    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3424    pub tp: Option<DocumentLineType11>,
3425    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
3426    pub nb: Option<String>,
3427    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
3428    pub rltd_dt: Option<String>,
3429}
3430
3431impl Validate for DocumentLineIdentification11 {
3432    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3433        if let Some(ref val) = self.tp
3434            && config.validate_optional_fields
3435        {
3436            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3437        }
3438        if let Some(ref val) = self.nb {
3439            helpers::validate_length(
3440                val,
3441                "Nb",
3442                Some(1),
3443                Some(35),
3444                &helpers::child_path(path, "Nb"),
3445                config,
3446                collector,
3447            );
3448        }
3449        if let Some(ref val) = self.nb {
3450            helpers::validate_pattern(
3451                val,
3452                "Nb",
3453                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3454                &helpers::child_path(path, "Nb"),
3455                config,
3456                collector,
3457            );
3458        }
3459    }
3460}
3461
3462// DocumentLineInformation11: Provides details on the amounts of the document line.
3463#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3464pub struct DocumentLineInformation11 {
3465    #[serde(rename = "Id")]
3466    pub id: Vec<DocumentLineIdentification11>,
3467    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
3468    pub desc: Option<String>,
3469    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
3470    pub amt: Option<RemittanceAmount31>,
3471}
3472
3473impl Validate for DocumentLineInformation11 {
3474    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3475        for item in &self.id {
3476            item.validate(&helpers::child_path(path, "Id"), config, collector);
3477        }
3478        if let Some(ref val) = self.desc {
3479            helpers::validate_length(
3480                val,
3481                "Desc",
3482                Some(1),
3483                Some(2048),
3484                &helpers::child_path(path, "Desc"),
3485                config,
3486                collector,
3487            );
3488        }
3489        if let Some(ref val) = self.desc {
3490            helpers::validate_pattern(
3491                val,
3492                "Desc",
3493                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3494                &helpers::child_path(path, "Desc"),
3495                config,
3496                collector,
3497            );
3498        }
3499        if let Some(ref val) = self.amt
3500            && config.validate_optional_fields
3501        {
3502            val.validate(&helpers::child_path(path, "Amt"), config, collector);
3503        }
3504    }
3505}
3506
3507// DocumentLineType1Choice1: Proprietary identification of the type of the remittance document.
3508#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3509pub struct DocumentLineType1Choice1 {
3510    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3511    pub cd: Option<String>,
3512    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3513    pub prtry: Option<String>,
3514}
3515
3516impl Validate for DocumentLineType1Choice1 {
3517    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3518        if let Some(ref val) = self.cd {
3519            helpers::validate_length(
3520                val,
3521                "Cd",
3522                Some(1),
3523                Some(4),
3524                &helpers::child_path(path, "Cd"),
3525                config,
3526                collector,
3527            );
3528        }
3529        if let Some(ref val) = self.prtry {
3530            helpers::validate_length(
3531                val,
3532                "Prtry",
3533                Some(1),
3534                Some(35),
3535                &helpers::child_path(path, "Prtry"),
3536                config,
3537                collector,
3538            );
3539        }
3540        if let Some(ref val) = self.prtry {
3541            helpers::validate_pattern(
3542                val,
3543                "Prtry",
3544                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3545                &helpers::child_path(path, "Prtry"),
3546                config,
3547                collector,
3548            );
3549        }
3550    }
3551}
3552
3553// DocumentLineType11: Identification of the issuer of the reference document line identificationtype.
3554#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3555pub struct DocumentLineType11 {
3556    #[serde(rename = "CdOrPrtry")]
3557    pub cd_or_prtry: DocumentLineType1Choice1,
3558    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3559    pub issr: Option<String>,
3560}
3561
3562impl Validate for DocumentLineType11 {
3563    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3564        self.cd_or_prtry
3565            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
3566        if let Some(ref val) = self.issr {
3567            helpers::validate_length(
3568                val,
3569                "Issr",
3570                Some(1),
3571                Some(35),
3572                &helpers::child_path(path, "Issr"),
3573                config,
3574                collector,
3575            );
3576        }
3577        if let Some(ref val) = self.issr {
3578            helpers::validate_pattern(
3579                val,
3580                "Issr",
3581                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3582                &helpers::child_path(path, "Issr"),
3583                config,
3584                collector,
3585            );
3586        }
3587    }
3588}
3589
3590// DocumentType3Code: Document is a structured communication reference provided by the creditor to identify the referred transaction.
3591#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3592pub enum DocumentType3Code {
3593    #[default]
3594    #[serde(rename = "RADM")]
3595    CodeRADM,
3596    #[serde(rename = "RPIN")]
3597    CodeRPIN,
3598    #[serde(rename = "FXDR")]
3599    CodeFXDR,
3600    #[serde(rename = "DISP")]
3601    CodeDISP,
3602    #[serde(rename = "PUOR")]
3603    CodePUOR,
3604    #[serde(rename = "SCOR")]
3605    CodeSCOR,
3606}
3607
3608impl Validate for DocumentType3Code {
3609    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3610        // Enum validation is typically empty
3611    }
3612}
3613
3614// DocumentType6Code: Document is a purchase order.
3615#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3616pub enum DocumentType6Code {
3617    #[default]
3618    #[serde(rename = "MSIN")]
3619    CodeMSIN,
3620    #[serde(rename = "CNFA")]
3621    CodeCNFA,
3622    #[serde(rename = "DNFA")]
3623    CodeDNFA,
3624    #[serde(rename = "CINV")]
3625    CodeCINV,
3626    #[serde(rename = "CREN")]
3627    CodeCREN,
3628    #[serde(rename = "DEBN")]
3629    CodeDEBN,
3630    #[serde(rename = "HIRI")]
3631    CodeHIRI,
3632    #[serde(rename = "SBIN")]
3633    CodeSBIN,
3634    #[serde(rename = "CMCN")]
3635    CodeCMCN,
3636    #[serde(rename = "SOAC")]
3637    CodeSOAC,
3638    #[serde(rename = "DISP")]
3639    CodeDISP,
3640    #[serde(rename = "BOLD")]
3641    CodeBOLD,
3642    #[serde(rename = "VCHR")]
3643    CodeVCHR,
3644    #[serde(rename = "AROI")]
3645    CodeAROI,
3646    #[serde(rename = "TSUT")]
3647    CodeTSUT,
3648    #[serde(rename = "PUOR")]
3649    CodePUOR,
3650}
3651
3652impl Validate for DocumentType6Code {
3653    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3654        // Enum validation is typically empty
3655    }
3656}
3657
3658// EntryDetails91: Provides information on the underlying transaction(s).
3659#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3660pub struct EntryDetails91 {
3661    #[serde(rename = "Btch", skip_serializing_if = "Option::is_none")]
3662    pub btch: Option<BatchInformation21>,
3663    #[serde(rename = "TxDtls")]
3664    pub tx_dtls: Box<EntryTransaction101>,
3665}
3666
3667impl Validate for EntryDetails91 {
3668    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3669        if let Some(ref val) = self.btch
3670            && config.validate_optional_fields
3671        {
3672            val.validate(&helpers::child_path(path, "Btch"), config, collector);
3673        }
3674        self.tx_dtls
3675            .validate(&helpers::child_path(path, "TxDtls"), config, collector);
3676    }
3677}
3678
3679// EntryStatus1Choice1: Entry status, in a coded form.
3680#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3681pub struct EntryStatus1Choice1 {
3682    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3683    pub cd: Option<String>,
3684}
3685
3686impl Validate for EntryStatus1Choice1 {
3687    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3688        if let Some(ref val) = self.cd {
3689            helpers::validate_length(
3690                val,
3691                "Cd",
3692                Some(1),
3693                Some(4),
3694                &helpers::child_path(path, "Cd"),
3695                config,
3696                collector,
3697            );
3698        }
3699    }
3700}
3701
3702// EntryTransaction101: Further details of the transaction.
3703#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3704pub struct EntryTransaction101 {
3705    #[serde(rename = "Refs")]
3706    pub refs: TransactionReferences61,
3707    #[serde(rename = "Amt")]
3708    pub amt: ActiveOrHistoricCurrencyAndAmount,
3709    #[serde(rename = "CdtDbtInd")]
3710    pub cdt_dbt_ind: CreditDebitCode,
3711    #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
3712    pub amt_dtls: Option<AmountAndCurrencyExchange32>,
3713    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
3714    pub avlbty: Option<Vec<CashAvailability1>>,
3715    #[serde(rename = "BkTxCd", skip_serializing_if = "Option::is_none")]
3716    pub bk_tx_cd: Option<BankTransactionCodeStructure41>,
3717    #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
3718    pub chrgs: Option<Charges61>,
3719    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
3720    pub intrst: Option<TransactionInterest41>,
3721    #[serde(rename = "RltdPties", skip_serializing_if = "Option::is_none")]
3722    pub rltd_pties: Option<TransactionParties61>,
3723    #[serde(rename = "RltdAgts", skip_serializing_if = "Option::is_none")]
3724    pub rltd_agts: Option<TransactionAgents51>,
3725    #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3726    pub lcl_instrm: Option<LocalInstrument2Choice1>,
3727    #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
3728    pub purp: Option<Purpose2Choice1>,
3729    #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
3730    pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
3731    #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
3732    pub rmt_inf: Option<RemittanceInformation161>,
3733    #[serde(rename = "RltdDts", skip_serializing_if = "Option::is_none")]
3734    pub rltd_dts: Option<TransactionDates31>,
3735    #[serde(rename = "RltdPric", skip_serializing_if = "Option::is_none")]
3736    pub rltd_pric: Option<TransactionPrice4Choice1>,
3737    #[serde(rename = "RltdQties", skip_serializing_if = "Option::is_none")]
3738    pub rltd_qties: Option<Vec<TransactionQuantities3Choice1>>,
3739    #[serde(rename = "FinInstrmId", skip_serializing_if = "Option::is_none")]
3740    pub fin_instrm_id: Option<SecurityIdentification191>,
3741    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
3742    pub tax: Option<TaxInformation81>,
3743    #[serde(rename = "RtrInf", skip_serializing_if = "Option::is_none")]
3744    pub rtr_inf: Option<PaymentReturnReason51>,
3745    #[serde(rename = "CorpActn", skip_serializing_if = "Option::is_none")]
3746    pub corp_actn: Option<CorporateAction91>,
3747    #[serde(rename = "SfkpgAcct", skip_serializing_if = "Option::is_none")]
3748    pub sfkpg_acct: Option<SecuritiesAccount191>,
3749    #[serde(rename = "CshDpst", skip_serializing_if = "Option::is_none")]
3750    pub csh_dpst: Option<Vec<CashDeposit11>>,
3751    #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
3752    pub card_tx: Option<CardTransaction171>,
3753    #[serde(rename = "AddtlTxInf", skip_serializing_if = "Option::is_none")]
3754    pub addtl_tx_inf: Option<String>,
3755}
3756
3757impl Validate for EntryTransaction101 {
3758    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3759        self.refs
3760            .validate(&helpers::child_path(path, "Refs"), config, collector);
3761        self.amt
3762            .validate(&helpers::child_path(path, "Amt"), config, collector);
3763        self.cdt_dbt_ind
3764            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
3765        if let Some(ref val) = self.amt_dtls
3766            && config.validate_optional_fields
3767        {
3768            val.validate(&helpers::child_path(path, "AmtDtls"), config, collector);
3769        }
3770        if let Some(ref vec) = self.avlbty
3771            && config.validate_optional_fields
3772        {
3773            for item in vec {
3774                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
3775            }
3776        }
3777        if let Some(ref val) = self.bk_tx_cd
3778            && config.validate_optional_fields
3779        {
3780            val.validate(&helpers::child_path(path, "BkTxCd"), config, collector);
3781        }
3782        if let Some(ref val) = self.chrgs
3783            && config.validate_optional_fields
3784        {
3785            val.validate(&helpers::child_path(path, "Chrgs"), config, collector);
3786        }
3787        if let Some(ref val) = self.intrst
3788            && config.validate_optional_fields
3789        {
3790            val.validate(&helpers::child_path(path, "Intrst"), config, collector);
3791        }
3792        if let Some(ref val) = self.rltd_pties
3793            && config.validate_optional_fields
3794        {
3795            val.validate(&helpers::child_path(path, "RltdPties"), config, collector);
3796        }
3797        if let Some(ref val) = self.rltd_agts
3798            && config.validate_optional_fields
3799        {
3800            val.validate(&helpers::child_path(path, "RltdAgts"), config, collector);
3801        }
3802        if let Some(ref val) = self.lcl_instrm
3803            && config.validate_optional_fields
3804        {
3805            val.validate(&helpers::child_path(path, "LclInstrm"), config, collector);
3806        }
3807        if let Some(ref val) = self.purp
3808            && config.validate_optional_fields
3809        {
3810            val.validate(&helpers::child_path(path, "Purp"), config, collector);
3811        }
3812        if let Some(ref vec) = self.rltd_rmt_inf
3813            && config.validate_optional_fields
3814        {
3815            for item in vec {
3816                item.validate(&helpers::child_path(path, "RltdRmtInf"), config, collector);
3817            }
3818        }
3819        if let Some(ref val) = self.rmt_inf
3820            && config.validate_optional_fields
3821        {
3822            val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
3823        }
3824        if let Some(ref val) = self.rltd_dts
3825            && config.validate_optional_fields
3826        {
3827            val.validate(&helpers::child_path(path, "RltdDts"), config, collector);
3828        }
3829        if let Some(ref val) = self.rltd_pric
3830            && config.validate_optional_fields
3831        {
3832            val.validate(&helpers::child_path(path, "RltdPric"), config, collector);
3833        }
3834        if let Some(ref vec) = self.rltd_qties
3835            && config.validate_optional_fields
3836        {
3837            for item in vec {
3838                item.validate(&helpers::child_path(path, "RltdQties"), config, collector);
3839            }
3840        }
3841        if let Some(ref val) = self.fin_instrm_id
3842            && config.validate_optional_fields
3843        {
3844            val.validate(&helpers::child_path(path, "FinInstrmId"), config, collector);
3845        }
3846        if let Some(ref val) = self.tax
3847            && config.validate_optional_fields
3848        {
3849            val.validate(&helpers::child_path(path, "Tax"), config, collector);
3850        }
3851        if let Some(ref val) = self.rtr_inf
3852            && config.validate_optional_fields
3853        {
3854            val.validate(&helpers::child_path(path, "RtrInf"), config, collector);
3855        }
3856        if let Some(ref val) = self.corp_actn
3857            && config.validate_optional_fields
3858        {
3859            val.validate(&helpers::child_path(path, "CorpActn"), config, collector);
3860        }
3861        if let Some(ref val) = self.sfkpg_acct
3862            && config.validate_optional_fields
3863        {
3864            val.validate(&helpers::child_path(path, "SfkpgAcct"), config, collector);
3865        }
3866        if let Some(ref vec) = self.csh_dpst
3867            && config.validate_optional_fields
3868        {
3869            for item in vec {
3870                item.validate(&helpers::child_path(path, "CshDpst"), config, collector);
3871            }
3872        }
3873        if let Some(ref val) = self.card_tx
3874            && config.validate_optional_fields
3875        {
3876            val.validate(&helpers::child_path(path, "CardTx"), config, collector);
3877        }
3878        if let Some(ref val) = self.addtl_tx_inf {
3879            helpers::validate_length(
3880                val,
3881                "AddtlTxInf",
3882                Some(1),
3883                Some(500),
3884                &helpers::child_path(path, "AddtlTxInf"),
3885                config,
3886                collector,
3887            );
3888        }
3889        if let Some(ref val) = self.addtl_tx_inf {
3890            helpers::validate_pattern(
3891                val,
3892                "AddtlTxInf",
3893                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3894                &helpers::child_path(path, "AddtlTxInf"),
3895                config,
3896                collector,
3897            );
3898        }
3899    }
3900}
3901
3902// FinancialIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
3903#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3904pub struct FinancialIdentificationSchemeName1Choice1 {
3905    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3906    pub cd: Option<String>,
3907    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3908    pub prtry: Option<String>,
3909}
3910
3911impl Validate for FinancialIdentificationSchemeName1Choice1 {
3912    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3913        if let Some(ref val) = self.cd {
3914            helpers::validate_length(
3915                val,
3916                "Cd",
3917                Some(1),
3918                Some(4),
3919                &helpers::child_path(path, "Cd"),
3920                config,
3921                collector,
3922            );
3923        }
3924        if let Some(ref val) = self.prtry {
3925            helpers::validate_length(
3926                val,
3927                "Prtry",
3928                Some(1),
3929                Some(35),
3930                &helpers::child_path(path, "Prtry"),
3931                config,
3932                collector,
3933            );
3934        }
3935        if let Some(ref val) = self.prtry {
3936            helpers::validate_pattern(
3937                val,
3938                "Prtry",
3939                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3940                &helpers::child_path(path, "Prtry"),
3941                config,
3942                collector,
3943            );
3944        }
3945    }
3946}
3947
3948// FinancialInstitutionIdentification181: Unique identification of an agent, as assigned by an institution, using an identification scheme.
3949#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3950pub struct FinancialInstitutionIdentification181 {
3951    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
3952    pub bicfi: Option<String>,
3953    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
3954    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
3955    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3956    pub lei: Option<String>,
3957    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3958    pub nm: Option<String>,
3959    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3960    pub pstl_adr: Option<PostalAddress241>,
3961    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3962    pub othr: Option<GenericFinancialIdentification11>,
3963}
3964
3965impl Validate for FinancialInstitutionIdentification181 {
3966    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3967        if let Some(ref val) = self.bicfi {
3968            helpers::validate_pattern(
3969                val,
3970                "BICFI",
3971                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
3972                &helpers::child_path(path, "BICFI"),
3973                config,
3974                collector,
3975            );
3976        }
3977        if let Some(ref val) = self.clr_sys_mmb_id
3978            && config.validate_optional_fields
3979        {
3980            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
3981        }
3982        if let Some(ref val) = self.lei {
3983            helpers::validate_pattern(
3984                val,
3985                "LEI",
3986                "[A-Z0-9]{18,18}[0-9]{2,2}",
3987                &helpers::child_path(path, "LEI"),
3988                config,
3989                collector,
3990            );
3991        }
3992        if let Some(ref val) = self.nm {
3993            helpers::validate_length(
3994                val,
3995                "Nm",
3996                Some(1),
3997                Some(140),
3998                &helpers::child_path(path, "Nm"),
3999                config,
4000                collector,
4001            );
4002        }
4003        if let Some(ref val) = self.nm {
4004            helpers::validate_pattern(
4005                val,
4006                "Nm",
4007                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4008                &helpers::child_path(path, "Nm"),
4009                config,
4010                collector,
4011            );
4012        }
4013        if let Some(ref val) = self.pstl_adr
4014            && config.validate_optional_fields
4015        {
4016            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4017        }
4018        if let Some(ref val) = self.othr
4019            && config.validate_optional_fields
4020        {
4021            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4022        }
4023    }
4024}
4025
4026// FinancialInstitutionIdentification182: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4027#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4028pub struct FinancialInstitutionIdentification182 {
4029    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4030    pub bicfi: Option<String>,
4031    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4032    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
4033    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4034    pub lei: Option<String>,
4035    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4036    pub nm: Option<String>,
4037    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4038    pub pstl_adr: Option<PostalAddress241>,
4039    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4040    pub othr: Option<GenericFinancialIdentification11>,
4041}
4042
4043impl Validate for FinancialInstitutionIdentification182 {
4044    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4045        if let Some(ref val) = self.bicfi {
4046            helpers::validate_pattern(
4047                val,
4048                "BICFI",
4049                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4050                &helpers::child_path(path, "BICFI"),
4051                config,
4052                collector,
4053            );
4054        }
4055        if let Some(ref val) = self.clr_sys_mmb_id
4056            && config.validate_optional_fields
4057        {
4058            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4059        }
4060        if let Some(ref val) = self.lei {
4061            helpers::validate_pattern(
4062                val,
4063                "LEI",
4064                "[A-Z0-9]{18,18}[0-9]{2,2}",
4065                &helpers::child_path(path, "LEI"),
4066                config,
4067                collector,
4068            );
4069        }
4070        if let Some(ref val) = self.nm {
4071            helpers::validate_length(
4072                val,
4073                "Nm",
4074                Some(1),
4075                Some(140),
4076                &helpers::child_path(path, "Nm"),
4077                config,
4078                collector,
4079            );
4080        }
4081        if let Some(ref val) = self.nm {
4082            helpers::validate_pattern(
4083                val,
4084                "Nm",
4085                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4086                &helpers::child_path(path, "Nm"),
4087                config,
4088                collector,
4089            );
4090        }
4091        if let Some(ref val) = self.pstl_adr
4092            && config.validate_optional_fields
4093        {
4094            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4095        }
4096        if let Some(ref val) = self.othr
4097            && config.validate_optional_fields
4098        {
4099            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4100        }
4101    }
4102}
4103
4104// 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.
4105#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4106pub struct FinancialInstrumentQuantity1Choice {
4107    #[serde(rename = "Unit", skip_serializing_if = "Option::is_none")]
4108    pub unit: Option<f64>,
4109    #[serde(rename = "FaceAmt", skip_serializing_if = "Option::is_none")]
4110    pub face_amt: Option<f64>,
4111    #[serde(rename = "AmtsdVal", skip_serializing_if = "Option::is_none")]
4112    pub amtsd_val: Option<f64>,
4113}
4114
4115impl Validate for FinancialInstrumentQuantity1Choice {
4116    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
4117}
4118
4119// FromToAmountRange1: Upper boundary of a range of amount values.
4120#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4121pub struct FromToAmountRange1 {
4122    #[serde(rename = "FrAmt")]
4123    pub fr_amt: AmountRangeBoundary1,
4124    #[serde(rename = "ToAmt")]
4125    pub to_amt: AmountRangeBoundary1,
4126}
4127
4128impl Validate for FromToAmountRange1 {
4129    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4130        self.fr_amt
4131            .validate(&helpers::child_path(path, "FrAmt"), config, collector);
4132        self.to_amt
4133            .validate(&helpers::child_path(path, "ToAmt"), config, collector);
4134    }
4135}
4136
4137// Garnishment31: Indicates if the employment of the person to whom the garnishment applies (that is, the ultimate debtor) has been terminated.
4138#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4139pub struct Garnishment31 {
4140    #[serde(rename = "Tp")]
4141    pub tp: GarnishmentType11,
4142    #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
4143    pub grnshee: Option<PartyIdentification1355>,
4144    #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
4145    pub grnshmt_admstr: Option<PartyIdentification1356>,
4146    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4147    pub ref_nb: Option<String>,
4148    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4149    pub dt: Option<String>,
4150    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4151    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4152    #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
4153    pub fmly_mdcl_insrnc_ind: Option<bool>,
4154    #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
4155    pub mplyee_termntn_ind: Option<bool>,
4156}
4157
4158impl Validate for Garnishment31 {
4159    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4160        self.tp
4161            .validate(&helpers::child_path(path, "Tp"), config, collector);
4162        if let Some(ref val) = self.grnshee
4163            && config.validate_optional_fields
4164        {
4165            val.validate(&helpers::child_path(path, "Grnshee"), config, collector);
4166        }
4167        if let Some(ref val) = self.grnshmt_admstr
4168            && config.validate_optional_fields
4169        {
4170            val.validate(
4171                &helpers::child_path(path, "GrnshmtAdmstr"),
4172                config,
4173                collector,
4174            );
4175        }
4176        if let Some(ref val) = self.ref_nb {
4177            helpers::validate_length(
4178                val,
4179                "RefNb",
4180                Some(1),
4181                Some(140),
4182                &helpers::child_path(path, "RefNb"),
4183                config,
4184                collector,
4185            );
4186        }
4187        if let Some(ref val) = self.ref_nb {
4188            helpers::validate_pattern(
4189                val,
4190                "RefNb",
4191                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4192                &helpers::child_path(path, "RefNb"),
4193                config,
4194                collector,
4195            );
4196        }
4197        if let Some(ref val) = self.rmtd_amt
4198            && config.validate_optional_fields
4199        {
4200            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
4201        }
4202    }
4203}
4204
4205// GarnishmentType1Choice1: Proprietary identification of the type of garnishment.
4206#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4207pub struct GarnishmentType1Choice1 {
4208    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4209    pub cd: Option<String>,
4210    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4211    pub prtry: Option<String>,
4212}
4213
4214impl Validate for GarnishmentType1Choice1 {
4215    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4216        if let Some(ref val) = self.cd {
4217            helpers::validate_length(
4218                val,
4219                "Cd",
4220                Some(1),
4221                Some(4),
4222                &helpers::child_path(path, "Cd"),
4223                config,
4224                collector,
4225            );
4226        }
4227        if let Some(ref val) = self.prtry {
4228            helpers::validate_length(
4229                val,
4230                "Prtry",
4231                Some(1),
4232                Some(35),
4233                &helpers::child_path(path, "Prtry"),
4234                config,
4235                collector,
4236            );
4237        }
4238        if let Some(ref val) = self.prtry {
4239            helpers::validate_pattern(
4240                val,
4241                "Prtry",
4242                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4243                &helpers::child_path(path, "Prtry"),
4244                config,
4245                collector,
4246            );
4247        }
4248    }
4249}
4250
4251// GarnishmentType11: Identification of the issuer of the garnishment type.
4252#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4253pub struct GarnishmentType11 {
4254    #[serde(rename = "CdOrPrtry")]
4255    pub cd_or_prtry: GarnishmentType1Choice1,
4256    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4257    pub issr: Option<String>,
4258}
4259
4260impl Validate for GarnishmentType11 {
4261    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4262        self.cd_or_prtry
4263            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
4264        if let Some(ref val) = self.issr {
4265            helpers::validate_length(
4266                val,
4267                "Issr",
4268                Some(1),
4269                Some(35),
4270                &helpers::child_path(path, "Issr"),
4271                config,
4272                collector,
4273            );
4274        }
4275        if let Some(ref val) = self.issr {
4276            helpers::validate_pattern(
4277                val,
4278                "Issr",
4279                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4280                &helpers::child_path(path, "Issr"),
4281                config,
4282                collector,
4283            );
4284        }
4285    }
4286}
4287
4288// GenericAccountIdentification11: Entity that assigns the identification.
4289#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4290pub struct GenericAccountIdentification11 {
4291    #[serde(rename = "Id")]
4292    pub id: String,
4293    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4294    pub schme_nm: Option<AccountSchemeName1Choice1>,
4295    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4296    pub issr: Option<String>,
4297}
4298
4299impl Validate for GenericAccountIdentification11 {
4300    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4301        helpers::validate_length(
4302            &self.id,
4303            "Id",
4304            Some(1),
4305            Some(34),
4306            &helpers::child_path(path, "Id"),
4307            config,
4308            collector,
4309        );
4310        helpers::validate_pattern(
4311            &self.id,
4312            "Id",
4313            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
4314            &helpers::child_path(path, "Id"),
4315            config,
4316            collector,
4317        );
4318        if let Some(ref val) = self.schme_nm
4319            && config.validate_optional_fields
4320        {
4321            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4322        }
4323        if let Some(ref val) = self.issr {
4324            helpers::validate_length(
4325                val,
4326                "Issr",
4327                Some(1),
4328                Some(35),
4329                &helpers::child_path(path, "Issr"),
4330                config,
4331                collector,
4332            );
4333        }
4334        if let Some(ref val) = self.issr {
4335            helpers::validate_pattern(
4336                val,
4337                "Issr",
4338                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4339                &helpers::child_path(path, "Issr"),
4340                config,
4341                collector,
4342            );
4343        }
4344    }
4345}
4346
4347// GenericFinancialIdentification11: Entity that assigns the identification.
4348#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4349pub struct GenericFinancialIdentification11 {
4350    #[serde(rename = "Id")]
4351    pub id: String,
4352    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4353    pub schme_nm: Option<FinancialIdentificationSchemeName1Choice1>,
4354    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4355    pub issr: Option<String>,
4356}
4357
4358impl Validate for GenericFinancialIdentification11 {
4359    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4360        helpers::validate_length(
4361            &self.id,
4362            "Id",
4363            Some(1),
4364            Some(35),
4365            &helpers::child_path(path, "Id"),
4366            config,
4367            collector,
4368        );
4369        helpers::validate_pattern(
4370            &self.id,
4371            "Id",
4372            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4373            &helpers::child_path(path, "Id"),
4374            config,
4375            collector,
4376        );
4377        if let Some(ref val) = self.schme_nm
4378            && config.validate_optional_fields
4379        {
4380            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4381        }
4382        if let Some(ref val) = self.issr {
4383            helpers::validate_length(
4384                val,
4385                "Issr",
4386                Some(1),
4387                Some(35),
4388                &helpers::child_path(path, "Issr"),
4389                config,
4390                collector,
4391            );
4392        }
4393        if let Some(ref val) = self.issr {
4394            helpers::validate_pattern(
4395                val,
4396                "Issr",
4397                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4398                &helpers::child_path(path, "Issr"),
4399                config,
4400                collector,
4401            );
4402        }
4403    }
4404}
4405
4406// GenericIdentification11: Entity that assigns the identification.
4407#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4408pub struct GenericIdentification11 {
4409    #[serde(rename = "Id")]
4410    pub id: String,
4411    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4412    pub schme_nm: Option<String>,
4413    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4414    pub issr: Option<String>,
4415}
4416
4417impl Validate for GenericIdentification11 {
4418    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4419        helpers::validate_length(
4420            &self.id,
4421            "Id",
4422            Some(1),
4423            Some(35),
4424            &helpers::child_path(path, "Id"),
4425            config,
4426            collector,
4427        );
4428        helpers::validate_pattern(
4429            &self.id,
4430            "Id",
4431            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4432            &helpers::child_path(path, "Id"),
4433            config,
4434            collector,
4435        );
4436        if let Some(ref val) = self.schme_nm {
4437            helpers::validate_length(
4438                val,
4439                "SchmeNm",
4440                Some(1),
4441                Some(35),
4442                &helpers::child_path(path, "SchmeNm"),
4443                config,
4444                collector,
4445            );
4446        }
4447        if let Some(ref val) = self.schme_nm {
4448            helpers::validate_pattern(
4449                val,
4450                "SchmeNm",
4451                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4452                &helpers::child_path(path, "SchmeNm"),
4453                config,
4454                collector,
4455            );
4456        }
4457        if let Some(ref val) = self.issr {
4458            helpers::validate_length(
4459                val,
4460                "Issr",
4461                Some(1),
4462                Some(35),
4463                &helpers::child_path(path, "Issr"),
4464                config,
4465                collector,
4466            );
4467        }
4468        if let Some(ref val) = self.issr {
4469            helpers::validate_pattern(
4470                val,
4471                "Issr",
4472                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4473                &helpers::child_path(path, "Issr"),
4474                config,
4475                collector,
4476            );
4477        }
4478    }
4479}
4480
4481// GenericIdentification301: Short textual description of the scheme.
4482#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4483pub struct GenericIdentification301 {
4484    #[serde(rename = "Id")]
4485    pub id: String,
4486    #[serde(rename = "Issr")]
4487    pub issr: String,
4488    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4489    pub schme_nm: Option<String>,
4490}
4491
4492impl Validate for GenericIdentification301 {
4493    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4494        helpers::validate_pattern(
4495            &self.id,
4496            "Id",
4497            "[a-zA-Z0-9]{4}",
4498            &helpers::child_path(path, "Id"),
4499            config,
4500            collector,
4501        );
4502        helpers::validate_length(
4503            &self.issr,
4504            "Issr",
4505            Some(1),
4506            Some(35),
4507            &helpers::child_path(path, "Issr"),
4508            config,
4509            collector,
4510        );
4511        helpers::validate_pattern(
4512            &self.issr,
4513            "Issr",
4514            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4515            &helpers::child_path(path, "Issr"),
4516            config,
4517            collector,
4518        );
4519        if let Some(ref val) = self.schme_nm {
4520            helpers::validate_length(
4521                val,
4522                "SchmeNm",
4523                Some(1),
4524                Some(35),
4525                &helpers::child_path(path, "SchmeNm"),
4526                config,
4527                collector,
4528            );
4529        }
4530        if let Some(ref val) = self.schme_nm {
4531            helpers::validate_pattern(
4532                val,
4533                "SchmeNm",
4534                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4535                &helpers::child_path(path, "SchmeNm"),
4536                config,
4537                collector,
4538            );
4539        }
4540    }
4541}
4542
4543// GenericIdentification302: Short textual description of the scheme.
4544#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4545pub struct GenericIdentification302 {
4546    #[serde(rename = "Id")]
4547    pub id: String,
4548    #[serde(rename = "Issr")]
4549    pub issr: String,
4550    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4551    pub schme_nm: Option<String>,
4552}
4553
4554impl Validate for GenericIdentification302 {
4555    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4556        helpers::validate_pattern(
4557            &self.id,
4558            "Id",
4559            "[a-zA-Z0-9]{4}",
4560            &helpers::child_path(path, "Id"),
4561            config,
4562            collector,
4563        );
4564        helpers::validate_length(
4565            &self.issr,
4566            "Issr",
4567            Some(1),
4568            Some(35),
4569            &helpers::child_path(path, "Issr"),
4570            config,
4571            collector,
4572        );
4573        helpers::validate_pattern(
4574            &self.issr,
4575            "Issr",
4576            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4577            &helpers::child_path(path, "Issr"),
4578            config,
4579            collector,
4580        );
4581        if let Some(ref val) = self.schme_nm {
4582            helpers::validate_length(
4583                val,
4584                "SchmeNm",
4585                Some(1),
4586                Some(35),
4587                &helpers::child_path(path, "SchmeNm"),
4588                config,
4589                collector,
4590            );
4591        }
4592        if let Some(ref val) = self.schme_nm {
4593            helpers::validate_pattern(
4594                val,
4595                "SchmeNm",
4596                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4597                &helpers::child_path(path, "SchmeNm"),
4598                config,
4599                collector,
4600            );
4601        }
4602    }
4603}
4604
4605// GenericIdentification321: Name of the entity.
4606#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4607pub struct GenericIdentification321 {
4608    #[serde(rename = "Id")]
4609    pub id: String,
4610    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4611    pub tp: Option<PartyType3Code>,
4612    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4613    pub issr: Option<PartyType4Code>,
4614    #[serde(rename = "ShrtNm", skip_serializing_if = "Option::is_none")]
4615    pub shrt_nm: Option<String>,
4616}
4617
4618impl Validate for GenericIdentification321 {
4619    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4620        helpers::validate_length(
4621            &self.id,
4622            "Id",
4623            Some(1),
4624            Some(35),
4625            &helpers::child_path(path, "Id"),
4626            config,
4627            collector,
4628        );
4629        helpers::validate_pattern(
4630            &self.id,
4631            "Id",
4632            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4633            &helpers::child_path(path, "Id"),
4634            config,
4635            collector,
4636        );
4637        if let Some(ref val) = self.tp
4638            && config.validate_optional_fields
4639        {
4640            val.validate(&helpers::child_path(path, "Tp"), config, collector);
4641        }
4642        if let Some(ref val) = self.issr
4643            && config.validate_optional_fields
4644        {
4645            val.validate(&helpers::child_path(path, "Issr"), config, collector);
4646        }
4647        if let Some(ref val) = self.shrt_nm {
4648            helpers::validate_length(
4649                val,
4650                "ShrtNm",
4651                Some(1),
4652                Some(35),
4653                &helpers::child_path(path, "ShrtNm"),
4654                config,
4655                collector,
4656            );
4657        }
4658        if let Some(ref val) = self.shrt_nm {
4659            helpers::validate_pattern(
4660                val,
4661                "ShrtNm",
4662                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4663                &helpers::child_path(path, "ShrtNm"),
4664                config,
4665                collector,
4666            );
4667        }
4668    }
4669}
4670
4671// GenericIdentification31: Entity that assigns the identification.
4672#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4673pub struct GenericIdentification31 {
4674    #[serde(rename = "Id")]
4675    pub id: String,
4676    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4677    pub issr: Option<String>,
4678}
4679
4680impl Validate for GenericIdentification31 {
4681    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4682        helpers::validate_length(
4683            &self.id,
4684            "Id",
4685            Some(1),
4686            Some(35),
4687            &helpers::child_path(path, "Id"),
4688            config,
4689            collector,
4690        );
4691        helpers::validate_pattern(
4692            &self.id,
4693            "Id",
4694            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4695            &helpers::child_path(path, "Id"),
4696            config,
4697            collector,
4698        );
4699        if let Some(ref val) = self.issr {
4700            helpers::validate_length(
4701                val,
4702                "Issr",
4703                Some(1),
4704                Some(35),
4705                &helpers::child_path(path, "Issr"),
4706                config,
4707                collector,
4708            );
4709        }
4710        if let Some(ref val) = self.issr {
4711            helpers::validate_pattern(
4712                val,
4713                "Issr",
4714                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4715                &helpers::child_path(path, "Issr"),
4716                config,
4717                collector,
4718            );
4719        }
4720    }
4721}
4722
4723// GenericOrganisationIdentification11: Entity that assigns the identification.
4724#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4725pub struct GenericOrganisationIdentification11 {
4726    #[serde(rename = "Id")]
4727    pub id: String,
4728    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4729    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
4730    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4731    pub issr: Option<String>,
4732}
4733
4734impl Validate for GenericOrganisationIdentification11 {
4735    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4736        helpers::validate_length(
4737            &self.id,
4738            "Id",
4739            Some(1),
4740            Some(35),
4741            &helpers::child_path(path, "Id"),
4742            config,
4743            collector,
4744        );
4745        helpers::validate_pattern(
4746            &self.id,
4747            "Id",
4748            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4749            &helpers::child_path(path, "Id"),
4750            config,
4751            collector,
4752        );
4753        if let Some(ref val) = self.schme_nm
4754            && config.validate_optional_fields
4755        {
4756            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4757        }
4758        if let Some(ref val) = self.issr {
4759            helpers::validate_length(
4760                val,
4761                "Issr",
4762                Some(1),
4763                Some(35),
4764                &helpers::child_path(path, "Issr"),
4765                config,
4766                collector,
4767            );
4768        }
4769        if let Some(ref val) = self.issr {
4770            helpers::validate_pattern(
4771                val,
4772                "Issr",
4773                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4774                &helpers::child_path(path, "Issr"),
4775                config,
4776                collector,
4777            );
4778        }
4779    }
4780}
4781
4782// GenericOrganisationIdentification12: Entity that assigns the identification.
4783#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4784pub struct GenericOrganisationIdentification12 {
4785    #[serde(rename = "Id")]
4786    pub id: String,
4787    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4788    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice2>,
4789    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4790    pub issr: Option<String>,
4791}
4792
4793impl Validate for GenericOrganisationIdentification12 {
4794    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4795        helpers::validate_length(
4796            &self.id,
4797            "Id",
4798            Some(1),
4799            Some(35),
4800            &helpers::child_path(path, "Id"),
4801            config,
4802            collector,
4803        );
4804        helpers::validate_pattern(
4805            &self.id,
4806            "Id",
4807            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4808            &helpers::child_path(path, "Id"),
4809            config,
4810            collector,
4811        );
4812        if let Some(ref val) = self.schme_nm
4813            && config.validate_optional_fields
4814        {
4815            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4816        }
4817        if let Some(ref val) = self.issr {
4818            helpers::validate_length(
4819                val,
4820                "Issr",
4821                Some(1),
4822                Some(35),
4823                &helpers::child_path(path, "Issr"),
4824                config,
4825                collector,
4826            );
4827        }
4828        if let Some(ref val) = self.issr {
4829            helpers::validate_pattern(
4830                val,
4831                "Issr",
4832                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4833                &helpers::child_path(path, "Issr"),
4834                config,
4835                collector,
4836            );
4837        }
4838    }
4839}
4840
4841// GenericPersonIdentification11: Entity that assigns the identification.
4842#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4843pub struct GenericPersonIdentification11 {
4844    #[serde(rename = "Id")]
4845    pub id: String,
4846    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4847    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
4848    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4849    pub issr: Option<String>,
4850}
4851
4852impl Validate for GenericPersonIdentification11 {
4853    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4854        helpers::validate_length(
4855            &self.id,
4856            "Id",
4857            Some(1),
4858            Some(35),
4859            &helpers::child_path(path, "Id"),
4860            config,
4861            collector,
4862        );
4863        helpers::validate_pattern(
4864            &self.id,
4865            "Id",
4866            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4867            &helpers::child_path(path, "Id"),
4868            config,
4869            collector,
4870        );
4871        if let Some(ref val) = self.schme_nm
4872            && config.validate_optional_fields
4873        {
4874            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4875        }
4876        if let Some(ref val) = self.issr {
4877            helpers::validate_length(
4878                val,
4879                "Issr",
4880                Some(1),
4881                Some(35),
4882                &helpers::child_path(path, "Issr"),
4883                config,
4884                collector,
4885            );
4886        }
4887        if let Some(ref val) = self.issr {
4888            helpers::validate_pattern(
4889                val,
4890                "Issr",
4891                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4892                &helpers::child_path(path, "Issr"),
4893                config,
4894                collector,
4895            );
4896        }
4897    }
4898}
4899
4900// GenericPersonIdentification12: Entity that assigns the identification.
4901#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4902pub struct GenericPersonIdentification12 {
4903    #[serde(rename = "Id")]
4904    pub id: String,
4905    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4906    pub schme_nm: Option<PersonIdentificationSchemeName1Choice2>,
4907    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4908    pub issr: Option<String>,
4909}
4910
4911impl Validate for GenericPersonIdentification12 {
4912    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4913        helpers::validate_length(
4914            &self.id,
4915            "Id",
4916            Some(1),
4917            Some(35),
4918            &helpers::child_path(path, "Id"),
4919            config,
4920            collector,
4921        );
4922        helpers::validate_pattern(
4923            &self.id,
4924            "Id",
4925            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4926            &helpers::child_path(path, "Id"),
4927            config,
4928            collector,
4929        );
4930        if let Some(ref val) = self.schme_nm
4931            && config.validate_optional_fields
4932        {
4933            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4934        }
4935        if let Some(ref val) = self.issr {
4936            helpers::validate_length(
4937                val,
4938                "Issr",
4939                Some(1),
4940                Some(35),
4941                &helpers::child_path(path, "Issr"),
4942                config,
4943                collector,
4944            );
4945        }
4946        if let Some(ref val) = self.issr {
4947            helpers::validate_pattern(
4948                val,
4949                "Issr",
4950                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4951                &helpers::child_path(path, "Issr"),
4952                config,
4953                collector,
4954            );
4955        }
4956    }
4957}
4958
4959// GroupHeader811: Further details of the message.
4960#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4961pub struct GroupHeader811 {
4962    #[serde(rename = "MsgId")]
4963    pub msg_id: String,
4964    #[serde(rename = "CreDtTm")]
4965    pub cre_dt_tm: String,
4966    #[serde(rename = "MsgRcpt", skip_serializing_if = "Option::is_none")]
4967    pub msg_rcpt: Option<PartyIdentification1351>,
4968    #[serde(rename = "OrgnlBizQry", skip_serializing_if = "Option::is_none")]
4969    pub orgnl_biz_qry: Option<OriginalBusinessQuery11>,
4970    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
4971    pub addtl_inf: Option<String>,
4972}
4973
4974impl Validate for GroupHeader811 {
4975    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4976        helpers::validate_length(
4977            &self.msg_id,
4978            "MsgId",
4979            Some(1),
4980            Some(35),
4981            &helpers::child_path(path, "MsgId"),
4982            config,
4983            collector,
4984        );
4985        helpers::validate_pattern(
4986            &self.msg_id,
4987            "MsgId",
4988            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4989            &helpers::child_path(path, "MsgId"),
4990            config,
4991            collector,
4992        );
4993        helpers::validate_pattern(
4994            &self.cre_dt_tm,
4995            "CreDtTm",
4996            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
4997            &helpers::child_path(path, "CreDtTm"),
4998            config,
4999            collector,
5000        );
5001        if let Some(ref val) = self.msg_rcpt
5002            && config.validate_optional_fields
5003        {
5004            val.validate(&helpers::child_path(path, "MsgRcpt"), config, collector);
5005        }
5006        if let Some(ref val) = self.orgnl_biz_qry
5007            && config.validate_optional_fields
5008        {
5009            val.validate(&helpers::child_path(path, "OrgnlBizQry"), config, collector);
5010        }
5011        if let Some(ref val) = self.addtl_inf {
5012            helpers::validate_length(
5013                val,
5014                "AddtlInf",
5015                Some(1),
5016                Some(500),
5017                &helpers::child_path(path, "AddtlInf"),
5018                config,
5019                collector,
5020            );
5021        }
5022        if let Some(ref val) = self.addtl_inf {
5023            helpers::validate_pattern(
5024                val,
5025                "AddtlInf",
5026                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5027                &helpers::child_path(path, "AddtlInf"),
5028                config,
5029                collector,
5030            );
5031        }
5032    }
5033}
5034
5035// IdentificationSource3Choice1: Unique and unambiguous identification source using a proprietary identification scheme.
5036#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5037pub struct IdentificationSource3Choice1 {
5038    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5039    pub cd: Option<String>,
5040    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5041    pub prtry: Option<String>,
5042}
5043
5044impl Validate for IdentificationSource3Choice1 {
5045    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5046        if let Some(ref val) = self.cd {
5047            helpers::validate_length(
5048                val,
5049                "Cd",
5050                Some(1),
5051                Some(4),
5052                &helpers::child_path(path, "Cd"),
5053                config,
5054                collector,
5055            );
5056        }
5057        if let Some(ref val) = self.prtry {
5058            helpers::validate_length(
5059                val,
5060                "Prtry",
5061                Some(1),
5062                Some(35),
5063                &helpers::child_path(path, "Prtry"),
5064                config,
5065                collector,
5066            );
5067        }
5068        if let Some(ref val) = self.prtry {
5069            helpers::validate_pattern(
5070                val,
5071                "Prtry",
5072                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5073                &helpers::child_path(path, "Prtry"),
5074                config,
5075                collector,
5076            );
5077        }
5078    }
5079}
5080
5081// ImpliedCurrencyAmountRange1Choice: Value that an amount must not match to be considered valid.
5082#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5083pub struct ImpliedCurrencyAmountRange1Choice {
5084    #[serde(rename = "FrAmt", skip_serializing_if = "Option::is_none")]
5085    pub fr_amt: Option<AmountRangeBoundary1>,
5086    #[serde(rename = "ToAmt", skip_serializing_if = "Option::is_none")]
5087    pub to_amt: Option<AmountRangeBoundary1>,
5088    #[serde(rename = "FrToAmt", skip_serializing_if = "Option::is_none")]
5089    pub fr_to_amt: Option<FromToAmountRange1>,
5090    #[serde(rename = "EQAmt", skip_serializing_if = "Option::is_none")]
5091    pub eq_amt: Option<f64>,
5092    #[serde(rename = "NEQAmt", skip_serializing_if = "Option::is_none")]
5093    pub neq_amt: Option<f64>,
5094}
5095
5096impl Validate for ImpliedCurrencyAmountRange1Choice {
5097    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5098        if let Some(ref val) = self.fr_amt
5099            && config.validate_optional_fields
5100        {
5101            val.validate(&helpers::child_path(path, "FrAmt"), config, collector);
5102        }
5103        if let Some(ref val) = self.to_amt
5104            && config.validate_optional_fields
5105        {
5106            val.validate(&helpers::child_path(path, "ToAmt"), config, collector);
5107        }
5108        if let Some(ref val) = self.fr_to_amt
5109            && config.validate_optional_fields
5110        {
5111            val.validate(&helpers::child_path(path, "FrToAmt"), config, collector);
5112        }
5113    }
5114}
5115
5116// InterestRecord21: Provides details on the tax applied to charges.
5117#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5118pub struct InterestRecord21 {
5119    #[serde(rename = "Amt")]
5120    pub amt: ActiveOrHistoricCurrencyAndAmount,
5121    #[serde(rename = "CdtDbtInd")]
5122    pub cdt_dbt_ind: CreditDebitCode,
5123    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5124    pub tp: Option<InterestType1Choice1>,
5125    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
5126    pub rate: Option<Rate41>,
5127    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5128    pub fr_to_dt: Option<DateTimePeriod11>,
5129    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
5130    pub rsn: Option<String>,
5131    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
5132    pub tax: Option<TaxCharges21>,
5133}
5134
5135impl Validate for InterestRecord21 {
5136    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5137        self.amt
5138            .validate(&helpers::child_path(path, "Amt"), config, collector);
5139        self.cdt_dbt_ind
5140            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
5141        if let Some(ref val) = self.tp
5142            && config.validate_optional_fields
5143        {
5144            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5145        }
5146        if let Some(ref val) = self.rate
5147            && config.validate_optional_fields
5148        {
5149            val.validate(&helpers::child_path(path, "Rate"), config, collector);
5150        }
5151        if let Some(ref val) = self.fr_to_dt
5152            && config.validate_optional_fields
5153        {
5154            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
5155        }
5156        if let Some(ref val) = self.rsn {
5157            helpers::validate_length(
5158                val,
5159                "Rsn",
5160                Some(1),
5161                Some(35),
5162                &helpers::child_path(path, "Rsn"),
5163                config,
5164                collector,
5165            );
5166        }
5167        if let Some(ref val) = self.rsn {
5168            helpers::validate_pattern(
5169                val,
5170                "Rsn",
5171                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5172                &helpers::child_path(path, "Rsn"),
5173                config,
5174                collector,
5175            );
5176        }
5177        if let Some(ref val) = self.tax
5178            && config.validate_optional_fields
5179        {
5180            val.validate(&helpers::child_path(path, "Tax"), config, collector);
5181        }
5182    }
5183}
5184
5185// InterestType1Choice1: Specifies the type of interest in uncoded form.
5186#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5187pub struct InterestType1Choice1 {
5188    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5189    pub cd: Option<InterestType1Code>,
5190    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5191    pub prtry: Option<String>,
5192}
5193
5194impl Validate for InterestType1Choice1 {
5195    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5196        if let Some(ref val) = self.cd
5197            && config.validate_optional_fields
5198        {
5199            val.validate(&helpers::child_path(path, "Cd"), config, collector);
5200        }
5201        if let Some(ref val) = self.prtry {
5202            helpers::validate_length(
5203                val,
5204                "Prtry",
5205                Some(1),
5206                Some(35),
5207                &helpers::child_path(path, "Prtry"),
5208                config,
5209                collector,
5210            );
5211        }
5212        if let Some(ref val) = self.prtry {
5213            helpers::validate_pattern(
5214                val,
5215                "Prtry",
5216                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5217                &helpers::child_path(path, "Prtry"),
5218                config,
5219                collector,
5220            );
5221        }
5222    }
5223}
5224
5225// InterestType1Code: Period of time between the end of a business day and the start of the next business day (usually the day after).
5226#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5227pub enum InterestType1Code {
5228    #[default]
5229    #[serde(rename = "INDY")]
5230    CodeINDY,
5231    #[serde(rename = "OVRN")]
5232    CodeOVRN,
5233}
5234
5235impl Validate for InterestType1Code {
5236    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5237        // Enum validation is typically empty
5238    }
5239}
5240
5241// LocalInstrument2Choice1: Specifies the local instrument, as a proprietary code.
5242#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5243pub struct LocalInstrument2Choice1 {
5244    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5245    pub cd: Option<String>,
5246    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5247    pub prtry: Option<String>,
5248}
5249
5250impl Validate for LocalInstrument2Choice1 {
5251    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5252        if let Some(ref val) = self.cd {
5253            helpers::validate_length(
5254                val,
5255                "Cd",
5256                Some(1),
5257                Some(35),
5258                &helpers::child_path(path, "Cd"),
5259                config,
5260                collector,
5261            );
5262        }
5263        if let Some(ref val) = self.prtry {
5264            helpers::validate_length(
5265                val,
5266                "Prtry",
5267                Some(1),
5268                Some(35),
5269                &helpers::child_path(path, "Prtry"),
5270                config,
5271                collector,
5272            );
5273        }
5274        if let Some(ref val) = self.prtry {
5275            helpers::validate_pattern(
5276                val,
5277                "Prtry",
5278                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5279                &helpers::child_path(path, "Prtry"),
5280                config,
5281                collector,
5282            );
5283        }
5284    }
5285}
5286
5287// MessageIdentification21: Specifies the identification of the message that will be used to provide additional details.
5288#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5289pub struct MessageIdentification21 {
5290    #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5291    pub msg_nm_id: Option<String>,
5292    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
5293    pub msg_id: Option<String>,
5294}
5295
5296impl Validate for MessageIdentification21 {
5297    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5298        if let Some(ref val) = self.msg_nm_id {
5299            helpers::validate_length(
5300                val,
5301                "MsgNmId",
5302                Some(1),
5303                Some(35),
5304                &helpers::child_path(path, "MsgNmId"),
5305                config,
5306                collector,
5307            );
5308        }
5309        if let Some(ref val) = self.msg_nm_id {
5310            helpers::validate_pattern(
5311                val,
5312                "MsgNmId",
5313                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5314                &helpers::child_path(path, "MsgNmId"),
5315                config,
5316                collector,
5317            );
5318        }
5319        if let Some(ref val) = self.msg_id {
5320            helpers::validate_length(
5321                val,
5322                "MsgId",
5323                Some(1),
5324                Some(35),
5325                &helpers::child_path(path, "MsgId"),
5326                config,
5327                collector,
5328            );
5329        }
5330        if let Some(ref val) = self.msg_id {
5331            helpers::validate_pattern(
5332                val,
5333                "MsgId",
5334                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5335                &helpers::child_path(path, "MsgId"),
5336                config,
5337                collector,
5338            );
5339        }
5340    }
5341}
5342
5343// NameAndAddress161: Postal address of a party.
5344#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5345pub struct NameAndAddress161 {
5346    #[serde(rename = "Nm")]
5347    pub nm: String,
5348    #[serde(rename = "Adr")]
5349    pub adr: PostalAddress241,
5350}
5351
5352impl Validate for NameAndAddress161 {
5353    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5354        helpers::validate_length(
5355            &self.nm,
5356            "Nm",
5357            Some(1),
5358            Some(140),
5359            &helpers::child_path(path, "Nm"),
5360            config,
5361            collector,
5362        );
5363        helpers::validate_pattern(
5364            &self.nm,
5365            "Nm",
5366            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5367            &helpers::child_path(path, "Nm"),
5368            config,
5369            collector,
5370        );
5371        self.adr
5372            .validate(&helpers::child_path(path, "Adr"), config, collector);
5373    }
5374}
5375
5376// NumberAndSumOfTransactions1: Total of all individual entries included in the report.
5377#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5378pub struct NumberAndSumOfTransactions1 {
5379    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5380    pub nb_of_ntries: Option<String>,
5381    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5382    pub sum: Option<f64>,
5383}
5384
5385impl Validate for NumberAndSumOfTransactions1 {
5386    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5387        if let Some(ref val) = self.nb_of_ntries {
5388            helpers::validate_pattern(
5389                val,
5390                "NbOfNtries",
5391                "[0-9]{1,15}",
5392                &helpers::child_path(path, "NbOfNtries"),
5393                config,
5394                collector,
5395            );
5396        }
5397    }
5398}
5399
5400// NumberAndSumOfTransactions4: Resulting debit or credit amount of the netted amounts for all debit and credit entries.
5401#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5402pub struct NumberAndSumOfTransactions4 {
5403    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5404    pub nb_of_ntries: Option<String>,
5405    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5406    pub sum: Option<f64>,
5407    #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
5408    pub ttl_net_ntry: Option<AmountAndDirection35>,
5409}
5410
5411impl Validate for NumberAndSumOfTransactions4 {
5412    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5413        if let Some(ref val) = self.nb_of_ntries {
5414            helpers::validate_pattern(
5415                val,
5416                "NbOfNtries",
5417                "[0-9]{1,15}",
5418                &helpers::child_path(path, "NbOfNtries"),
5419                config,
5420                collector,
5421            );
5422        }
5423        if let Some(ref val) = self.ttl_net_ntry
5424            && config.validate_optional_fields
5425        {
5426            val.validate(&helpers::child_path(path, "TtlNetNtry"), config, collector);
5427        }
5428    }
5429}
5430
5431// OnLineCapability1Code: Off-line capable with possible on-line requests to the acquirer.
5432#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5433pub enum OnLineCapability1Code {
5434    #[default]
5435    #[serde(rename = "OFLN")]
5436    CodeOFLN,
5437    #[serde(rename = "ONLN")]
5438    CodeONLN,
5439    #[serde(rename = "SMON")]
5440    CodeSMON,
5441}
5442
5443impl Validate for OnLineCapability1Code {
5444    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5445        // Enum validation is typically empty
5446    }
5447}
5448
5449// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
5450#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5451pub struct OrganisationIdentification291 {
5452    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5453    pub any_bic: Option<String>,
5454    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5455    pub lei: Option<String>,
5456    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5457    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
5458}
5459
5460impl Validate for OrganisationIdentification291 {
5461    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5462        if let Some(ref val) = self.any_bic {
5463            helpers::validate_pattern(
5464                val,
5465                "AnyBIC",
5466                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
5467                &helpers::child_path(path, "AnyBIC"),
5468                config,
5469                collector,
5470            );
5471        }
5472        if let Some(ref val) = self.lei {
5473            helpers::validate_pattern(
5474                val,
5475                "LEI",
5476                "[A-Z0-9]{18,18}[0-9]{2,2}",
5477                &helpers::child_path(path, "LEI"),
5478                config,
5479                collector,
5480            );
5481        }
5482        if let Some(ref vec) = self.othr
5483            && config.validate_optional_fields
5484        {
5485            for item in vec {
5486                item.validate(&helpers::child_path(path, "Othr"), config, collector);
5487            }
5488        }
5489    }
5490}
5491
5492// OrganisationIdentification292: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
5493#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5494pub struct OrganisationIdentification292 {
5495    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5496    pub any_bic: Option<String>,
5497    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5498    pub lei: Option<String>,
5499    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5500    pub othr: Option<Vec<GenericOrganisationIdentification12>>,
5501}
5502
5503impl Validate for OrganisationIdentification292 {
5504    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5505        if let Some(ref val) = self.any_bic {
5506            helpers::validate_pattern(
5507                val,
5508                "AnyBIC",
5509                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
5510                &helpers::child_path(path, "AnyBIC"),
5511                config,
5512                collector,
5513            );
5514        }
5515        if let Some(ref val) = self.lei {
5516            helpers::validate_pattern(
5517                val,
5518                "LEI",
5519                "[A-Z0-9]{18,18}[0-9]{2,2}",
5520                &helpers::child_path(path, "LEI"),
5521                config,
5522                collector,
5523            );
5524        }
5525        if let Some(ref vec) = self.othr
5526            && config.validate_optional_fields
5527        {
5528            for item in vec {
5529                item.validate(&helpers::child_path(path, "Othr"), config, collector);
5530            }
5531        }
5532    }
5533}
5534
5535// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
5536#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5537pub struct OrganisationIdentificationSchemeName1Choice1 {
5538    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5539    pub cd: Option<String>,
5540    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5541    pub prtry: Option<String>,
5542}
5543
5544impl Validate for OrganisationIdentificationSchemeName1Choice1 {
5545    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5546        if let Some(ref val) = self.cd {
5547            helpers::validate_length(
5548                val,
5549                "Cd",
5550                Some(1),
5551                Some(4),
5552                &helpers::child_path(path, "Cd"),
5553                config,
5554                collector,
5555            );
5556        }
5557        if let Some(ref val) = self.prtry {
5558            helpers::validate_length(
5559                val,
5560                "Prtry",
5561                Some(1),
5562                Some(35),
5563                &helpers::child_path(path, "Prtry"),
5564                config,
5565                collector,
5566            );
5567        }
5568        if let Some(ref val) = self.prtry {
5569            helpers::validate_pattern(
5570                val,
5571                "Prtry",
5572                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5573                &helpers::child_path(path, "Prtry"),
5574                config,
5575                collector,
5576            );
5577        }
5578    }
5579}
5580
5581// OrganisationIdentificationSchemeName1Choice2: Name of the identification scheme, in a free text form.
5582#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5583pub struct OrganisationIdentificationSchemeName1Choice2 {
5584    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5585    pub cd: Option<String>,
5586    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5587    pub prtry: Option<String>,
5588}
5589
5590impl Validate for OrganisationIdentificationSchemeName1Choice2 {
5591    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5592        if let Some(ref val) = self.cd {
5593            helpers::validate_length(
5594                val,
5595                "Cd",
5596                Some(1),
5597                Some(4),
5598                &helpers::child_path(path, "Cd"),
5599                config,
5600                collector,
5601            );
5602        }
5603        if let Some(ref val) = self.prtry {
5604            helpers::validate_length(
5605                val,
5606                "Prtry",
5607                Some(1),
5608                Some(35),
5609                &helpers::child_path(path, "Prtry"),
5610                config,
5611                collector,
5612            );
5613        }
5614        if let Some(ref val) = self.prtry {
5615            helpers::validate_pattern(
5616                val,
5617                "Prtry",
5618                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5619                &helpers::child_path(path, "Prtry"),
5620                config,
5621                collector,
5622            );
5623        }
5624    }
5625}
5626
5627// 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.
5628#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5629pub struct OriginalAndCurrentQuantities1 {
5630    #[serde(rename = "FaceAmt")]
5631    pub face_amt: f64,
5632    #[serde(rename = "AmtsdVal")]
5633    pub amtsd_val: f64,
5634}
5635
5636impl Validate for OriginalAndCurrentQuantities1 {
5637    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
5638}
5639
5640// OriginalBusinessQuery11: Date and time at which the message was created.
5641#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5642pub struct OriginalBusinessQuery11 {
5643    #[serde(rename = "MsgId")]
5644    pub msg_id: String,
5645    #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5646    pub msg_nm_id: Option<String>,
5647    #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
5648    pub cre_dt_tm: Option<String>,
5649}
5650
5651impl Validate for OriginalBusinessQuery11 {
5652    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5653        helpers::validate_length(
5654            &self.msg_id,
5655            "MsgId",
5656            Some(1),
5657            Some(35),
5658            &helpers::child_path(path, "MsgId"),
5659            config,
5660            collector,
5661        );
5662        helpers::validate_pattern(
5663            &self.msg_id,
5664            "MsgId",
5665            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5666            &helpers::child_path(path, "MsgId"),
5667            config,
5668            collector,
5669        );
5670        if let Some(ref val) = self.msg_nm_id {
5671            helpers::validate_length(
5672                val,
5673                "MsgNmId",
5674                Some(1),
5675                Some(35),
5676                &helpers::child_path(path, "MsgNmId"),
5677                config,
5678                collector,
5679            );
5680        }
5681        if let Some(ref val) = self.msg_nm_id {
5682            helpers::validate_pattern(
5683                val,
5684                "MsgNmId",
5685                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5686                &helpers::child_path(path, "MsgNmId"),
5687                config,
5688                collector,
5689            );
5690        }
5691        if let Some(ref val) = self.cre_dt_tm {
5692            helpers::validate_pattern(
5693                val,
5694                "CreDtTm",
5695                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
5696                &helpers::child_path(path, "CreDtTm"),
5697                config,
5698                collector,
5699            );
5700        }
5701    }
5702}
5703
5704// OtherIdentification11: Type of the identification.
5705#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5706pub struct OtherIdentification11 {
5707    #[serde(rename = "Id")]
5708    pub id: String,
5709    #[serde(rename = "Sfx", skip_serializing_if = "Option::is_none")]
5710    pub sfx: Option<String>,
5711    #[serde(rename = "Tp")]
5712    pub tp: IdentificationSource3Choice1,
5713}
5714
5715impl Validate for OtherIdentification11 {
5716    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5717        helpers::validate_length(
5718            &self.id,
5719            "Id",
5720            Some(1),
5721            Some(35),
5722            &helpers::child_path(path, "Id"),
5723            config,
5724            collector,
5725        );
5726        helpers::validate_pattern(
5727            &self.id,
5728            "Id",
5729            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5730            &helpers::child_path(path, "Id"),
5731            config,
5732            collector,
5733        );
5734        if let Some(ref val) = self.sfx {
5735            helpers::validate_length(
5736                val,
5737                "Sfx",
5738                Some(1),
5739                Some(16),
5740                &helpers::child_path(path, "Sfx"),
5741                config,
5742                collector,
5743            );
5744        }
5745        if let Some(ref val) = self.sfx {
5746            helpers::validate_pattern(
5747                val,
5748                "Sfx",
5749                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5750                &helpers::child_path(path, "Sfx"),
5751                config,
5752                collector,
5753            );
5754        }
5755        self.tp
5756            .validate(&helpers::child_path(path, "Tp"), config, collector);
5757    }
5758}
5759
5760// POIComponentType1Code: Personal identification number (or PIN) entry device (PED).
5761#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5762pub enum POIComponentType1Code {
5763    #[default]
5764    #[serde(rename = "SOFT")]
5765    CodeSOFT,
5766    #[serde(rename = "EMVK")]
5767    CodeEMVK,
5768    #[serde(rename = "EMVO")]
5769    CodeEMVO,
5770    #[serde(rename = "MRIT")]
5771    CodeMRIT,
5772    #[serde(rename = "CHIT")]
5773    CodeCHIT,
5774    #[serde(rename = "SECM")]
5775    CodeSECM,
5776    #[serde(rename = "PEDV")]
5777    CodePEDV,
5778}
5779
5780impl Validate for POIComponentType1Code {
5781    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5782        // Enum validation is typically empty
5783    }
5784}
5785
5786// Pagination1: Indicates the last page.
5787#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5788pub struct Pagination1 {
5789    #[serde(rename = "PgNb")]
5790    pub pg_nb: String,
5791    #[serde(rename = "LastPgInd")]
5792    pub last_pg_ind: bool,
5793}
5794
5795impl Validate for Pagination1 {
5796    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5797        helpers::validate_pattern(
5798            &self.pg_nb,
5799            "PgNb",
5800            "[0-9]{1,5}",
5801            &helpers::child_path(path, "PgNb"),
5802            config,
5803            collector,
5804        );
5805    }
5806}
5807
5808// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
5809#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5810pub struct Party38Choice1 {
5811    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5812    pub org_id: Option<OrganisationIdentification291>,
5813    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5814    pub prvt_id: Option<PersonIdentification131>,
5815}
5816
5817impl Validate for Party38Choice1 {
5818    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5819        if let Some(ref val) = self.org_id
5820            && config.validate_optional_fields
5821        {
5822            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
5823        }
5824        if let Some(ref val) = self.prvt_id
5825            && config.validate_optional_fields
5826        {
5827            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
5828        }
5829    }
5830}
5831
5832// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
5833#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5834pub struct Party38Choice2 {
5835    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5836    pub org_id: Option<OrganisationIdentification292>,
5837    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5838    pub prvt_id: Option<PersonIdentification132>,
5839}
5840
5841impl Validate for Party38Choice2 {
5842    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5843        if let Some(ref val) = self.org_id
5844            && config.validate_optional_fields
5845        {
5846            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
5847        }
5848        if let Some(ref val) = self.prvt_id
5849            && config.validate_optional_fields
5850        {
5851            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
5852        }
5853    }
5854}
5855
5856// Party38Choice3: Unique and unambiguous identification of a person, for example a passport.
5857#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5858pub struct Party38Choice3 {
5859    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5860    pub org_id: Option<OrganisationIdentification292>,
5861    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5862    pub prvt_id: Option<PersonIdentification133>,
5863}
5864
5865impl Validate for Party38Choice3 {
5866    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5867        if let Some(ref val) = self.org_id
5868            && config.validate_optional_fields
5869        {
5870            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
5871        }
5872        if let Some(ref val) = self.prvt_id
5873            && config.validate_optional_fields
5874        {
5875            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
5876        }
5877    }
5878}
5879
5880// Party40Choice1: Identification of a financial institution.
5881#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5882pub struct Party40Choice1 {
5883    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5884    pub pty: Option<PartyIdentification1353>,
5885    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5886    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
5887}
5888
5889impl Validate for Party40Choice1 {
5890    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5891        if let Some(ref val) = self.pty
5892            && config.validate_optional_fields
5893        {
5894            val.validate(&helpers::child_path(path, "Pty"), config, collector);
5895        }
5896        if let Some(ref val) = self.agt
5897            && config.validate_optional_fields
5898        {
5899            val.validate(&helpers::child_path(path, "Agt"), config, collector);
5900        }
5901    }
5902}
5903
5904// Party40Choice2: Identification of a financial institution.
5905#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5906pub struct Party40Choice2 {
5907    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5908    pub pty: Option<PartyIdentification1354>,
5909    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5910    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
5911}
5912
5913impl Validate for Party40Choice2 {
5914    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5915        if let Some(ref val) = self.pty
5916            && config.validate_optional_fields
5917        {
5918            val.validate(&helpers::child_path(path, "Pty"), config, collector);
5919        }
5920        if let Some(ref val) = self.agt
5921            && config.validate_optional_fields
5922        {
5923            val.validate(&helpers::child_path(path, "Agt"), config, collector);
5924        }
5925    }
5926}
5927
5928// Party40Choice3: Identification of a financial institution.
5929#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5930pub struct Party40Choice3 {
5931    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5932    pub pty: Option<PartyIdentification1353>,
5933    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5934    pub agt: Option<BranchAndFinancialInstitutionIdentification63>,
5935}
5936
5937impl Validate for Party40Choice3 {
5938    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5939        if let Some(ref val) = self.pty
5940            && config.validate_optional_fields
5941        {
5942            val.validate(&helpers::child_path(path, "Pty"), config, collector);
5943        }
5944        if let Some(ref val) = self.agt
5945            && config.validate_optional_fields
5946        {
5947            val.validate(&helpers::child_path(path, "Agt"), config, collector);
5948        }
5949    }
5950}
5951
5952// PartyIdentification1351: Set of elements used to indicate how to contact the party.
5953#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5954pub struct PartyIdentification1351 {
5955    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
5956    pub nm: Option<String>,
5957    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
5958    pub pstl_adr: Option<PostalAddress241>,
5959    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
5960    pub id: Option<Party38Choice1>,
5961    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
5962    pub ctct_dtls: Option<Contact41>,
5963}
5964
5965impl Validate for PartyIdentification1351 {
5966    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5967        if let Some(ref val) = self.nm {
5968            helpers::validate_length(
5969                val,
5970                "Nm",
5971                Some(1),
5972                Some(140),
5973                &helpers::child_path(path, "Nm"),
5974                config,
5975                collector,
5976            );
5977        }
5978        if let Some(ref val) = self.nm {
5979            helpers::validate_pattern(
5980                val,
5981                "Nm",
5982                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5983                &helpers::child_path(path, "Nm"),
5984                config,
5985                collector,
5986            );
5987        }
5988        if let Some(ref val) = self.pstl_adr
5989            && config.validate_optional_fields
5990        {
5991            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
5992        }
5993        if let Some(ref val) = self.id
5994            && config.validate_optional_fields
5995        {
5996            val.validate(&helpers::child_path(path, "Id"), config, collector);
5997        }
5998        if let Some(ref val) = self.ctct_dtls
5999            && config.validate_optional_fields
6000        {
6001            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6002        }
6003    }
6004}
6005
6006// 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.
6007#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6008pub struct PartyIdentification1352 {
6009    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6010    pub nm: Option<String>,
6011    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6012    pub pstl_adr: Option<PostalAddress241>,
6013    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6014    pub id: Option<Party38Choice1>,
6015    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6016    pub ctry_of_res: Option<String>,
6017}
6018
6019impl Validate for PartyIdentification1352 {
6020    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6021        if let Some(ref val) = self.nm {
6022            helpers::validate_length(
6023                val,
6024                "Nm",
6025                Some(1),
6026                Some(140),
6027                &helpers::child_path(path, "Nm"),
6028                config,
6029                collector,
6030            );
6031        }
6032        if let Some(ref val) = self.nm {
6033            helpers::validate_pattern(
6034                val,
6035                "Nm",
6036                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6037                &helpers::child_path(path, "Nm"),
6038                config,
6039                collector,
6040            );
6041        }
6042        if let Some(ref val) = self.pstl_adr
6043            && config.validate_optional_fields
6044        {
6045            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6046        }
6047        if let Some(ref val) = self.id
6048            && config.validate_optional_fields
6049        {
6050            val.validate(&helpers::child_path(path, "Id"), config, collector);
6051        }
6052        if let Some(ref val) = self.ctry_of_res {
6053            helpers::validate_pattern(
6054                val,
6055                "CtryOfRes",
6056                "[A-Z]{2,2}",
6057                &helpers::child_path(path, "CtryOfRes"),
6058                config,
6059                collector,
6060            );
6061        }
6062    }
6063}
6064
6065// PartyIdentification1353: Set of elements used to indicate how to contact the party.
6066#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6067pub struct PartyIdentification1353 {
6068    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6069    pub nm: Option<String>,
6070    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6071    pub pstl_adr: Option<PostalAddress241>,
6072    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6073    pub id: Option<Party38Choice1>,
6074    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6075    pub ctry_of_res: Option<String>,
6076    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6077    pub ctct_dtls: Option<Contact42>,
6078}
6079
6080impl Validate for PartyIdentification1353 {
6081    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6082        if let Some(ref val) = self.nm {
6083            helpers::validate_length(
6084                val,
6085                "Nm",
6086                Some(1),
6087                Some(140),
6088                &helpers::child_path(path, "Nm"),
6089                config,
6090                collector,
6091            );
6092        }
6093        if let Some(ref val) = self.nm {
6094            helpers::validate_pattern(
6095                val,
6096                "Nm",
6097                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6098                &helpers::child_path(path, "Nm"),
6099                config,
6100                collector,
6101            );
6102        }
6103        if let Some(ref val) = self.pstl_adr
6104            && config.validate_optional_fields
6105        {
6106            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6107        }
6108        if let Some(ref val) = self.id
6109            && config.validate_optional_fields
6110        {
6111            val.validate(&helpers::child_path(path, "Id"), config, collector);
6112        }
6113        if let Some(ref val) = self.ctry_of_res {
6114            helpers::validate_pattern(
6115                val,
6116                "CtryOfRes",
6117                "[A-Z]{2,2}",
6118                &helpers::child_path(path, "CtryOfRes"),
6119                config,
6120                collector,
6121            );
6122        }
6123        if let Some(ref val) = self.ctct_dtls
6124            && config.validate_optional_fields
6125        {
6126            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6127        }
6128    }
6129}
6130
6131// PartyIdentification1354: Set of elements used to indicate how to contact the party.
6132#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6133pub struct PartyIdentification1354 {
6134    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6135    pub nm: Option<String>,
6136    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6137    pub pstl_adr: Option<PostalAddress241>,
6138    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6139    pub id: Option<Party38Choice1>,
6140    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6141    pub ctry_of_res: Option<String>,
6142    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6143    pub ctct_dtls: Option<Contact43>,
6144}
6145
6146impl Validate for PartyIdentification1354 {
6147    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6148        if let Some(ref val) = self.nm {
6149            helpers::validate_length(
6150                val,
6151                "Nm",
6152                Some(1),
6153                Some(140),
6154                &helpers::child_path(path, "Nm"),
6155                config,
6156                collector,
6157            );
6158        }
6159        if let Some(ref val) = self.nm {
6160            helpers::validate_pattern(
6161                val,
6162                "Nm",
6163                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6164                &helpers::child_path(path, "Nm"),
6165                config,
6166                collector,
6167            );
6168        }
6169        if let Some(ref val) = self.pstl_adr
6170            && config.validate_optional_fields
6171        {
6172            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6173        }
6174        if let Some(ref val) = self.id
6175            && config.validate_optional_fields
6176        {
6177            val.validate(&helpers::child_path(path, "Id"), config, collector);
6178        }
6179        if let Some(ref val) = self.ctry_of_res {
6180            helpers::validate_pattern(
6181                val,
6182                "CtryOfRes",
6183                "[A-Z]{2,2}",
6184                &helpers::child_path(path, "CtryOfRes"),
6185                config,
6186                collector,
6187            );
6188        }
6189        if let Some(ref val) = self.ctct_dtls
6190            && config.validate_optional_fields
6191        {
6192            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6193        }
6194    }
6195}
6196
6197// PartyIdentification1355: Set of elements used to indicate how to contact the party.
6198#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6199pub struct PartyIdentification1355 {
6200    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6201    pub nm: Option<String>,
6202    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6203    pub pstl_adr: Option<PostalAddress241>,
6204    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6205    pub id: Option<Party38Choice2>,
6206    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6207    pub ctry_of_res: Option<String>,
6208    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6209    pub ctct_dtls: Option<Contact42>,
6210}
6211
6212impl Validate for PartyIdentification1355 {
6213    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6214        if let Some(ref val) = self.nm {
6215            helpers::validate_length(
6216                val,
6217                "Nm",
6218                Some(1),
6219                Some(140),
6220                &helpers::child_path(path, "Nm"),
6221                config,
6222                collector,
6223            );
6224        }
6225        if let Some(ref val) = self.nm {
6226            helpers::validate_pattern(
6227                val,
6228                "Nm",
6229                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6230                &helpers::child_path(path, "Nm"),
6231                config,
6232                collector,
6233            );
6234        }
6235        if let Some(ref val) = self.pstl_adr
6236            && config.validate_optional_fields
6237        {
6238            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6239        }
6240        if let Some(ref val) = self.id
6241            && config.validate_optional_fields
6242        {
6243            val.validate(&helpers::child_path(path, "Id"), config, collector);
6244        }
6245        if let Some(ref val) = self.ctry_of_res {
6246            helpers::validate_pattern(
6247                val,
6248                "CtryOfRes",
6249                "[A-Z]{2,2}",
6250                &helpers::child_path(path, "CtryOfRes"),
6251                config,
6252                collector,
6253            );
6254        }
6255        if let Some(ref val) = self.ctct_dtls
6256            && config.validate_optional_fields
6257        {
6258            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6259        }
6260    }
6261}
6262
6263// PartyIdentification1356: Set of elements used to indicate how to contact the party.
6264#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6265pub struct PartyIdentification1356 {
6266    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6267    pub nm: Option<String>,
6268    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6269    pub pstl_adr: Option<PostalAddress241>,
6270    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6271    pub id: Option<Party38Choice3>,
6272    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6273    pub ctry_of_res: Option<String>,
6274    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6275    pub ctct_dtls: Option<Contact42>,
6276}
6277
6278impl Validate for PartyIdentification1356 {
6279    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6280        if let Some(ref val) = self.nm {
6281            helpers::validate_length(
6282                val,
6283                "Nm",
6284                Some(1),
6285                Some(140),
6286                &helpers::child_path(path, "Nm"),
6287                config,
6288                collector,
6289            );
6290        }
6291        if let Some(ref val) = self.nm {
6292            helpers::validate_pattern(
6293                val,
6294                "Nm",
6295                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6296                &helpers::child_path(path, "Nm"),
6297                config,
6298                collector,
6299            );
6300        }
6301        if let Some(ref val) = self.pstl_adr
6302            && config.validate_optional_fields
6303        {
6304            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6305        }
6306        if let Some(ref val) = self.id
6307            && config.validate_optional_fields
6308        {
6309            val.validate(&helpers::child_path(path, "Id"), config, collector);
6310        }
6311        if let Some(ref val) = self.ctry_of_res {
6312            helpers::validate_pattern(
6313                val,
6314                "CtryOfRes",
6315                "[A-Z]{2,2}",
6316                &helpers::child_path(path, "CtryOfRes"),
6317                config,
6318                collector,
6319            );
6320        }
6321        if let Some(ref val) = self.ctct_dtls
6322            && config.validate_optional_fields
6323        {
6324            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6325        }
6326    }
6327}
6328
6329// PartyIdentification1357: Set of elements used to indicate how to contact the party.
6330#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6331pub struct PartyIdentification1357 {
6332    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6333    pub nm: Option<String>,
6334    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6335    pub pstl_adr: Option<PostalAddress241>,
6336    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6337    pub id: Option<Party38Choice1>,
6338    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6339    pub ctry_of_res: Option<String>,
6340    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6341    pub ctct_dtls: Option<Contact43>,
6342}
6343
6344impl Validate for PartyIdentification1357 {
6345    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6346        if let Some(ref val) = self.nm {
6347            helpers::validate_length(
6348                val,
6349                "Nm",
6350                Some(1),
6351                Some(140),
6352                &helpers::child_path(path, "Nm"),
6353                config,
6354                collector,
6355            );
6356        }
6357        if let Some(ref val) = self.nm {
6358            helpers::validate_pattern(
6359                val,
6360                "Nm",
6361                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6362                &helpers::child_path(path, "Nm"),
6363                config,
6364                collector,
6365            );
6366        }
6367        if let Some(ref val) = self.pstl_adr
6368            && config.validate_optional_fields
6369        {
6370            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6371        }
6372        if let Some(ref val) = self.id
6373            && config.validate_optional_fields
6374        {
6375            val.validate(&helpers::child_path(path, "Id"), config, collector);
6376        }
6377        if let Some(ref val) = self.ctry_of_res {
6378            helpers::validate_pattern(
6379                val,
6380                "CtryOfRes",
6381                "[A-Z]{2,2}",
6382                &helpers::child_path(path, "CtryOfRes"),
6383                config,
6384                collector,
6385            );
6386        }
6387        if let Some(ref val) = self.ctct_dtls
6388            && config.validate_optional_fields
6389        {
6390            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6391        }
6392    }
6393}
6394
6395// PartyType3Code: Party to whom the card issuer delegates to authorise card payment transactions.
6396#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6397pub enum PartyType3Code {
6398    #[default]
6399    #[serde(rename = "OPOI")]
6400    CodeOPOI,
6401    #[serde(rename = "MERC")]
6402    CodeMERC,
6403    #[serde(rename = "ACCP")]
6404    CodeACCP,
6405    #[serde(rename = "ITAG")]
6406    CodeITAG,
6407    #[serde(rename = "ACQR")]
6408    CodeACQR,
6409    #[serde(rename = "CISS")]
6410    CodeCISS,
6411    #[serde(rename = "DLIS")]
6412    CodeDLIS,
6413}
6414
6415impl Validate for PartyType3Code {
6416    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6417        // Enum validation is typically empty
6418    }
6419}
6420
6421// PartyType4Code: Tax authority.
6422#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6423pub enum PartyType4Code {
6424    #[default]
6425    #[serde(rename = "MERC")]
6426    CodeMERC,
6427    #[serde(rename = "ACCP")]
6428    CodeACCP,
6429    #[serde(rename = "ITAG")]
6430    CodeITAG,
6431    #[serde(rename = "ACQR")]
6432    CodeACQR,
6433    #[serde(rename = "CISS")]
6434    CodeCISS,
6435    #[serde(rename = "TAXH")]
6436    CodeTAXH,
6437}
6438
6439impl Validate for PartyType4Code {
6440    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6441        // Enum validation is typically empty
6442    }
6443}
6444
6445// PaymentCard41: Additional card issuer specific data.
6446#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6447pub struct PaymentCard41 {
6448    #[serde(rename = "PlainCardData", skip_serializing_if = "Option::is_none")]
6449    pub plain_card_data: Option<PlainCardData11>,
6450    #[serde(rename = "CardCtryCd", skip_serializing_if = "Option::is_none")]
6451    pub card_ctry_cd: Option<String>,
6452    #[serde(rename = "CardBrnd", skip_serializing_if = "Option::is_none")]
6453    pub card_brnd: Option<GenericIdentification11>,
6454    #[serde(rename = "AddtlCardData", skip_serializing_if = "Option::is_none")]
6455    pub addtl_card_data: Option<String>,
6456}
6457
6458impl Validate for PaymentCard41 {
6459    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6460        if let Some(ref val) = self.plain_card_data
6461            && config.validate_optional_fields
6462        {
6463            val.validate(
6464                &helpers::child_path(path, "PlainCardData"),
6465                config,
6466                collector,
6467            );
6468        }
6469        if let Some(ref val) = self.card_ctry_cd {
6470            helpers::validate_pattern(
6471                val,
6472                "CardCtryCd",
6473                "[0-9]{3}",
6474                &helpers::child_path(path, "CardCtryCd"),
6475                config,
6476                collector,
6477            );
6478        }
6479        if let Some(ref val) = self.card_brnd
6480            && config.validate_optional_fields
6481        {
6482            val.validate(&helpers::child_path(path, "CardBrnd"), config, collector);
6483        }
6484        if let Some(ref val) = self.addtl_card_data {
6485            helpers::validate_length(
6486                val,
6487                "AddtlCardData",
6488                Some(1),
6489                Some(70),
6490                &helpers::child_path(path, "AddtlCardData"),
6491                config,
6492                collector,
6493            );
6494        }
6495        if let Some(ref val) = self.addtl_card_data {
6496            helpers::validate_pattern(
6497                val,
6498                "AddtlCardData",
6499                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6500                &helpers::child_path(path, "AddtlCardData"),
6501                config,
6502                collector,
6503            );
6504        }
6505    }
6506}
6507
6508// PaymentContext3: Method used to authenticate a cardholder.
6509#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6510pub struct PaymentContext3 {
6511    #[serde(rename = "CardPres", skip_serializing_if = "Option::is_none")]
6512    pub card_pres: Option<bool>,
6513    #[serde(rename = "CrdhldrPres", skip_serializing_if = "Option::is_none")]
6514    pub crdhldr_pres: Option<bool>,
6515    #[serde(rename = "OnLineCntxt", skip_serializing_if = "Option::is_none")]
6516    pub on_line_cntxt: Option<bool>,
6517    #[serde(rename = "AttndncCntxt", skip_serializing_if = "Option::is_none")]
6518    pub attndnc_cntxt: Option<AttendanceContext1Code>,
6519    #[serde(rename = "TxEnvt", skip_serializing_if = "Option::is_none")]
6520    pub tx_envt: Option<TransactionEnvironment1Code>,
6521    #[serde(rename = "TxChanl", skip_serializing_if = "Option::is_none")]
6522    pub tx_chanl: Option<TransactionChannel1Code>,
6523    #[serde(rename = "AttndntMsgCpbl", skip_serializing_if = "Option::is_none")]
6524    pub attndnt_msg_cpbl: Option<bool>,
6525    #[serde(rename = "AttndntLang", skip_serializing_if = "Option::is_none")]
6526    pub attndnt_lang: Option<String>,
6527    #[serde(rename = "CardDataNtryMd")]
6528    pub card_data_ntry_md: CardDataReading1Code,
6529    #[serde(rename = "FllbckInd", skip_serializing_if = "Option::is_none")]
6530    pub fllbck_ind: Option<bool>,
6531    #[serde(rename = "AuthntcnMtd", skip_serializing_if = "Option::is_none")]
6532    pub authntcn_mtd: Option<CardholderAuthentication2>,
6533}
6534
6535impl Validate for PaymentContext3 {
6536    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6537        if let Some(ref val) = self.attndnc_cntxt
6538            && config.validate_optional_fields
6539        {
6540            val.validate(
6541                &helpers::child_path(path, "AttndncCntxt"),
6542                config,
6543                collector,
6544            );
6545        }
6546        if let Some(ref val) = self.tx_envt
6547            && config.validate_optional_fields
6548        {
6549            val.validate(&helpers::child_path(path, "TxEnvt"), config, collector);
6550        }
6551        if let Some(ref val) = self.tx_chanl
6552            && config.validate_optional_fields
6553        {
6554            val.validate(&helpers::child_path(path, "TxChanl"), config, collector);
6555        }
6556        if let Some(ref val) = self.attndnt_lang {
6557            helpers::validate_pattern(
6558                val,
6559                "AttndntLang",
6560                "[a-z]{2,2}",
6561                &helpers::child_path(path, "AttndntLang"),
6562                config,
6563                collector,
6564            );
6565        }
6566        self.card_data_ntry_md.validate(
6567            &helpers::child_path(path, "CardDataNtryMd"),
6568            config,
6569            collector,
6570        );
6571        if let Some(ref val) = self.authntcn_mtd
6572            && config.validate_optional_fields
6573        {
6574            val.validate(&helpers::child_path(path, "AuthntcnMtd"), config, collector);
6575        }
6576    }
6577}
6578
6579// PaymentReturnReason51: Further details on the return reason.
6580#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6581pub struct PaymentReturnReason51 {
6582    #[serde(rename = "OrgnlBkTxCd", skip_serializing_if = "Option::is_none")]
6583    pub orgnl_bk_tx_cd: Option<BankTransactionCodeStructure41>,
6584    #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
6585    pub orgtr: Option<PartyIdentification1357>,
6586    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
6587    pub rsn: Option<ReturnReason5Choice1>,
6588    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
6589    pub addtl_inf: Option<Vec<String>>,
6590}
6591
6592impl Validate for PaymentReturnReason51 {
6593    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6594        if let Some(ref val) = self.orgnl_bk_tx_cd
6595            && config.validate_optional_fields
6596        {
6597            val.validate(&helpers::child_path(path, "OrgnlBkTxCd"), config, collector);
6598        }
6599        if let Some(ref val) = self.orgtr
6600            && config.validate_optional_fields
6601        {
6602            val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
6603        }
6604        if let Some(ref val) = self.rsn
6605            && config.validate_optional_fields
6606        {
6607            val.validate(&helpers::child_path(path, "Rsn"), config, collector);
6608        }
6609        if let Some(ref vec) = self.addtl_inf {
6610            for item in vec {
6611                helpers::validate_length(
6612                    item,
6613                    "AddtlInf",
6614                    Some(1),
6615                    Some(105),
6616                    &helpers::child_path(path, "AddtlInf"),
6617                    config,
6618                    collector,
6619                );
6620            }
6621        }
6622        if let Some(ref vec) = self.addtl_inf {
6623            for item in vec {
6624                helpers::validate_pattern(
6625                    item,
6626                    "AddtlInf",
6627                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6628                    &helpers::child_path(path, "AddtlInf"),
6629                    config,
6630                    collector,
6631                );
6632            }
6633        }
6634    }
6635}
6636
6637// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
6638#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6639pub struct PersonIdentification131 {
6640    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6641    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
6642    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6643    pub othr: Option<Vec<GenericPersonIdentification11>>,
6644}
6645
6646impl Validate for PersonIdentification131 {
6647    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6648        if let Some(ref val) = self.dt_and_plc_of_birth
6649            && config.validate_optional_fields
6650        {
6651            val.validate(
6652                &helpers::child_path(path, "DtAndPlcOfBirth"),
6653                config,
6654                collector,
6655            );
6656        }
6657        if let Some(ref vec) = self.othr
6658            && config.validate_optional_fields
6659        {
6660            for item in vec {
6661                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6662            }
6663        }
6664    }
6665}
6666
6667// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
6668#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6669pub struct PersonIdentification132 {
6670    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6671    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
6672    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6673    pub othr: Option<Vec<GenericPersonIdentification12>>,
6674}
6675
6676impl Validate for PersonIdentification132 {
6677    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6678        if let Some(ref val) = self.dt_and_plc_of_birth
6679            && config.validate_optional_fields
6680        {
6681            val.validate(
6682                &helpers::child_path(path, "DtAndPlcOfBirth"),
6683                config,
6684                collector,
6685            );
6686        }
6687        if let Some(ref vec) = self.othr
6688            && config.validate_optional_fields
6689        {
6690            for item in vec {
6691                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6692            }
6693        }
6694    }
6695}
6696
6697// PersonIdentification133: Unique identification of a person, as assigned by an institution, using an identification scheme.
6698#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6699pub struct PersonIdentification133 {
6700    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6701    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
6702    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6703    pub othr: Option<Vec<GenericPersonIdentification12>>,
6704}
6705
6706impl Validate for PersonIdentification133 {
6707    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6708        if let Some(ref val) = self.dt_and_plc_of_birth
6709            && config.validate_optional_fields
6710        {
6711            val.validate(
6712                &helpers::child_path(path, "DtAndPlcOfBirth"),
6713                config,
6714                collector,
6715            );
6716        }
6717        if let Some(ref vec) = self.othr
6718            && config.validate_optional_fields
6719        {
6720            for item in vec {
6721                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6722            }
6723        }
6724    }
6725}
6726
6727// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
6728#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6729pub struct PersonIdentificationSchemeName1Choice1 {
6730    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6731    pub cd: Option<String>,
6732    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6733    pub prtry: Option<String>,
6734}
6735
6736impl Validate for PersonIdentificationSchemeName1Choice1 {
6737    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6738        if let Some(ref val) = self.cd {
6739            helpers::validate_length(
6740                val,
6741                "Cd",
6742                Some(1),
6743                Some(4),
6744                &helpers::child_path(path, "Cd"),
6745                config,
6746                collector,
6747            );
6748        }
6749        if let Some(ref val) = self.prtry {
6750            helpers::validate_length(
6751                val,
6752                "Prtry",
6753                Some(1),
6754                Some(35),
6755                &helpers::child_path(path, "Prtry"),
6756                config,
6757                collector,
6758            );
6759        }
6760        if let Some(ref val) = self.prtry {
6761            helpers::validate_pattern(
6762                val,
6763                "Prtry",
6764                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6765                &helpers::child_path(path, "Prtry"),
6766                config,
6767                collector,
6768            );
6769        }
6770    }
6771}
6772
6773// PersonIdentificationSchemeName1Choice2: Name of the identification scheme, in a free text form.
6774#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6775pub struct PersonIdentificationSchemeName1Choice2 {
6776    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6777    pub cd: Option<String>,
6778    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6779    pub prtry: Option<String>,
6780}
6781
6782impl Validate for PersonIdentificationSchemeName1Choice2 {
6783    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6784        if let Some(ref val) = self.cd {
6785            helpers::validate_length(
6786                val,
6787                "Cd",
6788                Some(1),
6789                Some(4),
6790                &helpers::child_path(path, "Cd"),
6791                config,
6792                collector,
6793            );
6794        }
6795        if let Some(ref val) = self.prtry {
6796            helpers::validate_length(
6797                val,
6798                "Prtry",
6799                Some(1),
6800                Some(35),
6801                &helpers::child_path(path, "Prtry"),
6802                config,
6803                collector,
6804            );
6805        }
6806        if let Some(ref val) = self.prtry {
6807            helpers::validate_pattern(
6808                val,
6809                "Prtry",
6810                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6811                &helpers::child_path(path, "Prtry"),
6812                config,
6813                collector,
6814            );
6815        }
6816    }
6817}
6818
6819// PlainCardData11: Card security code (CSC) associated with the card performing the transaction.
6820#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6821pub struct PlainCardData11 {
6822    #[serde(rename = "PAN")]
6823    pub pan: String,
6824    #[serde(rename = "CardSeqNb", skip_serializing_if = "Option::is_none")]
6825    pub card_seq_nb: Option<String>,
6826    #[serde(rename = "FctvDt", skip_serializing_if = "Option::is_none")]
6827    pub fctv_dt: Option<String>,
6828    #[serde(rename = "XpryDt")]
6829    pub xpry_dt: String,
6830    #[serde(rename = "SvcCd", skip_serializing_if = "Option::is_none")]
6831    pub svc_cd: Option<String>,
6832    #[serde(rename = "TrckData", skip_serializing_if = "Option::is_none")]
6833    pub trck_data: Option<Vec<TrackData11>>,
6834    #[serde(rename = "CardSctyCd", skip_serializing_if = "Option::is_none")]
6835    pub card_scty_cd: Option<CardSecurityInformation1>,
6836}
6837
6838impl Validate for PlainCardData11 {
6839    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6840        helpers::validate_pattern(
6841            &self.pan,
6842            "PAN",
6843            "[0-9]{8,28}",
6844            &helpers::child_path(path, "PAN"),
6845            config,
6846            collector,
6847        );
6848        if let Some(ref val) = self.card_seq_nb {
6849            helpers::validate_pattern(
6850                val,
6851                "CardSeqNb",
6852                "[0-9]{2,3}",
6853                &helpers::child_path(path, "CardSeqNb"),
6854                config,
6855                collector,
6856            );
6857        }
6858        if let Some(ref val) = self.svc_cd {
6859            helpers::validate_pattern(
6860                val,
6861                "SvcCd",
6862                "[0-9]{3}",
6863                &helpers::child_path(path, "SvcCd"),
6864                config,
6865                collector,
6866            );
6867        }
6868        if let Some(ref vec) = self.trck_data
6869            && config.validate_optional_fields
6870        {
6871            for item in vec {
6872                item.validate(&helpers::child_path(path, "TrckData"), config, collector);
6873            }
6874        }
6875        if let Some(ref val) = self.card_scty_cd
6876            && config.validate_optional_fields
6877        {
6878            val.validate(&helpers::child_path(path, "CardSctyCd"), config, collector);
6879        }
6880    }
6881}
6882
6883// PointOfInteraction11: Data related to a component of the POI performing the transaction.
6884#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6885pub struct PointOfInteraction11 {
6886    #[serde(rename = "Id")]
6887    pub id: GenericIdentification321,
6888    #[serde(rename = "SysNm", skip_serializing_if = "Option::is_none")]
6889    pub sys_nm: Option<String>,
6890    #[serde(rename = "GrpId", skip_serializing_if = "Option::is_none")]
6891    pub grp_id: Option<String>,
6892    #[serde(rename = "Cpblties", skip_serializing_if = "Option::is_none")]
6893    pub cpblties: Option<PointOfInteractionCapabilities1>,
6894    #[serde(rename = "Cmpnt", skip_serializing_if = "Option::is_none")]
6895    pub cmpnt: Option<Vec<PointOfInteractionComponent11>>,
6896}
6897
6898impl Validate for PointOfInteraction11 {
6899    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6900        self.id
6901            .validate(&helpers::child_path(path, "Id"), config, collector);
6902        if let Some(ref val) = self.sys_nm {
6903            helpers::validate_length(
6904                val,
6905                "SysNm",
6906                Some(1),
6907                Some(70),
6908                &helpers::child_path(path, "SysNm"),
6909                config,
6910                collector,
6911            );
6912        }
6913        if let Some(ref val) = self.sys_nm {
6914            helpers::validate_pattern(
6915                val,
6916                "SysNm",
6917                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6918                &helpers::child_path(path, "SysNm"),
6919                config,
6920                collector,
6921            );
6922        }
6923        if let Some(ref val) = self.grp_id {
6924            helpers::validate_length(
6925                val,
6926                "GrpId",
6927                Some(1),
6928                Some(35),
6929                &helpers::child_path(path, "GrpId"),
6930                config,
6931                collector,
6932            );
6933        }
6934        if let Some(ref val) = self.grp_id {
6935            helpers::validate_pattern(
6936                val,
6937                "GrpId",
6938                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6939                &helpers::child_path(path, "GrpId"),
6940                config,
6941                collector,
6942            );
6943        }
6944        if let Some(ref val) = self.cpblties
6945            && config.validate_optional_fields
6946        {
6947            val.validate(&helpers::child_path(path, "Cpblties"), config, collector);
6948        }
6949        if let Some(ref vec) = self.cmpnt
6950            && config.validate_optional_fields
6951        {
6952            for item in vec {
6953                item.validate(&helpers::child_path(path, "Cmpnt"), config, collector);
6954            }
6955        }
6956    }
6957}
6958
6959// PointOfInteractionCapabilities1: Number of columns of the printer component.
6960#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6961pub struct PointOfInteractionCapabilities1 {
6962    #[serde(rename = "CardRdngCpblties", skip_serializing_if = "Option::is_none")]
6963    pub card_rdng_cpblties: Option<Vec<CardDataReading1Code>>,
6964    #[serde(
6965        rename = "CrdhldrVrfctnCpblties",
6966        skip_serializing_if = "Option::is_none"
6967    )]
6968    pub crdhldr_vrfctn_cpblties: Option<Vec<CardholderVerificationCapability1Code>>,
6969    #[serde(rename = "OnLineCpblties", skip_serializing_if = "Option::is_none")]
6970    pub on_line_cpblties: Option<OnLineCapability1Code>,
6971    #[serde(rename = "DispCpblties", skip_serializing_if = "Option::is_none")]
6972    pub disp_cpblties: Option<Vec<DisplayCapabilities1>>,
6973    #[serde(rename = "PrtLineWidth", skip_serializing_if = "Option::is_none")]
6974    pub prt_line_width: Option<String>,
6975}
6976
6977impl Validate for PointOfInteractionCapabilities1 {
6978    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6979        if let Some(ref vec) = self.card_rdng_cpblties
6980            && config.validate_optional_fields
6981        {
6982            for item in vec {
6983                item.validate(
6984                    &helpers::child_path(path, "CardRdngCpblties"),
6985                    config,
6986                    collector,
6987                );
6988            }
6989        }
6990        if let Some(ref vec) = self.crdhldr_vrfctn_cpblties
6991            && config.validate_optional_fields
6992        {
6993            for item in vec {
6994                item.validate(
6995                    &helpers::child_path(path, "CrdhldrVrfctnCpblties"),
6996                    config,
6997                    collector,
6998                );
6999            }
7000        }
7001        if let Some(ref val) = self.on_line_cpblties
7002            && config.validate_optional_fields
7003        {
7004            val.validate(
7005                &helpers::child_path(path, "OnLineCpblties"),
7006                config,
7007                collector,
7008            );
7009        }
7010        if let Some(ref vec) = self.disp_cpblties
7011            && config.validate_optional_fields
7012        {
7013            for item in vec {
7014                item.validate(
7015                    &helpers::child_path(path, "DispCpblties"),
7016                    config,
7017                    collector,
7018                );
7019            }
7020        }
7021        if let Some(ref val) = self.prt_line_width {
7022            helpers::validate_pattern(
7023                val,
7024                "PrtLineWidth",
7025                "[0-9]{1,3}",
7026                &helpers::child_path(path, "PrtLineWidth"),
7027                config,
7028                collector,
7029            );
7030        }
7031    }
7032}
7033
7034// PointOfInteractionComponent11: Unique approval number for a component, delivered by a certification body.
7035
7036// 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).
7037#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7038pub struct PointOfInteractionComponent11 {
7039    #[serde(rename = "POICmpntTp")]
7040    pub poi_cmpnt_tp: POIComponentType1Code,
7041    #[serde(rename = "ManfctrId", skip_serializing_if = "Option::is_none")]
7042    pub manfctr_id: Option<String>,
7043    #[serde(rename = "Mdl", skip_serializing_if = "Option::is_none")]
7044    pub mdl: Option<String>,
7045    #[serde(rename = "VrsnNb", skip_serializing_if = "Option::is_none")]
7046    pub vrsn_nb: Option<String>,
7047    #[serde(rename = "SrlNb", skip_serializing_if = "Option::is_none")]
7048    pub srl_nb: Option<String>,
7049    #[serde(rename = "ApprvlNb", skip_serializing_if = "Option::is_none")]
7050    pub apprvl_nb: Option<Vec<String>>,
7051}
7052
7053impl Validate for PointOfInteractionComponent11 {
7054    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7055        self.poi_cmpnt_tp
7056            .validate(&helpers::child_path(path, "POICmpntTp"), config, collector);
7057        if let Some(ref val) = self.manfctr_id {
7058            helpers::validate_length(
7059                val,
7060                "ManfctrId",
7061                Some(1),
7062                Some(35),
7063                &helpers::child_path(path, "ManfctrId"),
7064                config,
7065                collector,
7066            );
7067        }
7068        if let Some(ref val) = self.manfctr_id {
7069            helpers::validate_pattern(
7070                val,
7071                "ManfctrId",
7072                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7073                &helpers::child_path(path, "ManfctrId"),
7074                config,
7075                collector,
7076            );
7077        }
7078        if let Some(ref val) = self.mdl {
7079            helpers::validate_length(
7080                val,
7081                "Mdl",
7082                Some(1),
7083                Some(35),
7084                &helpers::child_path(path, "Mdl"),
7085                config,
7086                collector,
7087            );
7088        }
7089        if let Some(ref val) = self.mdl {
7090            helpers::validate_pattern(
7091                val,
7092                "Mdl",
7093                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7094                &helpers::child_path(path, "Mdl"),
7095                config,
7096                collector,
7097            );
7098        }
7099        if let Some(ref val) = self.vrsn_nb {
7100            helpers::validate_length(
7101                val,
7102                "VrsnNb",
7103                Some(1),
7104                Some(16),
7105                &helpers::child_path(path, "VrsnNb"),
7106                config,
7107                collector,
7108            );
7109        }
7110        if let Some(ref val) = self.vrsn_nb {
7111            helpers::validate_pattern(
7112                val,
7113                "VrsnNb",
7114                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7115                &helpers::child_path(path, "VrsnNb"),
7116                config,
7117                collector,
7118            );
7119        }
7120        if let Some(ref val) = self.srl_nb {
7121            helpers::validate_length(
7122                val,
7123                "SrlNb",
7124                Some(1),
7125                Some(35),
7126                &helpers::child_path(path, "SrlNb"),
7127                config,
7128                collector,
7129            );
7130        }
7131        if let Some(ref val) = self.srl_nb {
7132            helpers::validate_pattern(
7133                val,
7134                "SrlNb",
7135                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7136                &helpers::child_path(path, "SrlNb"),
7137                config,
7138                collector,
7139            );
7140        }
7141        if let Some(ref vec) = self.apprvl_nb {
7142            for item in vec {
7143                helpers::validate_length(
7144                    item,
7145                    "ApprvlNb",
7146                    Some(1),
7147                    Some(70),
7148                    &helpers::child_path(path, "ApprvlNb"),
7149                    config,
7150                    collector,
7151                );
7152            }
7153        }
7154        if let Some(ref vec) = self.apprvl_nb {
7155            for item in vec {
7156                helpers::validate_pattern(
7157                    item,
7158                    "ApprvlNb",
7159                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7160                    &helpers::child_path(path, "ApprvlNb"),
7161                    config,
7162                    collector,
7163                );
7164            }
7165        }
7166    }
7167}
7168
7169// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
7170#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7171pub struct PostalAddress241 {
7172    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
7173    pub adr_tp: Option<AddressType3Choice1>,
7174    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
7175    pub dept: Option<String>,
7176    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
7177    pub sub_dept: Option<String>,
7178    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
7179    pub strt_nm: Option<String>,
7180    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
7181    pub bldg_nb: Option<String>,
7182    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
7183    pub bldg_nm: Option<String>,
7184    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
7185    pub flr: Option<String>,
7186    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
7187    pub pst_bx: Option<String>,
7188    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
7189    pub room: Option<String>,
7190    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
7191    pub pst_cd: Option<String>,
7192    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
7193    pub twn_nm: Option<String>,
7194    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
7195    pub twn_lctn_nm: Option<String>,
7196    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
7197    pub dstrct_nm: Option<String>,
7198    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
7199    pub ctry_sub_dvsn: Option<String>,
7200    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
7201    pub ctry: Option<String>,
7202    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
7203    pub adr_line: Option<Vec<String>>,
7204}
7205
7206impl Validate for PostalAddress241 {
7207    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7208        if let Some(ref val) = self.adr_tp
7209            && config.validate_optional_fields
7210        {
7211            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
7212        }
7213        if let Some(ref val) = self.dept {
7214            helpers::validate_length(
7215                val,
7216                "Dept",
7217                Some(1),
7218                Some(70),
7219                &helpers::child_path(path, "Dept"),
7220                config,
7221                collector,
7222            );
7223        }
7224        if let Some(ref val) = self.dept {
7225            helpers::validate_pattern(
7226                val,
7227                "Dept",
7228                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7229                &helpers::child_path(path, "Dept"),
7230                config,
7231                collector,
7232            );
7233        }
7234        if let Some(ref val) = self.sub_dept {
7235            helpers::validate_length(
7236                val,
7237                "SubDept",
7238                Some(1),
7239                Some(70),
7240                &helpers::child_path(path, "SubDept"),
7241                config,
7242                collector,
7243            );
7244        }
7245        if let Some(ref val) = self.sub_dept {
7246            helpers::validate_pattern(
7247                val,
7248                "SubDept",
7249                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7250                &helpers::child_path(path, "SubDept"),
7251                config,
7252                collector,
7253            );
7254        }
7255        if let Some(ref val) = self.strt_nm {
7256            helpers::validate_length(
7257                val,
7258                "StrtNm",
7259                Some(1),
7260                Some(70),
7261                &helpers::child_path(path, "StrtNm"),
7262                config,
7263                collector,
7264            );
7265        }
7266        if let Some(ref val) = self.strt_nm {
7267            helpers::validate_pattern(
7268                val,
7269                "StrtNm",
7270                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7271                &helpers::child_path(path, "StrtNm"),
7272                config,
7273                collector,
7274            );
7275        }
7276        if let Some(ref val) = self.bldg_nb {
7277            helpers::validate_length(
7278                val,
7279                "BldgNb",
7280                Some(1),
7281                Some(16),
7282                &helpers::child_path(path, "BldgNb"),
7283                config,
7284                collector,
7285            );
7286        }
7287        if let Some(ref val) = self.bldg_nb {
7288            helpers::validate_pattern(
7289                val,
7290                "BldgNb",
7291                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7292                &helpers::child_path(path, "BldgNb"),
7293                config,
7294                collector,
7295            );
7296        }
7297        if let Some(ref val) = self.bldg_nm {
7298            helpers::validate_length(
7299                val,
7300                "BldgNm",
7301                Some(1),
7302                Some(35),
7303                &helpers::child_path(path, "BldgNm"),
7304                config,
7305                collector,
7306            );
7307        }
7308        if let Some(ref val) = self.bldg_nm {
7309            helpers::validate_pattern(
7310                val,
7311                "BldgNm",
7312                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7313                &helpers::child_path(path, "BldgNm"),
7314                config,
7315                collector,
7316            );
7317        }
7318        if let Some(ref val) = self.flr {
7319            helpers::validate_length(
7320                val,
7321                "Flr",
7322                Some(1),
7323                Some(70),
7324                &helpers::child_path(path, "Flr"),
7325                config,
7326                collector,
7327            );
7328        }
7329        if let Some(ref val) = self.flr {
7330            helpers::validate_pattern(
7331                val,
7332                "Flr",
7333                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7334                &helpers::child_path(path, "Flr"),
7335                config,
7336                collector,
7337            );
7338        }
7339        if let Some(ref val) = self.pst_bx {
7340            helpers::validate_length(
7341                val,
7342                "PstBx",
7343                Some(1),
7344                Some(16),
7345                &helpers::child_path(path, "PstBx"),
7346                config,
7347                collector,
7348            );
7349        }
7350        if let Some(ref val) = self.pst_bx {
7351            helpers::validate_pattern(
7352                val,
7353                "PstBx",
7354                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7355                &helpers::child_path(path, "PstBx"),
7356                config,
7357                collector,
7358            );
7359        }
7360        if let Some(ref val) = self.room {
7361            helpers::validate_length(
7362                val,
7363                "Room",
7364                Some(1),
7365                Some(70),
7366                &helpers::child_path(path, "Room"),
7367                config,
7368                collector,
7369            );
7370        }
7371        if let Some(ref val) = self.room {
7372            helpers::validate_pattern(
7373                val,
7374                "Room",
7375                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7376                &helpers::child_path(path, "Room"),
7377                config,
7378                collector,
7379            );
7380        }
7381        if let Some(ref val) = self.pst_cd {
7382            helpers::validate_length(
7383                val,
7384                "PstCd",
7385                Some(1),
7386                Some(16),
7387                &helpers::child_path(path, "PstCd"),
7388                config,
7389                collector,
7390            );
7391        }
7392        if let Some(ref val) = self.pst_cd {
7393            helpers::validate_pattern(
7394                val,
7395                "PstCd",
7396                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7397                &helpers::child_path(path, "PstCd"),
7398                config,
7399                collector,
7400            );
7401        }
7402        if let Some(ref val) = self.twn_nm {
7403            helpers::validate_length(
7404                val,
7405                "TwnNm",
7406                Some(1),
7407                Some(35),
7408                &helpers::child_path(path, "TwnNm"),
7409                config,
7410                collector,
7411            );
7412        }
7413        if let Some(ref val) = self.twn_nm {
7414            helpers::validate_pattern(
7415                val,
7416                "TwnNm",
7417                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7418                &helpers::child_path(path, "TwnNm"),
7419                config,
7420                collector,
7421            );
7422        }
7423        if let Some(ref val) = self.twn_lctn_nm {
7424            helpers::validate_length(
7425                val,
7426                "TwnLctnNm",
7427                Some(1),
7428                Some(35),
7429                &helpers::child_path(path, "TwnLctnNm"),
7430                config,
7431                collector,
7432            );
7433        }
7434        if let Some(ref val) = self.twn_lctn_nm {
7435            helpers::validate_pattern(
7436                val,
7437                "TwnLctnNm",
7438                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7439                &helpers::child_path(path, "TwnLctnNm"),
7440                config,
7441                collector,
7442            );
7443        }
7444        if let Some(ref val) = self.dstrct_nm {
7445            helpers::validate_length(
7446                val,
7447                "DstrctNm",
7448                Some(1),
7449                Some(35),
7450                &helpers::child_path(path, "DstrctNm"),
7451                config,
7452                collector,
7453            );
7454        }
7455        if let Some(ref val) = self.dstrct_nm {
7456            helpers::validate_pattern(
7457                val,
7458                "DstrctNm",
7459                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7460                &helpers::child_path(path, "DstrctNm"),
7461                config,
7462                collector,
7463            );
7464        }
7465        if let Some(ref val) = self.ctry_sub_dvsn {
7466            helpers::validate_length(
7467                val,
7468                "CtrySubDvsn",
7469                Some(1),
7470                Some(35),
7471                &helpers::child_path(path, "CtrySubDvsn"),
7472                config,
7473                collector,
7474            );
7475        }
7476        if let Some(ref val) = self.ctry_sub_dvsn {
7477            helpers::validate_pattern(
7478                val,
7479                "CtrySubDvsn",
7480                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7481                &helpers::child_path(path, "CtrySubDvsn"),
7482                config,
7483                collector,
7484            );
7485        }
7486        if let Some(ref val) = self.ctry {
7487            helpers::validate_pattern(
7488                val,
7489                "Ctry",
7490                "[A-Z]{2,2}",
7491                &helpers::child_path(path, "Ctry"),
7492                config,
7493                collector,
7494            );
7495        }
7496        if let Some(ref vec) = self.adr_line {
7497            for item in vec {
7498                helpers::validate_length(
7499                    item,
7500                    "AdrLine",
7501                    Some(1),
7502                    Some(70),
7503                    &helpers::child_path(path, "AdrLine"),
7504                    config,
7505                    collector,
7506                );
7507            }
7508        }
7509        if let Some(ref vec) = self.adr_line {
7510            for item in vec {
7511                helpers::validate_pattern(
7512                    item,
7513                    "AdrLine",
7514                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7515                    &helpers::child_path(path, "AdrLine"),
7516                    config,
7517                    collector,
7518                );
7519            }
7520        }
7521    }
7522}
7523
7524// PostalAddress242: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
7525#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7526pub struct PostalAddress242 {
7527    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
7528    pub adr_tp: Option<AddressType3Choice1>,
7529    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
7530    pub dept: Option<String>,
7531    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
7532    pub sub_dept: Option<String>,
7533    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
7534    pub strt_nm: Option<String>,
7535    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
7536    pub bldg_nb: Option<String>,
7537    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
7538    pub bldg_nm: Option<String>,
7539    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
7540    pub flr: Option<String>,
7541    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
7542    pub pst_bx: Option<String>,
7543    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
7544    pub room: Option<String>,
7545    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
7546    pub pst_cd: Option<String>,
7547    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
7548    pub twn_nm: Option<String>,
7549    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
7550    pub twn_lctn_nm: Option<String>,
7551    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
7552    pub dstrct_nm: Option<String>,
7553    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
7554    pub ctry_sub_dvsn: Option<String>,
7555    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
7556    pub ctry: Option<String>,
7557    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
7558    pub adr_line: Option<Vec<String>>,
7559}
7560
7561impl Validate for PostalAddress242 {
7562    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7563        if let Some(ref val) = self.adr_tp
7564            && config.validate_optional_fields
7565        {
7566            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
7567        }
7568        if let Some(ref val) = self.dept {
7569            helpers::validate_length(
7570                val,
7571                "Dept",
7572                Some(1),
7573                Some(70),
7574                &helpers::child_path(path, "Dept"),
7575                config,
7576                collector,
7577            );
7578        }
7579        if let Some(ref val) = self.dept {
7580            helpers::validate_pattern(
7581                val,
7582                "Dept",
7583                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7584                &helpers::child_path(path, "Dept"),
7585                config,
7586                collector,
7587            );
7588        }
7589        if let Some(ref val) = self.sub_dept {
7590            helpers::validate_length(
7591                val,
7592                "SubDept",
7593                Some(1),
7594                Some(70),
7595                &helpers::child_path(path, "SubDept"),
7596                config,
7597                collector,
7598            );
7599        }
7600        if let Some(ref val) = self.sub_dept {
7601            helpers::validate_pattern(
7602                val,
7603                "SubDept",
7604                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7605                &helpers::child_path(path, "SubDept"),
7606                config,
7607                collector,
7608            );
7609        }
7610        if let Some(ref val) = self.strt_nm {
7611            helpers::validate_length(
7612                val,
7613                "StrtNm",
7614                Some(1),
7615                Some(70),
7616                &helpers::child_path(path, "StrtNm"),
7617                config,
7618                collector,
7619            );
7620        }
7621        if let Some(ref val) = self.strt_nm {
7622            helpers::validate_pattern(
7623                val,
7624                "StrtNm",
7625                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7626                &helpers::child_path(path, "StrtNm"),
7627                config,
7628                collector,
7629            );
7630        }
7631        if let Some(ref val) = self.bldg_nb {
7632            helpers::validate_length(
7633                val,
7634                "BldgNb",
7635                Some(1),
7636                Some(16),
7637                &helpers::child_path(path, "BldgNb"),
7638                config,
7639                collector,
7640            );
7641        }
7642        if let Some(ref val) = self.bldg_nb {
7643            helpers::validate_pattern(
7644                val,
7645                "BldgNb",
7646                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7647                &helpers::child_path(path, "BldgNb"),
7648                config,
7649                collector,
7650            );
7651        }
7652        if let Some(ref val) = self.bldg_nm {
7653            helpers::validate_length(
7654                val,
7655                "BldgNm",
7656                Some(1),
7657                Some(35),
7658                &helpers::child_path(path, "BldgNm"),
7659                config,
7660                collector,
7661            );
7662        }
7663        if let Some(ref val) = self.bldg_nm {
7664            helpers::validate_pattern(
7665                val,
7666                "BldgNm",
7667                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7668                &helpers::child_path(path, "BldgNm"),
7669                config,
7670                collector,
7671            );
7672        }
7673        if let Some(ref val) = self.flr {
7674            helpers::validate_length(
7675                val,
7676                "Flr",
7677                Some(1),
7678                Some(70),
7679                &helpers::child_path(path, "Flr"),
7680                config,
7681                collector,
7682            );
7683        }
7684        if let Some(ref val) = self.flr {
7685            helpers::validate_pattern(
7686                val,
7687                "Flr",
7688                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7689                &helpers::child_path(path, "Flr"),
7690                config,
7691                collector,
7692            );
7693        }
7694        if let Some(ref val) = self.pst_bx {
7695            helpers::validate_length(
7696                val,
7697                "PstBx",
7698                Some(1),
7699                Some(16),
7700                &helpers::child_path(path, "PstBx"),
7701                config,
7702                collector,
7703            );
7704        }
7705        if let Some(ref val) = self.pst_bx {
7706            helpers::validate_pattern(
7707                val,
7708                "PstBx",
7709                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7710                &helpers::child_path(path, "PstBx"),
7711                config,
7712                collector,
7713            );
7714        }
7715        if let Some(ref val) = self.room {
7716            helpers::validate_length(
7717                val,
7718                "Room",
7719                Some(1),
7720                Some(70),
7721                &helpers::child_path(path, "Room"),
7722                config,
7723                collector,
7724            );
7725        }
7726        if let Some(ref val) = self.room {
7727            helpers::validate_pattern(
7728                val,
7729                "Room",
7730                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7731                &helpers::child_path(path, "Room"),
7732                config,
7733                collector,
7734            );
7735        }
7736        if let Some(ref val) = self.pst_cd {
7737            helpers::validate_length(
7738                val,
7739                "PstCd",
7740                Some(1),
7741                Some(16),
7742                &helpers::child_path(path, "PstCd"),
7743                config,
7744                collector,
7745            );
7746        }
7747        if let Some(ref val) = self.pst_cd {
7748            helpers::validate_pattern(
7749                val,
7750                "PstCd",
7751                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7752                &helpers::child_path(path, "PstCd"),
7753                config,
7754                collector,
7755            );
7756        }
7757        if let Some(ref val) = self.twn_nm {
7758            helpers::validate_length(
7759                val,
7760                "TwnNm",
7761                Some(1),
7762                Some(35),
7763                &helpers::child_path(path, "TwnNm"),
7764                config,
7765                collector,
7766            );
7767        }
7768        if let Some(ref val) = self.twn_nm {
7769            helpers::validate_pattern(
7770                val,
7771                "TwnNm",
7772                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7773                &helpers::child_path(path, "TwnNm"),
7774                config,
7775                collector,
7776            );
7777        }
7778        if let Some(ref val) = self.twn_lctn_nm {
7779            helpers::validate_length(
7780                val,
7781                "TwnLctnNm",
7782                Some(1),
7783                Some(35),
7784                &helpers::child_path(path, "TwnLctnNm"),
7785                config,
7786                collector,
7787            );
7788        }
7789        if let Some(ref val) = self.twn_lctn_nm {
7790            helpers::validate_pattern(
7791                val,
7792                "TwnLctnNm",
7793                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7794                &helpers::child_path(path, "TwnLctnNm"),
7795                config,
7796                collector,
7797            );
7798        }
7799        if let Some(ref val) = self.dstrct_nm {
7800            helpers::validate_length(
7801                val,
7802                "DstrctNm",
7803                Some(1),
7804                Some(35),
7805                &helpers::child_path(path, "DstrctNm"),
7806                config,
7807                collector,
7808            );
7809        }
7810        if let Some(ref val) = self.dstrct_nm {
7811            helpers::validate_pattern(
7812                val,
7813                "DstrctNm",
7814                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7815                &helpers::child_path(path, "DstrctNm"),
7816                config,
7817                collector,
7818            );
7819        }
7820        if let Some(ref val) = self.ctry_sub_dvsn {
7821            helpers::validate_length(
7822                val,
7823                "CtrySubDvsn",
7824                Some(1),
7825                Some(35),
7826                &helpers::child_path(path, "CtrySubDvsn"),
7827                config,
7828                collector,
7829            );
7830        }
7831        if let Some(ref val) = self.ctry_sub_dvsn {
7832            helpers::validate_pattern(
7833                val,
7834                "CtrySubDvsn",
7835                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7836                &helpers::child_path(path, "CtrySubDvsn"),
7837                config,
7838                collector,
7839            );
7840        }
7841        if let Some(ref val) = self.ctry {
7842            helpers::validate_pattern(
7843                val,
7844                "Ctry",
7845                "[A-Z]{2,2}",
7846                &helpers::child_path(path, "Ctry"),
7847                config,
7848                collector,
7849            );
7850        }
7851        if let Some(ref vec) = self.adr_line {
7852            for item in vec {
7853                helpers::validate_length(
7854                    item,
7855                    "AdrLine",
7856                    Some(1),
7857                    Some(70),
7858                    &helpers::child_path(path, "AdrLine"),
7859                    config,
7860                    collector,
7861                );
7862            }
7863        }
7864        if let Some(ref vec) = self.adr_line {
7865            for item in vec {
7866                helpers::validate_pattern(
7867                    item,
7868                    "AdrLine",
7869                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7870                    &helpers::child_path(path, "AdrLine"),
7871                    config,
7872                    collector,
7873                );
7874            }
7875        }
7876    }
7877}
7878
7879// PreferredContactMethod1Code: Preferred method used to reach the contact is per mobile or cell phone.
7880#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7881pub enum PreferredContactMethod1Code {
7882    #[default]
7883    #[serde(rename = "LETT")]
7884    CodeLETT,
7885    #[serde(rename = "MAIL")]
7886    CodeMAIL,
7887    #[serde(rename = "PHON")]
7888    CodePHON,
7889    #[serde(rename = "FAXX")]
7890    CodeFAXX,
7891    #[serde(rename = "CELL")]
7892    CodeCELL,
7893}
7894
7895impl Validate for PreferredContactMethod1Code {
7896    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7897        // Enum validation is typically empty
7898    }
7899}
7900
7901// Price71: Value of the price, for example, as a currency and value.
7902#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7903pub struct Price71 {
7904    #[serde(rename = "Tp")]
7905    pub tp: YieldedOrValueType1Choice,
7906    #[serde(rename = "Val")]
7907    pub val: PriceRateOrAmount3Choice1,
7908}
7909
7910impl Validate for Price71 {
7911    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7912        self.tp
7913            .validate(&helpers::child_path(path, "Tp"), config, collector);
7914        self.val
7915            .validate(&helpers::child_path(path, "Val"), config, collector);
7916    }
7917}
7918
7919// PriceRateOrAmount3Choice1: Price expressed as a currency and value.
7920#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7921pub struct PriceRateOrAmount3Choice1 {
7922    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
7923    pub rate: Option<f64>,
7924    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
7925    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
7926}
7927
7928impl Validate for PriceRateOrAmount3Choice1 {
7929    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7930        if let Some(ref val) = self.amt
7931            && config.validate_optional_fields
7932        {
7933            val.validate(&helpers::child_path(path, "Amt"), config, collector);
7934        }
7935    }
7936}
7937
7938// PriceValueType1Code: Price is the face amount.
7939#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7940pub enum PriceValueType1Code {
7941    #[default]
7942    #[serde(rename = "DISC")]
7943    CodeDISC,
7944    #[serde(rename = "PREM")]
7945    CodePREM,
7946    #[serde(rename = "PARV")]
7947    CodePARV,
7948}
7949
7950impl Validate for PriceValueType1Code {
7951    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7952        // Enum validation is typically empty
7953    }
7954}
7955
7956// Product21: Additional information related to the product.
7957#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7958pub struct Product21 {
7959    #[serde(rename = "PdctCd")]
7960    pub pdct_cd: String,
7961    #[serde(rename = "UnitOfMeasr", skip_serializing_if = "Option::is_none")]
7962    pub unit_of_measr: Option<UnitOfMeasure1Code>,
7963    #[serde(rename = "PdctQty", skip_serializing_if = "Option::is_none")]
7964    pub pdct_qty: Option<f64>,
7965    #[serde(rename = "UnitPric", skip_serializing_if = "Option::is_none")]
7966    pub unit_pric: Option<f64>,
7967    #[serde(rename = "PdctAmt", skip_serializing_if = "Option::is_none")]
7968    pub pdct_amt: Option<f64>,
7969    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
7970    pub tax_tp: Option<String>,
7971    #[serde(rename = "AddtlPdctInf", skip_serializing_if = "Option::is_none")]
7972    pub addtl_pdct_inf: Option<String>,
7973}
7974
7975impl Validate for Product21 {
7976    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7977        helpers::validate_length(
7978            &self.pdct_cd,
7979            "PdctCd",
7980            Some(1),
7981            Some(70),
7982            &helpers::child_path(path, "PdctCd"),
7983            config,
7984            collector,
7985        );
7986        helpers::validate_pattern(
7987            &self.pdct_cd,
7988            "PdctCd",
7989            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7990            &helpers::child_path(path, "PdctCd"),
7991            config,
7992            collector,
7993        );
7994        if let Some(ref val) = self.unit_of_measr
7995            && config.validate_optional_fields
7996        {
7997            val.validate(&helpers::child_path(path, "UnitOfMeasr"), config, collector);
7998        }
7999        if let Some(ref val) = self.tax_tp {
8000            helpers::validate_length(
8001                val,
8002                "TaxTp",
8003                Some(1),
8004                Some(35),
8005                &helpers::child_path(path, "TaxTp"),
8006                config,
8007                collector,
8008            );
8009        }
8010        if let Some(ref val) = self.tax_tp {
8011            helpers::validate_pattern(
8012                val,
8013                "TaxTp",
8014                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8015                &helpers::child_path(path, "TaxTp"),
8016                config,
8017                collector,
8018            );
8019        }
8020        if let Some(ref val) = self.addtl_pdct_inf {
8021            helpers::validate_length(
8022                val,
8023                "AddtlPdctInf",
8024                Some(1),
8025                Some(35),
8026                &helpers::child_path(path, "AddtlPdctInf"),
8027                config,
8028                collector,
8029            );
8030        }
8031        if let Some(ref val) = self.addtl_pdct_inf {
8032            helpers::validate_pattern(
8033                val,
8034                "AddtlPdctInf",
8035                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8036                &helpers::child_path(path, "AddtlPdctInf"),
8037                config,
8038                collector,
8039            );
8040        }
8041    }
8042}
8043
8044// ProprietaryAgent41: Organisation established primarily to provide financial services.
8045#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8046pub struct ProprietaryAgent41 {
8047    #[serde(rename = "Tp")]
8048    pub tp: String,
8049    #[serde(rename = "Agt")]
8050    pub agt: BranchAndFinancialInstitutionIdentification62,
8051}
8052
8053impl Validate for ProprietaryAgent41 {
8054    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8055        helpers::validate_length(
8056            &self.tp,
8057            "Tp",
8058            Some(1),
8059            Some(35),
8060            &helpers::child_path(path, "Tp"),
8061            config,
8062            collector,
8063        );
8064        helpers::validate_pattern(
8065            &self.tp,
8066            "Tp",
8067            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8068            &helpers::child_path(path, "Tp"),
8069            config,
8070            collector,
8071        );
8072        self.agt
8073            .validate(&helpers::child_path(path, "Agt"), config, collector);
8074    }
8075}
8076
8077// ProprietaryBankTransactionCodeStructure11: Identification of the issuer of the proprietary bank transaction code.
8078#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8079pub struct ProprietaryBankTransactionCodeStructure11 {
8080    #[serde(rename = "Cd")]
8081    pub cd: String,
8082    #[serde(rename = "Issr")]
8083    pub issr: String,
8084}
8085
8086impl Validate for ProprietaryBankTransactionCodeStructure11 {
8087    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8088        helpers::validate_length(
8089            &self.cd,
8090            "Cd",
8091            Some(1),
8092            Some(35),
8093            &helpers::child_path(path, "Cd"),
8094            config,
8095            collector,
8096        );
8097        helpers::validate_pattern(
8098            &self.cd,
8099            "Cd",
8100            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8101            &helpers::child_path(path, "Cd"),
8102            config,
8103            collector,
8104        );
8105        helpers::validate_length(
8106            &self.issr,
8107            "Issr",
8108            Some(1),
8109            Some(35),
8110            &helpers::child_path(path, "Issr"),
8111            config,
8112            collector,
8113        );
8114        helpers::validate_pattern(
8115            &self.issr,
8116            "Issr",
8117            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8118            &helpers::child_path(path, "Issr"),
8119            config,
8120            collector,
8121        );
8122    }
8123}
8124
8125// ProprietaryDate31: Date in ISO format.
8126#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8127pub struct ProprietaryDate31 {
8128    #[serde(rename = "Tp")]
8129    pub tp: String,
8130    #[serde(rename = "Dt")]
8131    pub dt: DateAndDateTime2Choice1,
8132}
8133
8134impl Validate for ProprietaryDate31 {
8135    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8136        helpers::validate_length(
8137            &self.tp,
8138            "Tp",
8139            Some(1),
8140            Some(35),
8141            &helpers::child_path(path, "Tp"),
8142            config,
8143            collector,
8144        );
8145        helpers::validate_pattern(
8146            &self.tp,
8147            "Tp",
8148            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8149            &helpers::child_path(path, "Tp"),
8150            config,
8151            collector,
8152        );
8153        self.dt
8154            .validate(&helpers::child_path(path, "Dt"), config, collector);
8155    }
8156}
8157
8158// ProprietaryParty51: Proprietary party.
8159#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8160pub struct ProprietaryParty51 {
8161    #[serde(rename = "Tp")]
8162    pub tp: String,
8163    #[serde(rename = "Pty")]
8164    pub pty: Party40Choice1,
8165}
8166
8167impl Validate for ProprietaryParty51 {
8168    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8169        helpers::validate_length(
8170            &self.tp,
8171            "Tp",
8172            Some(1),
8173            Some(35),
8174            &helpers::child_path(path, "Tp"),
8175            config,
8176            collector,
8177        );
8178        helpers::validate_pattern(
8179            &self.tp,
8180            "Tp",
8181            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8182            &helpers::child_path(path, "Tp"),
8183            config,
8184            collector,
8185        );
8186        self.pty
8187            .validate(&helpers::child_path(path, "Pty"), config, collector);
8188    }
8189}
8190
8191// ProprietaryPrice21: Proprietary price specification related to the underlying transaction.
8192#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8193pub struct ProprietaryPrice21 {
8194    #[serde(rename = "Tp")]
8195    pub tp: String,
8196    #[serde(rename = "Pric")]
8197    pub pric: ActiveOrHistoricCurrencyAndAmount,
8198}
8199
8200impl Validate for ProprietaryPrice21 {
8201    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8202        helpers::validate_length(
8203            &self.tp,
8204            "Tp",
8205            Some(1),
8206            Some(35),
8207            &helpers::child_path(path, "Tp"),
8208            config,
8209            collector,
8210        );
8211        helpers::validate_pattern(
8212            &self.tp,
8213            "Tp",
8214            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8215            &helpers::child_path(path, "Tp"),
8216            config,
8217            collector,
8218        );
8219        self.pric
8220            .validate(&helpers::child_path(path, "Pric"), config, collector);
8221    }
8222}
8223
8224// ProprietaryQuantity11: Provides the proprietary quantity in free format.
8225#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8226pub struct ProprietaryQuantity11 {
8227    #[serde(rename = "Tp")]
8228    pub tp: String,
8229    #[serde(rename = "Qty")]
8230    pub qty: String,
8231}
8232
8233impl Validate for ProprietaryQuantity11 {
8234    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8235        helpers::validate_length(
8236            &self.tp,
8237            "Tp",
8238            Some(1),
8239            Some(35),
8240            &helpers::child_path(path, "Tp"),
8241            config,
8242            collector,
8243        );
8244        helpers::validate_pattern(
8245            &self.tp,
8246            "Tp",
8247            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8248            &helpers::child_path(path, "Tp"),
8249            config,
8250            collector,
8251        );
8252        helpers::validate_length(
8253            &self.qty,
8254            "Qty",
8255            Some(1),
8256            Some(35),
8257            &helpers::child_path(path, "Qty"),
8258            config,
8259            collector,
8260        );
8261        helpers::validate_pattern(
8262            &self.qty,
8263            "Qty",
8264            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8265            &helpers::child_path(path, "Qty"),
8266            config,
8267            collector,
8268        );
8269    }
8270}
8271
8272// ProprietaryReference11: Proprietary reference specification related to the underlying transaction.
8273#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8274pub struct ProprietaryReference11 {
8275    #[serde(rename = "Tp")]
8276    pub tp: String,
8277    #[serde(rename = "Ref")]
8278    pub ref_attr: String,
8279}
8280
8281impl Validate for ProprietaryReference11 {
8282    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8283        helpers::validate_length(
8284            &self.tp,
8285            "Tp",
8286            Some(1),
8287            Some(35),
8288            &helpers::child_path(path, "Tp"),
8289            config,
8290            collector,
8291        );
8292        helpers::validate_pattern(
8293            &self.tp,
8294            "Tp",
8295            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8296            &helpers::child_path(path, "Tp"),
8297            config,
8298            collector,
8299        );
8300        helpers::validate_length(
8301            &self.ref_attr,
8302            "Ref",
8303            Some(1),
8304            Some(35),
8305            &helpers::child_path(path, "Ref"),
8306            config,
8307            collector,
8308        );
8309        helpers::validate_pattern(
8310            &self.ref_attr,
8311            "Ref",
8312            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8313            &helpers::child_path(path, "Ref"),
8314            config,
8315            collector,
8316        );
8317    }
8318}
8319
8320// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
8321#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8322pub struct ProxyAccountIdentification11 {
8323    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
8324    pub tp: Option<ProxyAccountType1Choice1>,
8325    #[serde(rename = "Id")]
8326    pub id: String,
8327}
8328
8329impl Validate for ProxyAccountIdentification11 {
8330    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8331        if let Some(ref val) = self.tp
8332            && config.validate_optional_fields
8333        {
8334            val.validate(&helpers::child_path(path, "Tp"), config, collector);
8335        }
8336        helpers::validate_length(
8337            &self.id,
8338            "Id",
8339            Some(1),
8340            Some(320),
8341            &helpers::child_path(path, "Id"),
8342            config,
8343            collector,
8344        );
8345        helpers::validate_pattern(
8346            &self.id,
8347            "Id",
8348            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8349            &helpers::child_path(path, "Id"),
8350            config,
8351            collector,
8352        );
8353    }
8354}
8355
8356// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
8357#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8358pub struct ProxyAccountType1Choice1 {
8359    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8360    pub cd: Option<String>,
8361    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8362    pub prtry: Option<String>,
8363}
8364
8365impl Validate for ProxyAccountType1Choice1 {
8366    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8367        if let Some(ref val) = self.cd {
8368            helpers::validate_length(
8369                val,
8370                "Cd",
8371                Some(1),
8372                Some(4),
8373                &helpers::child_path(path, "Cd"),
8374                config,
8375                collector,
8376            );
8377        }
8378        if let Some(ref val) = self.prtry {
8379            helpers::validate_length(
8380                val,
8381                "Prtry",
8382                Some(1),
8383                Some(35),
8384                &helpers::child_path(path, "Prtry"),
8385                config,
8386                collector,
8387            );
8388        }
8389        if let Some(ref val) = self.prtry {
8390            helpers::validate_pattern(
8391                val,
8392                "Prtry",
8393                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8394                &helpers::child_path(path, "Prtry"),
8395                config,
8396                collector,
8397            );
8398        }
8399    }
8400}
8401
8402// Purpose2Choice1: Purpose, in a proprietary form.
8403#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8404pub struct Purpose2Choice1 {
8405    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8406    pub cd: Option<String>,
8407    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8408    pub prtry: Option<String>,
8409}
8410
8411impl Validate for Purpose2Choice1 {
8412    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8413        if let Some(ref val) = self.cd {
8414            helpers::validate_length(
8415                val,
8416                "Cd",
8417                Some(1),
8418                Some(4),
8419                &helpers::child_path(path, "Cd"),
8420                config,
8421                collector,
8422            );
8423        }
8424        if let Some(ref val) = self.prtry {
8425            helpers::validate_length(
8426                val,
8427                "Prtry",
8428                Some(1),
8429                Some(35),
8430                &helpers::child_path(path, "Prtry"),
8431                config,
8432                collector,
8433            );
8434        }
8435        if let Some(ref val) = self.prtry {
8436            helpers::validate_pattern(
8437                val,
8438                "Prtry",
8439                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8440                &helpers::child_path(path, "Prtry"),
8441                config,
8442                collector,
8443            );
8444        }
8445    }
8446}
8447
8448// Rate41: An amount range where the interest rate is applicable.
8449#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8450pub struct Rate41 {
8451    #[serde(rename = "Tp")]
8452    pub tp: RateType4Choice1,
8453    #[serde(rename = "VldtyRg", skip_serializing_if = "Option::is_none")]
8454    pub vldty_rg: Option<ActiveOrHistoricCurrencyAndAmountRange2>,
8455}
8456
8457impl Validate for Rate41 {
8458    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8459        self.tp
8460            .validate(&helpers::child_path(path, "Tp"), config, collector);
8461        if let Some(ref val) = self.vldty_rg
8462            && config.validate_optional_fields
8463        {
8464            val.validate(&helpers::child_path(path, "VldtyRg"), config, collector);
8465        }
8466    }
8467}
8468
8469// RateType4Choice1: Rate type expressed, in an other form.
8470#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8471pub struct RateType4Choice1 {
8472    #[serde(rename = "Pctg", skip_serializing_if = "Option::is_none")]
8473    pub pctg: Option<f64>,
8474    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
8475    pub othr: Option<String>,
8476}
8477
8478impl Validate for RateType4Choice1 {
8479    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8480        if let Some(ref val) = self.othr {
8481            helpers::validate_length(
8482                val,
8483                "Othr",
8484                Some(1),
8485                Some(35),
8486                &helpers::child_path(path, "Othr"),
8487                config,
8488                collector,
8489            );
8490        }
8491        if let Some(ref val) = self.othr {
8492            helpers::validate_pattern(
8493                val,
8494                "Othr",
8495                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8496                &helpers::child_path(path, "Othr"),
8497                config,
8498                collector,
8499            );
8500        }
8501    }
8502}
8503
8504// ReferredDocumentInformation71: Set of elements used to provide the content of the referred document line.
8505#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8506pub struct ReferredDocumentInformation71 {
8507    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
8508    pub tp: Option<ReferredDocumentType41>,
8509    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
8510    pub nb: Option<String>,
8511    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
8512    pub rltd_dt: Option<String>,
8513    #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
8514    pub line_dtls: Option<Vec<DocumentLineInformation11>>,
8515}
8516
8517impl Validate for ReferredDocumentInformation71 {
8518    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8519        if let Some(ref val) = self.tp
8520            && config.validate_optional_fields
8521        {
8522            val.validate(&helpers::child_path(path, "Tp"), config, collector);
8523        }
8524        if let Some(ref val) = self.nb {
8525            helpers::validate_length(
8526                val,
8527                "Nb",
8528                Some(1),
8529                Some(35),
8530                &helpers::child_path(path, "Nb"),
8531                config,
8532                collector,
8533            );
8534        }
8535        if let Some(ref val) = self.nb {
8536            helpers::validate_pattern(
8537                val,
8538                "Nb",
8539                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8540                &helpers::child_path(path, "Nb"),
8541                config,
8542                collector,
8543            );
8544        }
8545        if let Some(ref vec) = self.line_dtls
8546            && config.validate_optional_fields
8547        {
8548            for item in vec {
8549                item.validate(&helpers::child_path(path, "LineDtls"), config, collector);
8550            }
8551        }
8552    }
8553}
8554
8555// ReferredDocumentType3Choice: Proprietary identification of the type of the remittance document.
8556#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8557pub struct ReferredDocumentType3Choice {
8558    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8559    pub cd: Option<DocumentType6Code>,
8560    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8561    pub prtry: Option<String>,
8562}
8563
8564impl Validate for ReferredDocumentType3Choice {
8565    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8566        if let Some(ref val) = self.cd
8567            && config.validate_optional_fields
8568        {
8569            val.validate(&helpers::child_path(path, "Cd"), config, collector);
8570        }
8571        if let Some(ref val) = self.prtry {
8572            helpers::validate_length(
8573                val,
8574                "Prtry",
8575                Some(1),
8576                Some(35),
8577                &helpers::child_path(path, "Prtry"),
8578                config,
8579                collector,
8580            );
8581        }
8582    }
8583}
8584
8585// ReferredDocumentType41: Identification of the issuer of the reference document type.
8586#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8587pub struct ReferredDocumentType41 {
8588    #[serde(rename = "CdOrPrtry")]
8589    pub cd_or_prtry: ReferredDocumentType3Choice,
8590    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
8591    pub issr: Option<String>,
8592}
8593
8594impl Validate for ReferredDocumentType41 {
8595    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8596        self.cd_or_prtry
8597            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
8598        if let Some(ref val) = self.issr {
8599            helpers::validate_length(
8600                val,
8601                "Issr",
8602                Some(1),
8603                Some(35),
8604                &helpers::child_path(path, "Issr"),
8605                config,
8606                collector,
8607            );
8608        }
8609        if let Some(ref val) = self.issr {
8610            helpers::validate_pattern(
8611                val,
8612                "Issr",
8613                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8614                &helpers::child_path(path, "Issr"),
8615                config,
8616                collector,
8617            );
8618        }
8619    }
8620}
8621
8622// RemittanceAmount21: Amount of money remitted for the referred document.
8623#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8624pub struct RemittanceAmount21 {
8625    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
8626    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8627    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
8628    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
8629    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
8630    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8631    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
8632    pub tax_amt: Option<Vec<TaxAmountAndType1>>,
8633    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
8634    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
8635    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
8636    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8637}
8638
8639impl Validate for RemittanceAmount21 {
8640    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8641        if let Some(ref val) = self.due_pybl_amt
8642            && config.validate_optional_fields
8643        {
8644            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
8645        }
8646        if let Some(ref vec) = self.dscnt_apld_amt
8647            && config.validate_optional_fields
8648        {
8649            for item in vec {
8650                item.validate(
8651                    &helpers::child_path(path, "DscntApldAmt"),
8652                    config,
8653                    collector,
8654                );
8655            }
8656        }
8657        if let Some(ref val) = self.cdt_note_amt
8658            && config.validate_optional_fields
8659        {
8660            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
8661        }
8662        if let Some(ref vec) = self.tax_amt
8663            && config.validate_optional_fields
8664        {
8665            for item in vec {
8666                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
8667            }
8668        }
8669        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
8670            && config.validate_optional_fields
8671        {
8672            for item in vec {
8673                item.validate(
8674                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
8675                    config,
8676                    collector,
8677                );
8678            }
8679        }
8680        if let Some(ref val) = self.rmtd_amt
8681            && config.validate_optional_fields
8682        {
8683            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
8684        }
8685    }
8686}
8687
8688// RemittanceAmount31: Amount of money remitted.
8689#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8690pub struct RemittanceAmount31 {
8691    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
8692    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8693    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
8694    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
8695    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
8696    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8697    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
8698    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
8699    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
8700    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
8701    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
8702    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8703}
8704
8705impl Validate for RemittanceAmount31 {
8706    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8707        if let Some(ref val) = self.due_pybl_amt
8708            && config.validate_optional_fields
8709        {
8710            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
8711        }
8712        if let Some(ref vec) = self.dscnt_apld_amt
8713            && config.validate_optional_fields
8714        {
8715            for item in vec {
8716                item.validate(
8717                    &helpers::child_path(path, "DscntApldAmt"),
8718                    config,
8719                    collector,
8720                );
8721            }
8722        }
8723        if let Some(ref val) = self.cdt_note_amt
8724            && config.validate_optional_fields
8725        {
8726            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
8727        }
8728        if let Some(ref vec) = self.tax_amt
8729            && config.validate_optional_fields
8730        {
8731            for item in vec {
8732                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
8733            }
8734        }
8735        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
8736            && config.validate_optional_fields
8737        {
8738            for item in vec {
8739                item.validate(
8740                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
8741                    config,
8742                    collector,
8743                );
8744            }
8745        }
8746        if let Some(ref val) = self.rmtd_amt
8747            && config.validate_optional_fields
8748        {
8749            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
8750        }
8751    }
8752}
8753
8754// 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.
8755#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8756pub struct RemittanceInformation161 {
8757    #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
8758    pub ustrd: Option<String>,
8759    #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
8760    pub strd: Option<Vec<StructuredRemittanceInformation161>>,
8761}
8762
8763impl Validate for RemittanceInformation161 {
8764    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8765        if let Some(ref val) = self.ustrd {
8766            helpers::validate_length(
8767                val,
8768                "Ustrd",
8769                Some(1),
8770                Some(140),
8771                &helpers::child_path(path, "Ustrd"),
8772                config,
8773                collector,
8774            );
8775        }
8776        if let Some(ref val) = self.ustrd {
8777            helpers::validate_pattern(
8778                val,
8779                "Ustrd",
8780                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8781                &helpers::child_path(path, "Ustrd"),
8782                config,
8783                collector,
8784            );
8785        }
8786        if let Some(ref vec) = self.strd
8787            && config.validate_optional_fields
8788        {
8789            for item in vec {
8790                item.validate(&helpers::child_path(path, "Strd"), config, collector);
8791            }
8792        }
8793    }
8794}
8795
8796// RemittanceLocation71: Set of elements used to provide information on the location and/or delivery of the remittance information.
8797#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8798pub struct RemittanceLocation71 {
8799    #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
8800    pub rmt_id: Option<String>,
8801    #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
8802    pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
8803}
8804
8805impl Validate for RemittanceLocation71 {
8806    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8807        if let Some(ref val) = self.rmt_id {
8808            helpers::validate_length(
8809                val,
8810                "RmtId",
8811                Some(1),
8812                Some(35),
8813                &helpers::child_path(path, "RmtId"),
8814                config,
8815                collector,
8816            );
8817        }
8818        if let Some(ref val) = self.rmt_id {
8819            helpers::validate_pattern(
8820                val,
8821                "RmtId",
8822                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8823                &helpers::child_path(path, "RmtId"),
8824                config,
8825                collector,
8826            );
8827        }
8828        if let Some(ref vec) = self.rmt_lctn_dtls
8829            && config.validate_optional_fields
8830        {
8831            for item in vec {
8832                item.validate(&helpers::child_path(path, "RmtLctnDtls"), config, collector);
8833            }
8834        }
8835    }
8836}
8837
8838// RemittanceLocationData11: Postal address to which an agent is to send the remittance information.
8839#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8840pub struct RemittanceLocationData11 {
8841    #[serde(rename = "Mtd")]
8842    pub mtd: RemittanceLocationMethod2Code,
8843    #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
8844    pub elctrnc_adr: Option<String>,
8845    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
8846    pub pstl_adr: Option<NameAndAddress161>,
8847}
8848
8849impl Validate for RemittanceLocationData11 {
8850    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8851        self.mtd
8852            .validate(&helpers::child_path(path, "Mtd"), config, collector);
8853        if let Some(ref val) = self.elctrnc_adr {
8854            helpers::validate_length(
8855                val,
8856                "ElctrncAdr",
8857                Some(1),
8858                Some(2048),
8859                &helpers::child_path(path, "ElctrncAdr"),
8860                config,
8861                collector,
8862            );
8863        }
8864        if let Some(ref val) = self.elctrnc_adr {
8865            helpers::validate_pattern(
8866                val,
8867                "ElctrncAdr",
8868                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8869                &helpers::child_path(path, "ElctrncAdr"),
8870                config,
8871                collector,
8872            );
8873        }
8874        if let Some(ref val) = self.pstl_adr
8875            && config.validate_optional_fields
8876        {
8877            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
8878        }
8879    }
8880}
8881
8882// RemittanceLocationMethod2Code: Remittance advice information must be sent through by phone as a short message service (SMS).
8883#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8884pub enum RemittanceLocationMethod2Code {
8885    #[default]
8886    #[serde(rename = "FAXI")]
8887    CodeFAXI,
8888    #[serde(rename = "EDIC")]
8889    CodeEDIC,
8890    #[serde(rename = "URID")]
8891    CodeURID,
8892    #[serde(rename = "EMAL")]
8893    CodeEMAL,
8894    #[serde(rename = "POST")]
8895    CodePOST,
8896    #[serde(rename = "SMSM")]
8897    CodeSMSM,
8898}
8899
8900impl Validate for RemittanceLocationMethod2Code {
8901    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
8902        // Enum validation is typically empty
8903    }
8904}
8905
8906// ReportEntry101: Further details of the entry.
8907#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8908pub struct ReportEntry101 {
8909    #[serde(rename = "NtryRef", skip_serializing_if = "Option::is_none")]
8910    pub ntry_ref: Option<String>,
8911    #[serde(rename = "Amt")]
8912    pub amt: ActiveOrHistoricCurrencyAndAmount,
8913    #[serde(rename = "CdtDbtInd")]
8914    pub cdt_dbt_ind: CreditDebitCode,
8915    #[serde(rename = "RvslInd", skip_serializing_if = "Option::is_none")]
8916    pub rvsl_ind: Option<bool>,
8917    #[serde(rename = "Sts")]
8918    pub sts: EntryStatus1Choice1,
8919    #[serde(rename = "BookgDt", skip_serializing_if = "Option::is_none")]
8920    pub bookg_dt: Option<DateAndDateTime2Choice1>,
8921    #[serde(rename = "ValDt")]
8922    pub val_dt: DateAndDateTime2Choice1,
8923    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
8924    pub acct_svcr_ref: Option<String>,
8925    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
8926    pub avlbty: Option<Vec<CashAvailability1>>,
8927    #[serde(rename = "BkTxCd")]
8928    pub bk_tx_cd: BankTransactionCodeStructure41,
8929    #[serde(rename = "ComssnWvrInd", skip_serializing_if = "Option::is_none")]
8930    pub comssn_wvr_ind: Option<bool>,
8931    #[serde(rename = "AddtlInfInd", skip_serializing_if = "Option::is_none")]
8932    pub addtl_inf_ind: Option<MessageIdentification21>,
8933    #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
8934    pub amt_dtls: Option<AmountAndCurrencyExchange31>,
8935    #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
8936    pub chrgs: Option<Charges61>,
8937    #[serde(rename = "TechInptChanl", skip_serializing_if = "Option::is_none")]
8938    pub tech_inpt_chanl: Option<TechnicalInputChannel1Choice1>,
8939    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
8940    pub intrst: Option<TransactionInterest41>,
8941    #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
8942    pub card_tx: Option<CardEntry41>,
8943    #[serde(rename = "NtryDtls", skip_serializing_if = "Option::is_none")]
8944    pub ntry_dtls: Option<Vec<Box<EntryDetails91>>>,
8945    #[serde(rename = "AddtlNtryInf", skip_serializing_if = "Option::is_none")]
8946    pub addtl_ntry_inf: Option<String>,
8947}
8948
8949impl Validate for ReportEntry101 {
8950    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8951        if let Some(ref val) = self.ntry_ref {
8952            helpers::validate_length(
8953                val,
8954                "NtryRef",
8955                Some(1),
8956                Some(35),
8957                &helpers::child_path(path, "NtryRef"),
8958                config,
8959                collector,
8960            );
8961        }
8962        if let Some(ref val) = self.ntry_ref {
8963            helpers::validate_pattern(
8964                val,
8965                "NtryRef",
8966                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8967                &helpers::child_path(path, "NtryRef"),
8968                config,
8969                collector,
8970            );
8971        }
8972        self.amt
8973            .validate(&helpers::child_path(path, "Amt"), config, collector);
8974        self.cdt_dbt_ind
8975            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
8976        self.sts
8977            .validate(&helpers::child_path(path, "Sts"), config, collector);
8978        if let Some(ref val) = self.bookg_dt
8979            && config.validate_optional_fields
8980        {
8981            val.validate(&helpers::child_path(path, "BookgDt"), config, collector);
8982        }
8983        self.val_dt
8984            .validate(&helpers::child_path(path, "ValDt"), config, collector);
8985        if let Some(ref val) = self.acct_svcr_ref {
8986            helpers::validate_length(
8987                val,
8988                "AcctSvcrRef",
8989                Some(1),
8990                Some(35),
8991                &helpers::child_path(path, "AcctSvcrRef"),
8992                config,
8993                collector,
8994            );
8995        }
8996        if let Some(ref val) = self.acct_svcr_ref {
8997            helpers::validate_pattern(
8998                val,
8999                "AcctSvcrRef",
9000                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9001                &helpers::child_path(path, "AcctSvcrRef"),
9002                config,
9003                collector,
9004            );
9005        }
9006        if let Some(ref vec) = self.avlbty
9007            && config.validate_optional_fields
9008        {
9009            for item in vec {
9010                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
9011            }
9012        }
9013        self.bk_tx_cd
9014            .validate(&helpers::child_path(path, "BkTxCd"), config, collector);
9015        if let Some(ref val) = self.addtl_inf_ind
9016            && config.validate_optional_fields
9017        {
9018            val.validate(&helpers::child_path(path, "AddtlInfInd"), config, collector);
9019        }
9020        if let Some(ref val) = self.amt_dtls
9021            && config.validate_optional_fields
9022        {
9023            val.validate(&helpers::child_path(path, "AmtDtls"), config, collector);
9024        }
9025        if let Some(ref val) = self.chrgs
9026            && config.validate_optional_fields
9027        {
9028            val.validate(&helpers::child_path(path, "Chrgs"), config, collector);
9029        }
9030        if let Some(ref val) = self.tech_inpt_chanl
9031            && config.validate_optional_fields
9032        {
9033            val.validate(
9034                &helpers::child_path(path, "TechInptChanl"),
9035                config,
9036                collector,
9037            );
9038        }
9039        if let Some(ref val) = self.intrst
9040            && config.validate_optional_fields
9041        {
9042            val.validate(&helpers::child_path(path, "Intrst"), config, collector);
9043        }
9044        if let Some(ref val) = self.card_tx
9045            && config.validate_optional_fields
9046        {
9047            val.validate(&helpers::child_path(path, "CardTx"), config, collector);
9048        }
9049        if let Some(ref vec) = self.ntry_dtls
9050            && config.validate_optional_fields
9051        {
9052            for item in vec {
9053                item.validate(&helpers::child_path(path, "NtryDtls"), config, collector);
9054            }
9055        }
9056        if let Some(ref val) = self.addtl_ntry_inf {
9057            helpers::validate_length(
9058                val,
9059                "AddtlNtryInf",
9060                Some(1),
9061                Some(500),
9062                &helpers::child_path(path, "AddtlNtryInf"),
9063                config,
9064                collector,
9065            );
9066        }
9067        if let Some(ref val) = self.addtl_ntry_inf {
9068            helpers::validate_pattern(
9069                val,
9070                "AddtlNtryInf",
9071                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9072                &helpers::child_path(path, "AddtlNtryInf"),
9073                config,
9074                collector,
9075            );
9076        }
9077    }
9078}
9079
9080// ReportingSource1Choice1: Reporting source, in a proprietary form.
9081#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9082pub struct ReportingSource1Choice1 {
9083    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9084    pub cd: Option<String>,
9085    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9086    pub prtry: Option<String>,
9087}
9088
9089impl Validate for ReportingSource1Choice1 {
9090    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9091        if let Some(ref val) = self.cd {
9092            helpers::validate_length(
9093                val,
9094                "Cd",
9095                Some(1),
9096                Some(4),
9097                &helpers::child_path(path, "Cd"),
9098                config,
9099                collector,
9100            );
9101        }
9102        if let Some(ref val) = self.prtry {
9103            helpers::validate_length(
9104                val,
9105                "Prtry",
9106                Some(1),
9107                Some(35),
9108                &helpers::child_path(path, "Prtry"),
9109                config,
9110                collector,
9111            );
9112        }
9113        if let Some(ref val) = self.prtry {
9114            helpers::validate_pattern(
9115                val,
9116                "Prtry",
9117                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9118                &helpers::child_path(path, "Prtry"),
9119                config,
9120                collector,
9121            );
9122        }
9123    }
9124}
9125
9126// ReturnReason5Choice1: Reason for the return, in a proprietary form.
9127#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9128pub struct ReturnReason5Choice1 {
9129    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9130    pub cd: Option<String>,
9131    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9132    pub prtry: Option<String>,
9133}
9134
9135impl Validate for ReturnReason5Choice1 {
9136    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9137        if let Some(ref val) = self.cd {
9138            helpers::validate_length(
9139                val,
9140                "Cd",
9141                Some(1),
9142                Some(4),
9143                &helpers::child_path(path, "Cd"),
9144                config,
9145                collector,
9146            );
9147        }
9148        if let Some(ref val) = self.prtry {
9149            helpers::validate_length(
9150                val,
9151                "Prtry",
9152                Some(1),
9153                Some(35),
9154                &helpers::child_path(path, "Prtry"),
9155                config,
9156                collector,
9157            );
9158        }
9159        if let Some(ref val) = self.prtry {
9160            helpers::validate_pattern(
9161                val,
9162                "Prtry",
9163                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9164                &helpers::child_path(path, "Prtry"),
9165                config,
9166                collector,
9167            );
9168        }
9169    }
9170}
9171
9172// SecuritiesAccount191: Description of the account.
9173#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9174pub struct SecuritiesAccount191 {
9175    #[serde(rename = "Id")]
9176    pub id: String,
9177    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9178    pub tp: Option<GenericIdentification302>,
9179    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9180    pub nm: Option<String>,
9181}
9182
9183impl Validate for SecuritiesAccount191 {
9184    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9185        helpers::validate_length(
9186            &self.id,
9187            "Id",
9188            Some(1),
9189            Some(35),
9190            &helpers::child_path(path, "Id"),
9191            config,
9192            collector,
9193        );
9194        helpers::validate_pattern(
9195            &self.id,
9196            "Id",
9197            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9198            &helpers::child_path(path, "Id"),
9199            config,
9200            collector,
9201        );
9202        if let Some(ref val) = self.tp
9203            && config.validate_optional_fields
9204        {
9205            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9206        }
9207        if let Some(ref val) = self.nm {
9208            helpers::validate_length(
9209                val,
9210                "Nm",
9211                Some(1),
9212                Some(70),
9213                &helpers::child_path(path, "Nm"),
9214                config,
9215                collector,
9216            );
9217        }
9218        if let Some(ref val) = self.nm {
9219            helpers::validate_pattern(
9220                val,
9221                "Nm",
9222                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9223                &helpers::child_path(path, "Nm"),
9224                config,
9225                collector,
9226            );
9227        }
9228    }
9229}
9230
9231// SecurityIdentification191: Textual description of a security instrument.
9232#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9233pub struct SecurityIdentification191 {
9234    #[serde(rename = "ISIN", skip_serializing_if = "Option::is_none")]
9235    pub isin: Option<String>,
9236    #[serde(rename = "OthrId", skip_serializing_if = "Option::is_none")]
9237    pub othr_id: Option<Vec<OtherIdentification11>>,
9238    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
9239    pub desc: Option<String>,
9240}
9241
9242impl Validate for SecurityIdentification191 {
9243    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9244        if let Some(ref val) = self.isin {
9245            helpers::validate_pattern(
9246                val,
9247                "ISIN",
9248                "[A-Z]{2,2}[A-Z0-9]{9,9}[0-9]{1,1}",
9249                &helpers::child_path(path, "ISIN"),
9250                config,
9251                collector,
9252            );
9253        }
9254        if let Some(ref vec) = self.othr_id
9255            && config.validate_optional_fields
9256        {
9257            for item in vec {
9258                item.validate(&helpers::child_path(path, "OthrId"), config, collector);
9259            }
9260        }
9261        if let Some(ref val) = self.desc {
9262            helpers::validate_length(
9263                val,
9264                "Desc",
9265                Some(1),
9266                Some(35),
9267                &helpers::child_path(path, "Desc"),
9268                config,
9269                collector,
9270            );
9271        }
9272        if let Some(ref val) = self.desc {
9273            helpers::validate_pattern(
9274                val,
9275                "Desc",
9276                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9277                &helpers::child_path(path, "Desc"),
9278                config,
9279                collector,
9280            );
9281        }
9282    }
9283}
9284
9285// SequenceRange1Choice1: Specified sequence to be excluded.
9286#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9287pub struct SequenceRange1Choice1 {
9288    #[serde(rename = "FrSeq", skip_serializing_if = "Option::is_none")]
9289    pub fr_seq: Option<String>,
9290    #[serde(rename = "ToSeq", skip_serializing_if = "Option::is_none")]
9291    pub to_seq: Option<String>,
9292    #[serde(rename = "FrToSeq", skip_serializing_if = "Option::is_none")]
9293    pub fr_to_seq: Option<Vec<SequenceRange11>>,
9294    #[serde(rename = "EQSeq", skip_serializing_if = "Option::is_none")]
9295    pub eq_seq: Option<Vec<String>>,
9296    #[serde(rename = "NEQSeq", skip_serializing_if = "Option::is_none")]
9297    pub neq_seq: Option<Vec<String>>,
9298}
9299
9300impl Validate for SequenceRange1Choice1 {
9301    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9302        if let Some(ref val) = self.fr_seq {
9303            helpers::validate_length(
9304                val,
9305                "FrSeq",
9306                Some(1),
9307                Some(35),
9308                &helpers::child_path(path, "FrSeq"),
9309                config,
9310                collector,
9311            );
9312        }
9313        if let Some(ref val) = self.fr_seq {
9314            helpers::validate_pattern(
9315                val,
9316                "FrSeq",
9317                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9318                &helpers::child_path(path, "FrSeq"),
9319                config,
9320                collector,
9321            );
9322        }
9323        if let Some(ref val) = self.to_seq {
9324            helpers::validate_length(
9325                val,
9326                "ToSeq",
9327                Some(1),
9328                Some(35),
9329                &helpers::child_path(path, "ToSeq"),
9330                config,
9331                collector,
9332            );
9333        }
9334        if let Some(ref val) = self.to_seq {
9335            helpers::validate_pattern(
9336                val,
9337                "ToSeq",
9338                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9339                &helpers::child_path(path, "ToSeq"),
9340                config,
9341                collector,
9342            );
9343        }
9344        if let Some(ref vec) = self.fr_to_seq
9345            && config.validate_optional_fields
9346        {
9347            for item in vec {
9348                item.validate(&helpers::child_path(path, "FrToSeq"), config, collector);
9349            }
9350        }
9351        if let Some(ref vec) = self.eq_seq {
9352            for item in vec {
9353                helpers::validate_length(
9354                    item,
9355                    "EQSeq",
9356                    Some(1),
9357                    Some(35),
9358                    &helpers::child_path(path, "EQSeq"),
9359                    config,
9360                    collector,
9361                );
9362            }
9363        }
9364        if let Some(ref vec) = self.eq_seq {
9365            for item in vec {
9366                helpers::validate_pattern(
9367                    item,
9368                    "EQSeq",
9369                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9370                    &helpers::child_path(path, "EQSeq"),
9371                    config,
9372                    collector,
9373                );
9374            }
9375        }
9376        if let Some(ref vec) = self.neq_seq {
9377            for item in vec {
9378                helpers::validate_length(
9379                    item,
9380                    "NEQSeq",
9381                    Some(1),
9382                    Some(35),
9383                    &helpers::child_path(path, "NEQSeq"),
9384                    config,
9385                    collector,
9386                );
9387            }
9388        }
9389        if let Some(ref vec) = self.neq_seq {
9390            for item in vec {
9391                helpers::validate_pattern(
9392                    item,
9393                    "NEQSeq",
9394                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9395                    &helpers::child_path(path, "NEQSeq"),
9396                    config,
9397                    collector,
9398                );
9399            }
9400        }
9401    }
9402}
9403
9404// SequenceRange11: End sequence of the range.
9405#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9406pub struct SequenceRange11 {
9407    #[serde(rename = "FrSeq")]
9408    pub fr_seq: String,
9409    #[serde(rename = "ToSeq")]
9410    pub to_seq: String,
9411}
9412
9413impl Validate for SequenceRange11 {
9414    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9415        helpers::validate_length(
9416            &self.fr_seq,
9417            "FrSeq",
9418            Some(1),
9419            Some(35),
9420            &helpers::child_path(path, "FrSeq"),
9421            config,
9422            collector,
9423        );
9424        helpers::validate_pattern(
9425            &self.fr_seq,
9426            "FrSeq",
9427            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9428            &helpers::child_path(path, "FrSeq"),
9429            config,
9430            collector,
9431        );
9432        helpers::validate_length(
9433            &self.to_seq,
9434            "ToSeq",
9435            Some(1),
9436            Some(35),
9437            &helpers::child_path(path, "ToSeq"),
9438            config,
9439            collector,
9440        );
9441        helpers::validate_pattern(
9442            &self.to_seq,
9443            "ToSeq",
9444            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9445            &helpers::child_path(path, "ToSeq"),
9446            config,
9447            collector,
9448        );
9449    }
9450}
9451
9452// StructuredRemittanceInformation161: Additional information, in free text form, to complement the structured remittance information.
9453#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9454pub struct StructuredRemittanceInformation161 {
9455    #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
9456    pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
9457    #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
9458    pub rfrd_doc_amt: Option<RemittanceAmount21>,
9459    #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
9460    pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
9461    #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
9462    pub invcr: Option<PartyIdentification1353>,
9463    #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
9464    pub invcee: Option<PartyIdentification1353>,
9465    #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
9466    pub tax_rmt: Option<TaxInformation71>,
9467    #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
9468    pub grnshmt_rmt: Option<Garnishment31>,
9469    #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
9470    pub addtl_rmt_inf: Option<Vec<String>>,
9471}
9472
9473impl Validate for StructuredRemittanceInformation161 {
9474    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9475        if let Some(ref vec) = self.rfrd_doc_inf
9476            && config.validate_optional_fields
9477        {
9478            for item in vec {
9479                item.validate(&helpers::child_path(path, "RfrdDocInf"), config, collector);
9480            }
9481        }
9482        if let Some(ref val) = self.rfrd_doc_amt
9483            && config.validate_optional_fields
9484        {
9485            val.validate(&helpers::child_path(path, "RfrdDocAmt"), config, collector);
9486        }
9487        if let Some(ref val) = self.cdtr_ref_inf
9488            && config.validate_optional_fields
9489        {
9490            val.validate(&helpers::child_path(path, "CdtrRefInf"), config, collector);
9491        }
9492        if let Some(ref val) = self.invcr
9493            && config.validate_optional_fields
9494        {
9495            val.validate(&helpers::child_path(path, "Invcr"), config, collector);
9496        }
9497        if let Some(ref val) = self.invcee
9498            && config.validate_optional_fields
9499        {
9500            val.validate(&helpers::child_path(path, "Invcee"), config, collector);
9501        }
9502        if let Some(ref val) = self.tax_rmt
9503            && config.validate_optional_fields
9504        {
9505            val.validate(&helpers::child_path(path, "TaxRmt"), config, collector);
9506        }
9507        if let Some(ref val) = self.grnshmt_rmt
9508            && config.validate_optional_fields
9509        {
9510            val.validate(&helpers::child_path(path, "GrnshmtRmt"), config, collector);
9511        }
9512        if let Some(ref vec) = self.addtl_rmt_inf {
9513            for item in vec {
9514                helpers::validate_length(
9515                    item,
9516                    "AddtlRmtInf",
9517                    Some(1),
9518                    Some(140),
9519                    &helpers::child_path(path, "AddtlRmtInf"),
9520                    config,
9521                    collector,
9522                );
9523            }
9524        }
9525        if let Some(ref vec) = self.addtl_rmt_inf {
9526            for item in vec {
9527                helpers::validate_pattern(
9528                    item,
9529                    "AddtlRmtInf",
9530                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9531                    &helpers::child_path(path, "AddtlRmtInf"),
9532                    config,
9533                    collector,
9534                );
9535            }
9536        }
9537    }
9538}
9539
9540// TaxAmount2: Set of elements used to provide details on the tax period and amount.
9541#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9542pub struct TaxAmount2 {
9543    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9544    pub rate: Option<f64>,
9545    #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
9546    pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9547    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
9548    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9549    #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
9550    pub dtls: Option<Vec<TaxRecordDetails2>>,
9551}
9552
9553impl Validate for TaxAmount2 {
9554    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9555        if let Some(ref val) = self.taxbl_base_amt
9556            && config.validate_optional_fields
9557        {
9558            val.validate(
9559                &helpers::child_path(path, "TaxblBaseAmt"),
9560                config,
9561                collector,
9562            );
9563        }
9564        if let Some(ref val) = self.ttl_amt
9565            && config.validate_optional_fields
9566        {
9567            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
9568        }
9569        if let Some(ref vec) = self.dtls
9570            && config.validate_optional_fields
9571        {
9572            for item in vec {
9573                item.validate(&helpers::child_path(path, "Dtls"), config, collector);
9574            }
9575        }
9576    }
9577}
9578
9579// TaxAmountAndType1: Amount of money, which has been typed.
9580#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9581pub struct TaxAmountAndType1 {
9582    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9583    pub tp: Option<TaxAmountType1Choice>,
9584    #[serde(rename = "Amt")]
9585    pub amt: ActiveOrHistoricCurrencyAndAmount,
9586}
9587
9588impl Validate for TaxAmountAndType1 {
9589    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9590        if let Some(ref val) = self.tp
9591            && config.validate_optional_fields
9592        {
9593            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9594        }
9595        self.amt
9596            .validate(&helpers::child_path(path, "Amt"), config, collector);
9597    }
9598}
9599
9600// TaxAmountAndType11: Amount of money, which has been typed.
9601#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9602pub struct TaxAmountAndType11 {
9603    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9604    pub tp: Option<TaxAmountType1Choice1>,
9605    #[serde(rename = "Amt")]
9606    pub amt: ActiveOrHistoricCurrencyAndAmount,
9607}
9608
9609impl Validate for TaxAmountAndType11 {
9610    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9611        if let Some(ref val) = self.tp
9612            && config.validate_optional_fields
9613        {
9614            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9615        }
9616        self.amt
9617            .validate(&helpers::child_path(path, "Amt"), config, collector);
9618    }
9619}
9620
9621// TaxAmountType1Choice: Specifies the amount type, in a free-text form.
9622#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9623pub struct TaxAmountType1Choice {
9624    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9625    pub cd: Option<String>,
9626    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9627    pub prtry: Option<String>,
9628}
9629
9630impl Validate for TaxAmountType1Choice {
9631    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9632        if let Some(ref val) = self.cd {
9633            helpers::validate_length(
9634                val,
9635                "Cd",
9636                Some(1),
9637                Some(4),
9638                &helpers::child_path(path, "Cd"),
9639                config,
9640                collector,
9641            );
9642        }
9643        if let Some(ref val) = self.prtry {
9644            helpers::validate_length(
9645                val,
9646                "Prtry",
9647                Some(1),
9648                Some(35),
9649                &helpers::child_path(path, "Prtry"),
9650                config,
9651                collector,
9652            );
9653        }
9654    }
9655}
9656
9657// TaxAmountType1Choice1: Specifies the amount type, in a free-text form.
9658#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9659pub struct TaxAmountType1Choice1 {
9660    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9661    pub cd: Option<String>,
9662    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9663    pub prtry: Option<String>,
9664}
9665
9666impl Validate for TaxAmountType1Choice1 {
9667    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9668        if let Some(ref val) = self.cd {
9669            helpers::validate_length(
9670                val,
9671                "Cd",
9672                Some(1),
9673                Some(4),
9674                &helpers::child_path(path, "Cd"),
9675                config,
9676                collector,
9677            );
9678        }
9679        if let Some(ref val) = self.prtry {
9680            helpers::validate_length(
9681                val,
9682                "Prtry",
9683                Some(1),
9684                Some(35),
9685                &helpers::child_path(path, "Prtry"),
9686                config,
9687                collector,
9688            );
9689        }
9690        if let Some(ref val) = self.prtry {
9691            helpers::validate_pattern(
9692                val,
9693                "Prtry",
9694                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9695                &helpers::child_path(path, "Prtry"),
9696                config,
9697                collector,
9698            );
9699        }
9700    }
9701}
9702
9703// TaxAuthorisation11: Name of the debtor or the debtor's authorised representative.
9704#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9705pub struct TaxAuthorisation11 {
9706    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
9707    pub titl: Option<String>,
9708    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9709    pub nm: Option<String>,
9710}
9711
9712impl Validate for TaxAuthorisation11 {
9713    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9714        if let Some(ref val) = self.titl {
9715            helpers::validate_length(
9716                val,
9717                "Titl",
9718                Some(1),
9719                Some(35),
9720                &helpers::child_path(path, "Titl"),
9721                config,
9722                collector,
9723            );
9724        }
9725        if let Some(ref val) = self.titl {
9726            helpers::validate_pattern(
9727                val,
9728                "Titl",
9729                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9730                &helpers::child_path(path, "Titl"),
9731                config,
9732                collector,
9733            );
9734        }
9735        if let Some(ref val) = self.nm {
9736            helpers::validate_length(
9737                val,
9738                "Nm",
9739                Some(1),
9740                Some(140),
9741                &helpers::child_path(path, "Nm"),
9742                config,
9743                collector,
9744            );
9745        }
9746        if let Some(ref val) = self.nm {
9747            helpers::validate_pattern(
9748                val,
9749                "Nm",
9750                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9751                &helpers::child_path(path, "Nm"),
9752                config,
9753                collector,
9754            );
9755        }
9756    }
9757}
9758
9759// TaxAuthorisation12: Name of the debtor or the debtor's authorised representative.
9760#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9761pub struct TaxAuthorisation12 {
9762    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
9763    pub titl: Option<String>,
9764    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9765    pub nm: Option<String>,
9766}
9767
9768impl Validate for TaxAuthorisation12 {
9769    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9770        if let Some(ref val) = self.titl {
9771            helpers::validate_length(
9772                val,
9773                "Titl",
9774                Some(1),
9775                Some(35),
9776                &helpers::child_path(path, "Titl"),
9777                config,
9778                collector,
9779            );
9780        }
9781        if let Some(ref val) = self.titl {
9782            helpers::validate_pattern(
9783                val,
9784                "Titl",
9785                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9786                &helpers::child_path(path, "Titl"),
9787                config,
9788                collector,
9789            );
9790        }
9791        if let Some(ref val) = self.nm {
9792            helpers::validate_length(
9793                val,
9794                "Nm",
9795                Some(1),
9796                Some(140),
9797                &helpers::child_path(path, "Nm"),
9798                config,
9799                collector,
9800            );
9801        }
9802        if let Some(ref val) = self.nm {
9803            helpers::validate_pattern(
9804                val,
9805                "Nm",
9806                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9807                &helpers::child_path(path, "Nm"),
9808                config,
9809                collector,
9810            );
9811        }
9812    }
9813}
9814
9815// TaxCharges21: Amount of money resulting from the calculation of the tax.
9816#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9817pub struct TaxCharges21 {
9818    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
9819    pub id: Option<String>,
9820    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9821    pub rate: Option<f64>,
9822    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
9823    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9824}
9825
9826impl Validate for TaxCharges21 {
9827    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9828        if let Some(ref val) = self.id {
9829            helpers::validate_length(
9830                val,
9831                "Id",
9832                Some(1),
9833                Some(35),
9834                &helpers::child_path(path, "Id"),
9835                config,
9836                collector,
9837            );
9838        }
9839        if let Some(ref val) = self.id {
9840            helpers::validate_pattern(
9841                val,
9842                "Id",
9843                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9844                &helpers::child_path(path, "Id"),
9845                config,
9846                collector,
9847            );
9848        }
9849        if let Some(ref val) = self.amt
9850            && config.validate_optional_fields
9851        {
9852            val.validate(&helpers::child_path(path, "Amt"), config, collector);
9853        }
9854    }
9855}
9856
9857// TaxInformation71: Record of tax details.
9858#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9859pub struct TaxInformation71 {
9860    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
9861    pub cdtr: Option<TaxParty11>,
9862    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
9863    pub dbtr: Option<TaxParty21>,
9864    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
9865    pub ultmt_dbtr: Option<TaxParty21>,
9866    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
9867    pub admstn_zone: Option<String>,
9868    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
9869    pub ref_nb: Option<String>,
9870    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
9871    pub mtd: Option<String>,
9872    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
9873    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9874    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
9875    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9876    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
9877    pub dt: Option<String>,
9878    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
9879    pub seq_nb: Option<f64>,
9880    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
9881    pub rcrd: Option<Vec<TaxRecord21>>,
9882}
9883
9884impl Validate for TaxInformation71 {
9885    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9886        if let Some(ref val) = self.cdtr
9887            && config.validate_optional_fields
9888        {
9889            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
9890        }
9891        if let Some(ref val) = self.dbtr
9892            && config.validate_optional_fields
9893        {
9894            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
9895        }
9896        if let Some(ref val) = self.ultmt_dbtr
9897            && config.validate_optional_fields
9898        {
9899            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
9900        }
9901        if let Some(ref val) = self.admstn_zone {
9902            helpers::validate_length(
9903                val,
9904                "AdmstnZone",
9905                Some(1),
9906                Some(35),
9907                &helpers::child_path(path, "AdmstnZone"),
9908                config,
9909                collector,
9910            );
9911        }
9912        if let Some(ref val) = self.admstn_zone {
9913            helpers::validate_pattern(
9914                val,
9915                "AdmstnZone",
9916                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9917                &helpers::child_path(path, "AdmstnZone"),
9918                config,
9919                collector,
9920            );
9921        }
9922        if let Some(ref val) = self.ref_nb {
9923            helpers::validate_length(
9924                val,
9925                "RefNb",
9926                Some(1),
9927                Some(140),
9928                &helpers::child_path(path, "RefNb"),
9929                config,
9930                collector,
9931            );
9932        }
9933        if let Some(ref val) = self.ref_nb {
9934            helpers::validate_pattern(
9935                val,
9936                "RefNb",
9937                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9938                &helpers::child_path(path, "RefNb"),
9939                config,
9940                collector,
9941            );
9942        }
9943        if let Some(ref val) = self.mtd {
9944            helpers::validate_length(
9945                val,
9946                "Mtd",
9947                Some(1),
9948                Some(35),
9949                &helpers::child_path(path, "Mtd"),
9950                config,
9951                collector,
9952            );
9953        }
9954        if let Some(ref val) = self.mtd {
9955            helpers::validate_pattern(
9956                val,
9957                "Mtd",
9958                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9959                &helpers::child_path(path, "Mtd"),
9960                config,
9961                collector,
9962            );
9963        }
9964        if let Some(ref val) = self.ttl_taxbl_base_amt
9965            && config.validate_optional_fields
9966        {
9967            val.validate(
9968                &helpers::child_path(path, "TtlTaxblBaseAmt"),
9969                config,
9970                collector,
9971            );
9972        }
9973        if let Some(ref val) = self.ttl_tax_amt
9974            && config.validate_optional_fields
9975        {
9976            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
9977        }
9978        if let Some(ref vec) = self.rcrd
9979            && config.validate_optional_fields
9980        {
9981            for item in vec {
9982                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
9983            }
9984        }
9985    }
9986}
9987
9988// TaxInformation81: Record of tax details.
9989#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9990pub struct TaxInformation81 {
9991    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
9992    pub cdtr: Option<TaxParty12>,
9993    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
9994    pub dbtr: Option<TaxParty22>,
9995    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
9996    pub admstn_zone: Option<String>,
9997    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
9998    pub ref_nb: Option<String>,
9999    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
10000    pub mtd: Option<String>,
10001    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
10002    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10003    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
10004    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10005    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
10006    pub dt: Option<String>,
10007    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
10008    pub seq_nb: Option<f64>,
10009    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
10010    pub rcrd: Option<Vec<TaxRecord22>>,
10011}
10012
10013impl Validate for TaxInformation81 {
10014    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10015        if let Some(ref val) = self.cdtr
10016            && config.validate_optional_fields
10017        {
10018            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
10019        }
10020        if let Some(ref val) = self.dbtr
10021            && config.validate_optional_fields
10022        {
10023            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
10024        }
10025        if let Some(ref val) = self.admstn_zone {
10026            helpers::validate_length(
10027                val,
10028                "AdmstnZone",
10029                Some(1),
10030                Some(35),
10031                &helpers::child_path(path, "AdmstnZone"),
10032                config,
10033                collector,
10034            );
10035        }
10036        if let Some(ref val) = self.admstn_zone {
10037            helpers::validate_pattern(
10038                val,
10039                "AdmstnZone",
10040                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10041                &helpers::child_path(path, "AdmstnZone"),
10042                config,
10043                collector,
10044            );
10045        }
10046        if let Some(ref val) = self.ref_nb {
10047            helpers::validate_length(
10048                val,
10049                "RefNb",
10050                Some(1),
10051                Some(140),
10052                &helpers::child_path(path, "RefNb"),
10053                config,
10054                collector,
10055            );
10056        }
10057        if let Some(ref val) = self.ref_nb {
10058            helpers::validate_pattern(
10059                val,
10060                "RefNb",
10061                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10062                &helpers::child_path(path, "RefNb"),
10063                config,
10064                collector,
10065            );
10066        }
10067        if let Some(ref val) = self.mtd {
10068            helpers::validate_length(
10069                val,
10070                "Mtd",
10071                Some(1),
10072                Some(35),
10073                &helpers::child_path(path, "Mtd"),
10074                config,
10075                collector,
10076            );
10077        }
10078        if let Some(ref val) = self.mtd {
10079            helpers::validate_pattern(
10080                val,
10081                "Mtd",
10082                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10083                &helpers::child_path(path, "Mtd"),
10084                config,
10085                collector,
10086            );
10087        }
10088        if let Some(ref val) = self.ttl_taxbl_base_amt
10089            && config.validate_optional_fields
10090        {
10091            val.validate(
10092                &helpers::child_path(path, "TtlTaxblBaseAmt"),
10093                config,
10094                collector,
10095            );
10096        }
10097        if let Some(ref val) = self.ttl_tax_amt
10098            && config.validate_optional_fields
10099        {
10100            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
10101        }
10102        if let Some(ref vec) = self.rcrd
10103            && config.validate_optional_fields
10104        {
10105            for item in vec {
10106                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
10107            }
10108        }
10109    }
10110}
10111
10112// TaxParty11: Type of tax payer.
10113#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10114pub struct TaxParty11 {
10115    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10116    pub tax_id: Option<String>,
10117    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10118    pub regn_id: Option<String>,
10119    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10120    pub tax_tp: Option<String>,
10121}
10122
10123impl Validate for TaxParty11 {
10124    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10125        if let Some(ref val) = self.tax_id {
10126            helpers::validate_length(
10127                val,
10128                "TaxId",
10129                Some(1),
10130                Some(35),
10131                &helpers::child_path(path, "TaxId"),
10132                config,
10133                collector,
10134            );
10135        }
10136        if let Some(ref val) = self.tax_id {
10137            helpers::validate_pattern(
10138                val,
10139                "TaxId",
10140                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10141                &helpers::child_path(path, "TaxId"),
10142                config,
10143                collector,
10144            );
10145        }
10146        if let Some(ref val) = self.regn_id {
10147            helpers::validate_length(
10148                val,
10149                "RegnId",
10150                Some(1),
10151                Some(35),
10152                &helpers::child_path(path, "RegnId"),
10153                config,
10154                collector,
10155            );
10156        }
10157        if let Some(ref val) = self.regn_id {
10158            helpers::validate_pattern(
10159                val,
10160                "RegnId",
10161                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10162                &helpers::child_path(path, "RegnId"),
10163                config,
10164                collector,
10165            );
10166        }
10167        if let Some(ref val) = self.tax_tp {
10168            helpers::validate_length(
10169                val,
10170                "TaxTp",
10171                Some(1),
10172                Some(35),
10173                &helpers::child_path(path, "TaxTp"),
10174                config,
10175                collector,
10176            );
10177        }
10178        if let Some(ref val) = self.tax_tp {
10179            helpers::validate_pattern(
10180                val,
10181                "TaxTp",
10182                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10183                &helpers::child_path(path, "TaxTp"),
10184                config,
10185                collector,
10186            );
10187        }
10188    }
10189}
10190
10191// TaxParty12: Type of tax payer.
10192#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10193pub struct TaxParty12 {
10194    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10195    pub tax_id: Option<String>,
10196    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10197    pub regn_id: Option<String>,
10198    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10199    pub tax_tp: Option<String>,
10200}
10201
10202impl Validate for TaxParty12 {
10203    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10204        if let Some(ref val) = self.tax_id {
10205            helpers::validate_length(
10206                val,
10207                "TaxId",
10208                Some(1),
10209                Some(35),
10210                &helpers::child_path(path, "TaxId"),
10211                config,
10212                collector,
10213            );
10214        }
10215        if let Some(ref val) = self.tax_id {
10216            helpers::validate_pattern(
10217                val,
10218                "TaxId",
10219                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10220                &helpers::child_path(path, "TaxId"),
10221                config,
10222                collector,
10223            );
10224        }
10225        if let Some(ref val) = self.regn_id {
10226            helpers::validate_length(
10227                val,
10228                "RegnId",
10229                Some(1),
10230                Some(35),
10231                &helpers::child_path(path, "RegnId"),
10232                config,
10233                collector,
10234            );
10235        }
10236        if let Some(ref val) = self.regn_id {
10237            helpers::validate_pattern(
10238                val,
10239                "RegnId",
10240                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10241                &helpers::child_path(path, "RegnId"),
10242                config,
10243                collector,
10244            );
10245        }
10246        if let Some(ref val) = self.tax_tp {
10247            helpers::validate_length(
10248                val,
10249                "TaxTp",
10250                Some(1),
10251                Some(35),
10252                &helpers::child_path(path, "TaxTp"),
10253                config,
10254                collector,
10255            );
10256        }
10257        if let Some(ref val) = self.tax_tp {
10258            helpers::validate_pattern(
10259                val,
10260                "TaxTp",
10261                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10262                &helpers::child_path(path, "TaxTp"),
10263                config,
10264                collector,
10265            );
10266        }
10267    }
10268}
10269
10270// TaxParty21: Details of the authorised tax paying party.
10271#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10272pub struct TaxParty21 {
10273    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10274    pub tax_id: Option<String>,
10275    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10276    pub regn_id: Option<String>,
10277    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10278    pub tax_tp: Option<String>,
10279    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
10280    pub authstn: Option<TaxAuthorisation11>,
10281}
10282
10283impl Validate for TaxParty21 {
10284    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10285        if let Some(ref val) = self.tax_id {
10286            helpers::validate_length(
10287                val,
10288                "TaxId",
10289                Some(1),
10290                Some(35),
10291                &helpers::child_path(path, "TaxId"),
10292                config,
10293                collector,
10294            );
10295        }
10296        if let Some(ref val) = self.tax_id {
10297            helpers::validate_pattern(
10298                val,
10299                "TaxId",
10300                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10301                &helpers::child_path(path, "TaxId"),
10302                config,
10303                collector,
10304            );
10305        }
10306        if let Some(ref val) = self.regn_id {
10307            helpers::validate_length(
10308                val,
10309                "RegnId",
10310                Some(1),
10311                Some(35),
10312                &helpers::child_path(path, "RegnId"),
10313                config,
10314                collector,
10315            );
10316        }
10317        if let Some(ref val) = self.regn_id {
10318            helpers::validate_pattern(
10319                val,
10320                "RegnId",
10321                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10322                &helpers::child_path(path, "RegnId"),
10323                config,
10324                collector,
10325            );
10326        }
10327        if let Some(ref val) = self.tax_tp {
10328            helpers::validate_length(
10329                val,
10330                "TaxTp",
10331                Some(1),
10332                Some(35),
10333                &helpers::child_path(path, "TaxTp"),
10334                config,
10335                collector,
10336            );
10337        }
10338        if let Some(ref val) = self.tax_tp {
10339            helpers::validate_pattern(
10340                val,
10341                "TaxTp",
10342                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10343                &helpers::child_path(path, "TaxTp"),
10344                config,
10345                collector,
10346            );
10347        }
10348        if let Some(ref val) = self.authstn
10349            && config.validate_optional_fields
10350        {
10351            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
10352        }
10353    }
10354}
10355
10356// TaxParty22: Details of the authorised tax paying party.
10357#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10358pub struct TaxParty22 {
10359    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10360    pub tax_id: Option<String>,
10361    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10362    pub regn_id: Option<String>,
10363    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10364    pub tax_tp: Option<String>,
10365    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
10366    pub authstn: Option<TaxAuthorisation12>,
10367}
10368
10369impl Validate for TaxParty22 {
10370    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10371        if let Some(ref val) = self.tax_id {
10372            helpers::validate_length(
10373                val,
10374                "TaxId",
10375                Some(1),
10376                Some(35),
10377                &helpers::child_path(path, "TaxId"),
10378                config,
10379                collector,
10380            );
10381        }
10382        if let Some(ref val) = self.tax_id {
10383            helpers::validate_pattern(
10384                val,
10385                "TaxId",
10386                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10387                &helpers::child_path(path, "TaxId"),
10388                config,
10389                collector,
10390            );
10391        }
10392        if let Some(ref val) = self.regn_id {
10393            helpers::validate_length(
10394                val,
10395                "RegnId",
10396                Some(1),
10397                Some(35),
10398                &helpers::child_path(path, "RegnId"),
10399                config,
10400                collector,
10401            );
10402        }
10403        if let Some(ref val) = self.regn_id {
10404            helpers::validate_pattern(
10405                val,
10406                "RegnId",
10407                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10408                &helpers::child_path(path, "RegnId"),
10409                config,
10410                collector,
10411            );
10412        }
10413        if let Some(ref val) = self.tax_tp {
10414            helpers::validate_length(
10415                val,
10416                "TaxTp",
10417                Some(1),
10418                Some(35),
10419                &helpers::child_path(path, "TaxTp"),
10420                config,
10421                collector,
10422            );
10423        }
10424        if let Some(ref val) = self.tax_tp {
10425            helpers::validate_pattern(
10426                val,
10427                "TaxTp",
10428                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10429                &helpers::child_path(path, "TaxTp"),
10430                config,
10431                collector,
10432            );
10433        }
10434        if let Some(ref val) = self.authstn
10435            && config.validate_optional_fields
10436        {
10437            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
10438        }
10439    }
10440}
10441
10442// TaxPeriod2: Range of time between a start date and an end date for which the tax report is provided.
10443#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10444pub struct TaxPeriod2 {
10445    #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
10446    pub yr: Option<String>,
10447    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10448    pub tp: Option<TaxRecordPeriod1Code>,
10449    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
10450    pub fr_to_dt: Option<DatePeriod2>,
10451}
10452
10453impl Validate for TaxPeriod2 {
10454    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10455        if let Some(ref val) = self.tp
10456            && config.validate_optional_fields
10457        {
10458            val.validate(&helpers::child_path(path, "Tp"), config, collector);
10459        }
10460        if let Some(ref val) = self.fr_to_dt
10461            && config.validate_optional_fields
10462        {
10463            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
10464        }
10465    }
10466}
10467
10468// TaxRecord21: Further details of the tax record.
10469#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10470pub struct TaxRecord21 {
10471    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10472    pub tp: Option<String>,
10473    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
10474    pub ctgy: Option<String>,
10475    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
10476    pub ctgy_dtls: Option<String>,
10477    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
10478    pub dbtr_sts: Option<String>,
10479    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
10480    pub cert_id: Option<String>,
10481    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
10482    pub frms_cd: Option<String>,
10483    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10484    pub prd: Option<TaxPeriod2>,
10485    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10486    pub tax_amt: Option<TaxAmount2>,
10487    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
10488    pub addtl_inf: Option<String>,
10489}
10490
10491impl Validate for TaxRecord21 {
10492    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10493        if let Some(ref val) = self.tp {
10494            helpers::validate_length(
10495                val,
10496                "Tp",
10497                Some(1),
10498                Some(35),
10499                &helpers::child_path(path, "Tp"),
10500                config,
10501                collector,
10502            );
10503        }
10504        if let Some(ref val) = self.tp {
10505            helpers::validate_pattern(
10506                val,
10507                "Tp",
10508                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10509                &helpers::child_path(path, "Tp"),
10510                config,
10511                collector,
10512            );
10513        }
10514        if let Some(ref val) = self.ctgy {
10515            helpers::validate_length(
10516                val,
10517                "Ctgy",
10518                Some(1),
10519                Some(35),
10520                &helpers::child_path(path, "Ctgy"),
10521                config,
10522                collector,
10523            );
10524        }
10525        if let Some(ref val) = self.ctgy {
10526            helpers::validate_pattern(
10527                val,
10528                "Ctgy",
10529                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10530                &helpers::child_path(path, "Ctgy"),
10531                config,
10532                collector,
10533            );
10534        }
10535        if let Some(ref val) = self.ctgy_dtls {
10536            helpers::validate_length(
10537                val,
10538                "CtgyDtls",
10539                Some(1),
10540                Some(35),
10541                &helpers::child_path(path, "CtgyDtls"),
10542                config,
10543                collector,
10544            );
10545        }
10546        if let Some(ref val) = self.ctgy_dtls {
10547            helpers::validate_pattern(
10548                val,
10549                "CtgyDtls",
10550                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10551                &helpers::child_path(path, "CtgyDtls"),
10552                config,
10553                collector,
10554            );
10555        }
10556        if let Some(ref val) = self.dbtr_sts {
10557            helpers::validate_length(
10558                val,
10559                "DbtrSts",
10560                Some(1),
10561                Some(35),
10562                &helpers::child_path(path, "DbtrSts"),
10563                config,
10564                collector,
10565            );
10566        }
10567        if let Some(ref val) = self.dbtr_sts {
10568            helpers::validate_pattern(
10569                val,
10570                "DbtrSts",
10571                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10572                &helpers::child_path(path, "DbtrSts"),
10573                config,
10574                collector,
10575            );
10576        }
10577        if let Some(ref val) = self.cert_id {
10578            helpers::validate_length(
10579                val,
10580                "CertId",
10581                Some(1),
10582                Some(35),
10583                &helpers::child_path(path, "CertId"),
10584                config,
10585                collector,
10586            );
10587        }
10588        if let Some(ref val) = self.cert_id {
10589            helpers::validate_pattern(
10590                val,
10591                "CertId",
10592                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10593                &helpers::child_path(path, "CertId"),
10594                config,
10595                collector,
10596            );
10597        }
10598        if let Some(ref val) = self.frms_cd {
10599            helpers::validate_length(
10600                val,
10601                "FrmsCd",
10602                Some(1),
10603                Some(35),
10604                &helpers::child_path(path, "FrmsCd"),
10605                config,
10606                collector,
10607            );
10608        }
10609        if let Some(ref val) = self.frms_cd {
10610            helpers::validate_pattern(
10611                val,
10612                "FrmsCd",
10613                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10614                &helpers::child_path(path, "FrmsCd"),
10615                config,
10616                collector,
10617            );
10618        }
10619        if let Some(ref val) = self.prd
10620            && config.validate_optional_fields
10621        {
10622            val.validate(&helpers::child_path(path, "Prd"), config, collector);
10623        }
10624        if let Some(ref val) = self.tax_amt
10625            && config.validate_optional_fields
10626        {
10627            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
10628        }
10629        if let Some(ref val) = self.addtl_inf {
10630            helpers::validate_length(
10631                val,
10632                "AddtlInf",
10633                Some(1),
10634                Some(140),
10635                &helpers::child_path(path, "AddtlInf"),
10636                config,
10637                collector,
10638            );
10639        }
10640        if let Some(ref val) = self.addtl_inf {
10641            helpers::validate_pattern(
10642                val,
10643                "AddtlInf",
10644                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10645                &helpers::child_path(path, "AddtlInf"),
10646                config,
10647                collector,
10648            );
10649        }
10650    }
10651}
10652
10653// TaxRecord22: Further details of the tax record.
10654#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10655pub struct TaxRecord22 {
10656    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10657    pub tp: Option<String>,
10658    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
10659    pub ctgy: Option<String>,
10660    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
10661    pub ctgy_dtls: Option<String>,
10662    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
10663    pub dbtr_sts: Option<String>,
10664    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
10665    pub cert_id: Option<String>,
10666    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
10667    pub frms_cd: Option<String>,
10668    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10669    pub prd: Option<TaxPeriod2>,
10670    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10671    pub tax_amt: Option<TaxAmount2>,
10672    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
10673    pub addtl_inf: Option<String>,
10674}
10675
10676impl Validate for TaxRecord22 {
10677    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10678        if let Some(ref val) = self.tp {
10679            helpers::validate_length(
10680                val,
10681                "Tp",
10682                Some(1),
10683                Some(35),
10684                &helpers::child_path(path, "Tp"),
10685                config,
10686                collector,
10687            );
10688        }
10689        if let Some(ref val) = self.tp {
10690            helpers::validate_pattern(
10691                val,
10692                "Tp",
10693                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10694                &helpers::child_path(path, "Tp"),
10695                config,
10696                collector,
10697            );
10698        }
10699        if let Some(ref val) = self.ctgy {
10700            helpers::validate_length(
10701                val,
10702                "Ctgy",
10703                Some(1),
10704                Some(35),
10705                &helpers::child_path(path, "Ctgy"),
10706                config,
10707                collector,
10708            );
10709        }
10710        if let Some(ref val) = self.ctgy {
10711            helpers::validate_pattern(
10712                val,
10713                "Ctgy",
10714                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10715                &helpers::child_path(path, "Ctgy"),
10716                config,
10717                collector,
10718            );
10719        }
10720        if let Some(ref val) = self.ctgy_dtls {
10721            helpers::validate_length(
10722                val,
10723                "CtgyDtls",
10724                Some(1),
10725                Some(35),
10726                &helpers::child_path(path, "CtgyDtls"),
10727                config,
10728                collector,
10729            );
10730        }
10731        if let Some(ref val) = self.ctgy_dtls {
10732            helpers::validate_pattern(
10733                val,
10734                "CtgyDtls",
10735                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10736                &helpers::child_path(path, "CtgyDtls"),
10737                config,
10738                collector,
10739            );
10740        }
10741        if let Some(ref val) = self.dbtr_sts {
10742            helpers::validate_length(
10743                val,
10744                "DbtrSts",
10745                Some(1),
10746                Some(35),
10747                &helpers::child_path(path, "DbtrSts"),
10748                config,
10749                collector,
10750            );
10751        }
10752        if let Some(ref val) = self.dbtr_sts {
10753            helpers::validate_pattern(
10754                val,
10755                "DbtrSts",
10756                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10757                &helpers::child_path(path, "DbtrSts"),
10758                config,
10759                collector,
10760            );
10761        }
10762        if let Some(ref val) = self.cert_id {
10763            helpers::validate_length(
10764                val,
10765                "CertId",
10766                Some(1),
10767                Some(35),
10768                &helpers::child_path(path, "CertId"),
10769                config,
10770                collector,
10771            );
10772        }
10773        if let Some(ref val) = self.cert_id {
10774            helpers::validate_pattern(
10775                val,
10776                "CertId",
10777                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10778                &helpers::child_path(path, "CertId"),
10779                config,
10780                collector,
10781            );
10782        }
10783        if let Some(ref val) = self.frms_cd {
10784            helpers::validate_length(
10785                val,
10786                "FrmsCd",
10787                Some(1),
10788                Some(35),
10789                &helpers::child_path(path, "FrmsCd"),
10790                config,
10791                collector,
10792            );
10793        }
10794        if let Some(ref val) = self.frms_cd {
10795            helpers::validate_pattern(
10796                val,
10797                "FrmsCd",
10798                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10799                &helpers::child_path(path, "FrmsCd"),
10800                config,
10801                collector,
10802            );
10803        }
10804        if let Some(ref val) = self.prd
10805            && config.validate_optional_fields
10806        {
10807            val.validate(&helpers::child_path(path, "Prd"), config, collector);
10808        }
10809        if let Some(ref val) = self.tax_amt
10810            && config.validate_optional_fields
10811        {
10812            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
10813        }
10814        if let Some(ref val) = self.addtl_inf {
10815            helpers::validate_length(
10816                val,
10817                "AddtlInf",
10818                Some(1),
10819                Some(140),
10820                &helpers::child_path(path, "AddtlInf"),
10821                config,
10822                collector,
10823            );
10824        }
10825        if let Some(ref val) = self.addtl_inf {
10826            helpers::validate_pattern(
10827                val,
10828                "AddtlInf",
10829                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10830                &helpers::child_path(path, "AddtlInf"),
10831                config,
10832                collector,
10833            );
10834        }
10835    }
10836}
10837
10838// TaxRecordDetails2: Underlying tax amount related to the specified period.
10839#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10840pub struct TaxRecordDetails2 {
10841    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10842    pub prd: Option<TaxPeriod2>,
10843    #[serde(rename = "Amt")]
10844    pub amt: ActiveOrHistoricCurrencyAndAmount,
10845}
10846
10847impl Validate for TaxRecordDetails2 {
10848    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10849        if let Some(ref val) = self.prd
10850            && config.validate_optional_fields
10851        {
10852            val.validate(&helpers::child_path(path, "Prd"), config, collector);
10853        }
10854        self.amt
10855            .validate(&helpers::child_path(path, "Amt"), config, collector);
10856    }
10857}
10858
10859// TaxRecordPeriod1Code: Tax is related to the second half of the period.
10860#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10861pub enum TaxRecordPeriod1Code {
10862    #[default]
10863    #[serde(rename = "MM01")]
10864    CodeMM01,
10865    #[serde(rename = "MM02")]
10866    CodeMM02,
10867    #[serde(rename = "MM03")]
10868    CodeMM03,
10869    #[serde(rename = "MM04")]
10870    CodeMM04,
10871    #[serde(rename = "MM05")]
10872    CodeMM05,
10873    #[serde(rename = "MM06")]
10874    CodeMM06,
10875    #[serde(rename = "MM07")]
10876    CodeMM07,
10877    #[serde(rename = "MM08")]
10878    CodeMM08,
10879    #[serde(rename = "MM09")]
10880    CodeMM09,
10881    #[serde(rename = "MM10")]
10882    CodeMM10,
10883    #[serde(rename = "MM11")]
10884    CodeMM11,
10885    #[serde(rename = "MM12")]
10886    CodeMM12,
10887    #[serde(rename = "QTR1")]
10888    CodeQTR1,
10889    #[serde(rename = "QTR2")]
10890    CodeQTR2,
10891    #[serde(rename = "QTR3")]
10892    CodeQTR3,
10893    #[serde(rename = "QTR4")]
10894    CodeQTR4,
10895    #[serde(rename = "HLF1")]
10896    CodeHLF1,
10897    #[serde(rename = "HLF2")]
10898    CodeHLF2,
10899}
10900
10901impl Validate for TaxRecordPeriod1Code {
10902    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
10903        // Enum validation is typically empty
10904    }
10905}
10906
10907// TechnicalInputChannel1Choice1: Technical channel used to input the instruction, in a proprietary form.
10908#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10909pub struct TechnicalInputChannel1Choice1 {
10910    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10911    pub cd: Option<String>,
10912    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10913    pub prtry: Option<String>,
10914}
10915
10916impl Validate for TechnicalInputChannel1Choice1 {
10917    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10918        if let Some(ref val) = self.cd {
10919            helpers::validate_length(
10920                val,
10921                "Cd",
10922                Some(1),
10923                Some(4),
10924                &helpers::child_path(path, "Cd"),
10925                config,
10926                collector,
10927            );
10928        }
10929        if let Some(ref val) = self.prtry {
10930            helpers::validate_length(
10931                val,
10932                "Prtry",
10933                Some(1),
10934                Some(35),
10935                &helpers::child_path(path, "Prtry"),
10936                config,
10937                collector,
10938            );
10939        }
10940        if let Some(ref val) = self.prtry {
10941            helpers::validate_pattern(
10942                val,
10943                "Prtry",
10944                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10945                &helpers::child_path(path, "Prtry"),
10946                config,
10947                collector,
10948            );
10949        }
10950    }
10951}
10952
10953// TotalTransactions61: Specifies the total number and sum of entries per bank transaction code.
10954#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10955pub struct TotalTransactions61 {
10956    #[serde(rename = "TtlNtries", skip_serializing_if = "Option::is_none")]
10957    pub ttl_ntries: Option<NumberAndSumOfTransactions4>,
10958    #[serde(rename = "TtlCdtNtries", skip_serializing_if = "Option::is_none")]
10959    pub ttl_cdt_ntries: Option<NumberAndSumOfTransactions1>,
10960    #[serde(rename = "TtlDbtNtries", skip_serializing_if = "Option::is_none")]
10961    pub ttl_dbt_ntries: Option<NumberAndSumOfTransactions1>,
10962    #[serde(rename = "TtlNtriesPerBkTxCd", skip_serializing_if = "Option::is_none")]
10963    pub ttl_ntries_per_bk_tx_cd: Option<Vec<TotalsPerBankTransactionCode51>>,
10964}
10965
10966impl Validate for TotalTransactions61 {
10967    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10968        if let Some(ref val) = self.ttl_ntries
10969            && config.validate_optional_fields
10970        {
10971            val.validate(&helpers::child_path(path, "TtlNtries"), config, collector);
10972        }
10973        if let Some(ref val) = self.ttl_cdt_ntries
10974            && config.validate_optional_fields
10975        {
10976            val.validate(
10977                &helpers::child_path(path, "TtlCdtNtries"),
10978                config,
10979                collector,
10980            );
10981        }
10982        if let Some(ref val) = self.ttl_dbt_ntries
10983            && config.validate_optional_fields
10984        {
10985            val.validate(
10986                &helpers::child_path(path, "TtlDbtNtries"),
10987                config,
10988                collector,
10989            );
10990        }
10991        if let Some(ref vec) = self.ttl_ntries_per_bk_tx_cd
10992            && config.validate_optional_fields
10993        {
10994            for item in vec {
10995                item.validate(
10996                    &helpers::child_path(path, "TtlNtriesPerBkTxCd"),
10997                    config,
10998                    collector,
10999                );
11000            }
11001        }
11002    }
11003}
11004
11005// TotalsPerBankTransactionCode51: Indicates the date (and time) of the transaction summary.
11006#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11007pub struct TotalsPerBankTransactionCode51 {
11008    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
11009    pub nb_of_ntries: Option<String>,
11010    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
11011    pub sum: Option<f64>,
11012    #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
11013    pub ttl_net_ntry: Option<AmountAndDirection35>,
11014    #[serde(rename = "CdtNtries", skip_serializing_if = "Option::is_none")]
11015    pub cdt_ntries: Option<NumberAndSumOfTransactions1>,
11016    #[serde(rename = "DbtNtries", skip_serializing_if = "Option::is_none")]
11017    pub dbt_ntries: Option<NumberAndSumOfTransactions1>,
11018    #[serde(rename = "FcstInd", skip_serializing_if = "Option::is_none")]
11019    pub fcst_ind: Option<bool>,
11020    #[serde(rename = "BkTxCd")]
11021    pub bk_tx_cd: BankTransactionCodeStructure41,
11022    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
11023    pub avlbty: Option<Vec<CashAvailability1>>,
11024    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
11025    pub dt: Option<DateAndDateTime2Choice1>,
11026}
11027
11028impl Validate for TotalsPerBankTransactionCode51 {
11029    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11030        if let Some(ref val) = self.nb_of_ntries {
11031            helpers::validate_pattern(
11032                val,
11033                "NbOfNtries",
11034                "[0-9]{1,15}",
11035                &helpers::child_path(path, "NbOfNtries"),
11036                config,
11037                collector,
11038            );
11039        }
11040        if let Some(ref val) = self.ttl_net_ntry
11041            && config.validate_optional_fields
11042        {
11043            val.validate(&helpers::child_path(path, "TtlNetNtry"), config, collector);
11044        }
11045        if let Some(ref val) = self.cdt_ntries
11046            && config.validate_optional_fields
11047        {
11048            val.validate(&helpers::child_path(path, "CdtNtries"), config, collector);
11049        }
11050        if let Some(ref val) = self.dbt_ntries
11051            && config.validate_optional_fields
11052        {
11053            val.validate(&helpers::child_path(path, "DbtNtries"), config, collector);
11054        }
11055        self.bk_tx_cd
11056            .validate(&helpers::child_path(path, "BkTxCd"), config, collector);
11057        if let Some(ref vec) = self.avlbty
11058            && config.validate_optional_fields
11059        {
11060            for item in vec {
11061                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
11062            }
11063        }
11064        if let Some(ref val) = self.dt
11065            && config.validate_optional_fields
11066        {
11067            val.validate(&helpers::child_path(path, "Dt"), config, collector);
11068        }
11069    }
11070}
11071
11072// TrackData11: Card track content or equivalent.
11073#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11074pub struct TrackData11 {
11075    #[serde(rename = "TrckNb", skip_serializing_if = "Option::is_none")]
11076    pub trck_nb: Option<String>,
11077    #[serde(rename = "TrckVal")]
11078    pub trck_val: String,
11079}
11080
11081impl Validate for TrackData11 {
11082    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11083        if let Some(ref val) = self.trck_nb {
11084            helpers::validate_pattern(
11085                val,
11086                "TrckNb",
11087                "[0-9]",
11088                &helpers::child_path(path, "TrckNb"),
11089                config,
11090                collector,
11091            );
11092        }
11093        helpers::validate_length(
11094            &self.trck_val,
11095            "TrckVal",
11096            Some(1),
11097            Some(140),
11098            &helpers::child_path(path, "TrckVal"),
11099            config,
11100            collector,
11101        );
11102        helpers::validate_pattern(
11103            &self.trck_val,
11104            "TrckVal",
11105            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11106            &helpers::child_path(path, "TrckVal"),
11107            config,
11108            collector,
11109        );
11110    }
11111}
11112
11113// TransactionAgents51: Proprietary agent related to the underlying transaction.
11114#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11115pub struct TransactionAgents51 {
11116    #[serde(rename = "InstgAgt", skip_serializing_if = "Option::is_none")]
11117    pub instg_agt: Option<BranchAndFinancialInstitutionIdentification64>,
11118    #[serde(rename = "InstdAgt", skip_serializing_if = "Option::is_none")]
11119    pub instd_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11120    #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
11121    pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11122    #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
11123    pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11124    #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
11125    pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification62>,
11126    #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
11127    pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification63>,
11128    #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
11129    pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification62>,
11130    #[serde(rename = "RcvgAgt", skip_serializing_if = "Option::is_none")]
11131    pub rcvg_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11132    #[serde(rename = "DlvrgAgt", skip_serializing_if = "Option::is_none")]
11133    pub dlvrg_agt: Option<BranchAndFinancialInstitutionIdentification63>,
11134    #[serde(rename = "IssgAgt", skip_serializing_if = "Option::is_none")]
11135    pub issg_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11136    #[serde(rename = "SttlmPlc", skip_serializing_if = "Option::is_none")]
11137    pub sttlm_plc: Option<BranchAndFinancialInstitutionIdentification63>,
11138    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11139    pub prtry: Option<Vec<ProprietaryAgent41>>,
11140}
11141
11142impl Validate for TransactionAgents51 {
11143    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11144        if let Some(ref val) = self.instg_agt
11145            && config.validate_optional_fields
11146        {
11147            val.validate(&helpers::child_path(path, "InstgAgt"), config, collector);
11148        }
11149        if let Some(ref val) = self.instd_agt
11150            && config.validate_optional_fields
11151        {
11152            val.validate(&helpers::child_path(path, "InstdAgt"), config, collector);
11153        }
11154        if let Some(ref val) = self.dbtr_agt
11155            && config.validate_optional_fields
11156        {
11157            val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
11158        }
11159        if let Some(ref val) = self.cdtr_agt
11160            && config.validate_optional_fields
11161        {
11162            val.validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
11163        }
11164        if let Some(ref val) = self.intrmy_agt1
11165            && config.validate_optional_fields
11166        {
11167            val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
11168        }
11169        if let Some(ref val) = self.intrmy_agt2
11170            && config.validate_optional_fields
11171        {
11172            val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
11173        }
11174        if let Some(ref val) = self.intrmy_agt3
11175            && config.validate_optional_fields
11176        {
11177            val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
11178        }
11179        if let Some(ref val) = self.rcvg_agt
11180            && config.validate_optional_fields
11181        {
11182            val.validate(&helpers::child_path(path, "RcvgAgt"), config, collector);
11183        }
11184        if let Some(ref val) = self.dlvrg_agt
11185            && config.validate_optional_fields
11186        {
11187            val.validate(&helpers::child_path(path, "DlvrgAgt"), config, collector);
11188        }
11189        if let Some(ref val) = self.issg_agt
11190            && config.validate_optional_fields
11191        {
11192            val.validate(&helpers::child_path(path, "IssgAgt"), config, collector);
11193        }
11194        if let Some(ref val) = self.sttlm_plc
11195            && config.validate_optional_fields
11196        {
11197            val.validate(&helpers::child_path(path, "SttlmPlc"), config, collector);
11198        }
11199        if let Some(ref vec) = self.prtry
11200            && config.validate_optional_fields
11201        {
11202            for item in vec {
11203                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11204            }
11205        }
11206    }
11207}
11208
11209// TransactionChannel1Code: Payment on television.
11210#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11211pub enum TransactionChannel1Code {
11212    #[default]
11213    #[serde(rename = "MAIL")]
11214    CodeMAIL,
11215    #[serde(rename = "TLPH")]
11216    CodeTLPH,
11217    #[serde(rename = "ECOM")]
11218    CodeECOM,
11219    #[serde(rename = "TVPY")]
11220    CodeTVPY,
11221}
11222
11223impl Validate for TransactionChannel1Code {
11224    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
11225        // Enum validation is typically empty
11226    }
11227}
11228
11229// TransactionDates31: Proprietary date related to the underlying transaction.
11230#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11231pub struct TransactionDates31 {
11232    #[serde(rename = "AccptncDtTm", skip_serializing_if = "Option::is_none")]
11233    pub accptnc_dt_tm: Option<String>,
11234    #[serde(
11235        rename = "TradActvtyCtrctlSttlmDt",
11236        skip_serializing_if = "Option::is_none"
11237    )]
11238    pub trad_actvty_ctrctl_sttlm_dt: Option<String>,
11239    #[serde(rename = "TradDt", skip_serializing_if = "Option::is_none")]
11240    pub trad_dt: Option<String>,
11241    #[serde(rename = "IntrBkSttlmDt", skip_serializing_if = "Option::is_none")]
11242    pub intr_bk_sttlm_dt: Option<String>,
11243    #[serde(rename = "StartDt", skip_serializing_if = "Option::is_none")]
11244    pub start_dt: Option<String>,
11245    #[serde(rename = "EndDt", skip_serializing_if = "Option::is_none")]
11246    pub end_dt: Option<String>,
11247    #[serde(rename = "TxDtTm", skip_serializing_if = "Option::is_none")]
11248    pub tx_dt_tm: Option<String>,
11249    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11250    pub prtry: Option<Vec<ProprietaryDate31>>,
11251}
11252
11253impl Validate for TransactionDates31 {
11254    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11255        if let Some(ref val) = self.accptnc_dt_tm {
11256            helpers::validate_pattern(
11257                val,
11258                "AccptncDtTm",
11259                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
11260                &helpers::child_path(path, "AccptncDtTm"),
11261                config,
11262                collector,
11263            );
11264        }
11265        if let Some(ref val) = self.tx_dt_tm {
11266            helpers::validate_pattern(
11267                val,
11268                "TxDtTm",
11269                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
11270                &helpers::child_path(path, "TxDtTm"),
11271                config,
11272                collector,
11273            );
11274        }
11275        if let Some(ref vec) = self.prtry
11276            && config.validate_optional_fields
11277        {
11278            for item in vec {
11279                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11280            }
11281        }
11282    }
11283}
11284
11285// TransactionEnvironment1Code: Public environment.
11286#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11287pub enum TransactionEnvironment1Code {
11288    #[default]
11289    #[serde(rename = "MERC")]
11290    CodeMERC,
11291    #[serde(rename = "PRIV")]
11292    CodePRIV,
11293    #[serde(rename = "PUBL")]
11294    CodePUBL,
11295}
11296
11297impl Validate for TransactionEnvironment1Code {
11298    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
11299        // Enum validation is typically empty
11300    }
11301}
11302
11303// TransactionIdentifier11: Identification of the transaction that has to be unique for a time period.
11304#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11305pub struct TransactionIdentifier11 {
11306    #[serde(rename = "TxDtTm")]
11307    pub tx_dt_tm: String,
11308    #[serde(rename = "TxRef")]
11309    pub tx_ref: String,
11310}
11311
11312impl Validate for TransactionIdentifier11 {
11313    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11314        helpers::validate_pattern(
11315            &self.tx_dt_tm,
11316            "TxDtTm",
11317            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
11318            &helpers::child_path(path, "TxDtTm"),
11319            config,
11320            collector,
11321        );
11322        helpers::validate_length(
11323            &self.tx_ref,
11324            "TxRef",
11325            Some(1),
11326            Some(35),
11327            &helpers::child_path(path, "TxRef"),
11328            config,
11329            collector,
11330        );
11331        helpers::validate_pattern(
11332            &self.tx_ref,
11333            "TxRef",
11334            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11335            &helpers::child_path(path, "TxRef"),
11336            config,
11337            collector,
11338        );
11339    }
11340}
11341
11342// TransactionInterest41: Individual interest record.
11343#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11344pub struct TransactionInterest41 {
11345    #[serde(rename = "TtlIntrstAndTaxAmt", skip_serializing_if = "Option::is_none")]
11346    pub ttl_intrst_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11347    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11348    pub rcrd: Option<Vec<InterestRecord21>>,
11349}
11350
11351impl Validate for TransactionInterest41 {
11352    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11353        if let Some(ref val) = self.ttl_intrst_and_tax_amt
11354            && config.validate_optional_fields
11355        {
11356            val.validate(
11357                &helpers::child_path(path, "TtlIntrstAndTaxAmt"),
11358                config,
11359                collector,
11360            );
11361        }
11362        if let Some(ref vec) = self.rcrd
11363            && config.validate_optional_fields
11364        {
11365            for item in vec {
11366                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
11367            }
11368        }
11369    }
11370}
11371
11372// TransactionParties61: Proprietary party related to the underlying transaction.
11373#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11374pub struct TransactionParties61 {
11375    #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
11376    pub initg_pty: Option<Party40Choice1>,
11377    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11378    pub dbtr: Option<Party40Choice2>,
11379    #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
11380    pub dbtr_acct: Option<CashAccount382>,
11381    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
11382    pub ultmt_dbtr: Option<Party40Choice1>,
11383    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11384    pub cdtr: Option<Party40Choice1>,
11385    #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
11386    pub cdtr_acct: Option<CashAccount382>,
11387    #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
11388    pub ultmt_cdtr: Option<Party40Choice1>,
11389    #[serde(rename = "TradgPty", skip_serializing_if = "Option::is_none")]
11390    pub tradg_pty: Option<Party40Choice3>,
11391    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11392    pub prtry: Option<Vec<ProprietaryParty51>>,
11393}
11394
11395impl Validate for TransactionParties61 {
11396    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11397        if let Some(ref val) = self.initg_pty
11398            && config.validate_optional_fields
11399        {
11400            val.validate(&helpers::child_path(path, "InitgPty"), config, collector);
11401        }
11402        if let Some(ref val) = self.dbtr
11403            && config.validate_optional_fields
11404        {
11405            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
11406        }
11407        if let Some(ref val) = self.dbtr_acct
11408            && config.validate_optional_fields
11409        {
11410            val.validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
11411        }
11412        if let Some(ref val) = self.ultmt_dbtr
11413            && config.validate_optional_fields
11414        {
11415            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
11416        }
11417        if let Some(ref val) = self.cdtr
11418            && config.validate_optional_fields
11419        {
11420            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
11421        }
11422        if let Some(ref val) = self.cdtr_acct
11423            && config.validate_optional_fields
11424        {
11425            val.validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
11426        }
11427        if let Some(ref val) = self.ultmt_cdtr
11428            && config.validate_optional_fields
11429        {
11430            val.validate(&helpers::child_path(path, "UltmtCdtr"), config, collector);
11431        }
11432        if let Some(ref val) = self.tradg_pty
11433            && config.validate_optional_fields
11434        {
11435            val.validate(&helpers::child_path(path, "TradgPty"), config, collector);
11436        }
11437        if let Some(ref vec) = self.prtry
11438            && config.validate_optional_fields
11439        {
11440            for item in vec {
11441                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11442            }
11443        }
11444    }
11445}
11446
11447// TransactionPrice4Choice1: Proprietary price specification related to the underlying transaction.
11448#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11449pub struct TransactionPrice4Choice1 {
11450    #[serde(rename = "DealPric", skip_serializing_if = "Option::is_none")]
11451    pub deal_pric: Option<Price71>,
11452    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11453    pub prtry: Option<Vec<ProprietaryPrice21>>,
11454}
11455
11456impl Validate for TransactionPrice4Choice1 {
11457    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11458        if let Some(ref val) = self.deal_pric
11459            && config.validate_optional_fields
11460        {
11461            val.validate(&helpers::child_path(path, "DealPric"), config, collector);
11462        }
11463        if let Some(ref vec) = self.prtry
11464            && config.validate_optional_fields
11465        {
11466            for item in vec {
11467                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11468            }
11469        }
11470    }
11471}
11472
11473// TransactionQuantities3Choice1: Proprietary quantities specification defined in the underlying transaction.
11474#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11475pub struct TransactionQuantities3Choice1 {
11476    #[serde(rename = "Qty", skip_serializing_if = "Option::is_none")]
11477    pub qty: Option<FinancialInstrumentQuantity1Choice>,
11478    #[serde(rename = "OrgnlAndCurFaceAmt", skip_serializing_if = "Option::is_none")]
11479    pub orgnl_and_cur_face_amt: Option<OriginalAndCurrentQuantities1>,
11480    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11481    pub prtry: Option<ProprietaryQuantity11>,
11482}
11483
11484impl Validate for TransactionQuantities3Choice1 {
11485    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11486        if let Some(ref val) = self.qty
11487            && config.validate_optional_fields
11488        {
11489            val.validate(&helpers::child_path(path, "Qty"), config, collector);
11490        }
11491        if let Some(ref val) = self.orgnl_and_cur_face_amt
11492            && config.validate_optional_fields
11493        {
11494            val.validate(
11495                &helpers::child_path(path, "OrgnlAndCurFaceAmt"),
11496                config,
11497                collector,
11498            );
11499        }
11500        if let Some(ref val) = self.prtry
11501            && config.validate_optional_fields
11502        {
11503            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
11504        }
11505    }
11506}
11507
11508// TransactionReferences61: Proprietary reference related to the underlying transaction.
11509#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11510pub struct TransactionReferences61 {
11511    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
11512    pub msg_id: Option<String>,
11513    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
11514    pub acct_svcr_ref: Option<String>,
11515    #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
11516    pub pmt_inf_id: Option<String>,
11517    #[serde(rename = "InstrId", skip_serializing_if = "Option::is_none")]
11518    pub instr_id: Option<String>,
11519    #[serde(rename = "EndToEndId", skip_serializing_if = "Option::is_none")]
11520    pub end_to_end_id: Option<String>,
11521    #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
11522    pub uetr: Option<String>,
11523    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
11524    pub tx_id: Option<String>,
11525    #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
11526    pub mndt_id: Option<String>,
11527    #[serde(rename = "ChqNb", skip_serializing_if = "Option::is_none")]
11528    pub chq_nb: Option<String>,
11529    #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
11530    pub clr_sys_ref: Option<String>,
11531    #[serde(rename = "AcctOwnrTxId", skip_serializing_if = "Option::is_none")]
11532    pub acct_ownr_tx_id: Option<String>,
11533    #[serde(rename = "AcctSvcrTxId", skip_serializing_if = "Option::is_none")]
11534    pub acct_svcr_tx_id: Option<String>,
11535    #[serde(rename = "MktInfrstrctrTxId", skip_serializing_if = "Option::is_none")]
11536    pub mkt_infrstrctr_tx_id: Option<String>,
11537    #[serde(rename = "PrcgId", skip_serializing_if = "Option::is_none")]
11538    pub prcg_id: Option<String>,
11539    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11540    pub prtry: Option<Vec<ProprietaryReference11>>,
11541}
11542
11543impl Validate for TransactionReferences61 {
11544    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11545        if let Some(ref val) = self.msg_id {
11546            helpers::validate_length(
11547                val,
11548                "MsgId",
11549                Some(1),
11550                Some(35),
11551                &helpers::child_path(path, "MsgId"),
11552                config,
11553                collector,
11554            );
11555        }
11556        if let Some(ref val) = self.msg_id {
11557            helpers::validate_pattern(
11558                val,
11559                "MsgId",
11560                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11561                &helpers::child_path(path, "MsgId"),
11562                config,
11563                collector,
11564            );
11565        }
11566        if let Some(ref val) = self.acct_svcr_ref {
11567            helpers::validate_length(
11568                val,
11569                "AcctSvcrRef",
11570                Some(1),
11571                Some(35),
11572                &helpers::child_path(path, "AcctSvcrRef"),
11573                config,
11574                collector,
11575            );
11576        }
11577        if let Some(ref val) = self.acct_svcr_ref {
11578            helpers::validate_pattern(
11579                val,
11580                "AcctSvcrRef",
11581                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11582                &helpers::child_path(path, "AcctSvcrRef"),
11583                config,
11584                collector,
11585            );
11586        }
11587        if let Some(ref val) = self.pmt_inf_id {
11588            helpers::validate_length(
11589                val,
11590                "PmtInfId",
11591                Some(1),
11592                Some(35),
11593                &helpers::child_path(path, "PmtInfId"),
11594                config,
11595                collector,
11596            );
11597        }
11598        if let Some(ref val) = self.pmt_inf_id {
11599            helpers::validate_pattern(
11600                val,
11601                "PmtInfId",
11602                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11603                &helpers::child_path(path, "PmtInfId"),
11604                config,
11605                collector,
11606            );
11607        }
11608        if let Some(ref val) = self.instr_id {
11609            helpers::validate_length(
11610                val,
11611                "InstrId",
11612                Some(1),
11613                Some(35),
11614                &helpers::child_path(path, "InstrId"),
11615                config,
11616                collector,
11617            );
11618        }
11619        if let Some(ref val) = self.instr_id {
11620            helpers::validate_pattern(
11621                val,
11622                "InstrId",
11623                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11624                &helpers::child_path(path, "InstrId"),
11625                config,
11626                collector,
11627            );
11628        }
11629        if let Some(ref val) = self.end_to_end_id {
11630            helpers::validate_length(
11631                val,
11632                "EndToEndId",
11633                Some(1),
11634                Some(35),
11635                &helpers::child_path(path, "EndToEndId"),
11636                config,
11637                collector,
11638            );
11639        }
11640        if let Some(ref val) = self.end_to_end_id {
11641            helpers::validate_pattern(
11642                val,
11643                "EndToEndId",
11644                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11645                &helpers::child_path(path, "EndToEndId"),
11646                config,
11647                collector,
11648            );
11649        }
11650        if let Some(ref val) = self.uetr {
11651            helpers::validate_pattern(
11652                val,
11653                "UETR",
11654                "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
11655                &helpers::child_path(path, "UETR"),
11656                config,
11657                collector,
11658            );
11659        }
11660        if let Some(ref val) = self.tx_id {
11661            helpers::validate_length(
11662                val,
11663                "TxId",
11664                Some(1),
11665                Some(35),
11666                &helpers::child_path(path, "TxId"),
11667                config,
11668                collector,
11669            );
11670        }
11671        if let Some(ref val) = self.tx_id {
11672            helpers::validate_pattern(
11673                val,
11674                "TxId",
11675                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11676                &helpers::child_path(path, "TxId"),
11677                config,
11678                collector,
11679            );
11680        }
11681        if let Some(ref val) = self.mndt_id {
11682            helpers::validate_length(
11683                val,
11684                "MndtId",
11685                Some(1),
11686                Some(35),
11687                &helpers::child_path(path, "MndtId"),
11688                config,
11689                collector,
11690            );
11691        }
11692        if let Some(ref val) = self.mndt_id {
11693            helpers::validate_pattern(
11694                val,
11695                "MndtId",
11696                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11697                &helpers::child_path(path, "MndtId"),
11698                config,
11699                collector,
11700            );
11701        }
11702        if let Some(ref val) = self.chq_nb {
11703            helpers::validate_length(
11704                val,
11705                "ChqNb",
11706                Some(1),
11707                Some(35),
11708                &helpers::child_path(path, "ChqNb"),
11709                config,
11710                collector,
11711            );
11712        }
11713        if let Some(ref val) = self.chq_nb {
11714            helpers::validate_pattern(
11715                val,
11716                "ChqNb",
11717                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11718                &helpers::child_path(path, "ChqNb"),
11719                config,
11720                collector,
11721            );
11722        }
11723        if let Some(ref val) = self.clr_sys_ref {
11724            helpers::validate_length(
11725                val,
11726                "ClrSysRef",
11727                Some(1),
11728                Some(35),
11729                &helpers::child_path(path, "ClrSysRef"),
11730                config,
11731                collector,
11732            );
11733        }
11734        if let Some(ref val) = self.clr_sys_ref {
11735            helpers::validate_pattern(
11736                val,
11737                "ClrSysRef",
11738                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11739                &helpers::child_path(path, "ClrSysRef"),
11740                config,
11741                collector,
11742            );
11743        }
11744        if let Some(ref val) = self.acct_ownr_tx_id {
11745            helpers::validate_length(
11746                val,
11747                "AcctOwnrTxId",
11748                Some(1),
11749                Some(35),
11750                &helpers::child_path(path, "AcctOwnrTxId"),
11751                config,
11752                collector,
11753            );
11754        }
11755        if let Some(ref val) = self.acct_ownr_tx_id {
11756            helpers::validate_pattern(
11757                val,
11758                "AcctOwnrTxId",
11759                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11760                &helpers::child_path(path, "AcctOwnrTxId"),
11761                config,
11762                collector,
11763            );
11764        }
11765        if let Some(ref val) = self.acct_svcr_tx_id {
11766            helpers::validate_length(
11767                val,
11768                "AcctSvcrTxId",
11769                Some(1),
11770                Some(35),
11771                &helpers::child_path(path, "AcctSvcrTxId"),
11772                config,
11773                collector,
11774            );
11775        }
11776        if let Some(ref val) = self.acct_svcr_tx_id {
11777            helpers::validate_pattern(
11778                val,
11779                "AcctSvcrTxId",
11780                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11781                &helpers::child_path(path, "AcctSvcrTxId"),
11782                config,
11783                collector,
11784            );
11785        }
11786        if let Some(ref val) = self.mkt_infrstrctr_tx_id {
11787            helpers::validate_length(
11788                val,
11789                "MktInfrstrctrTxId",
11790                Some(1),
11791                Some(35),
11792                &helpers::child_path(path, "MktInfrstrctrTxId"),
11793                config,
11794                collector,
11795            );
11796        }
11797        if let Some(ref val) = self.mkt_infrstrctr_tx_id {
11798            helpers::validate_pattern(
11799                val,
11800                "MktInfrstrctrTxId",
11801                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11802                &helpers::child_path(path, "MktInfrstrctrTxId"),
11803                config,
11804                collector,
11805            );
11806        }
11807        if let Some(ref val) = self.prcg_id {
11808            helpers::validate_length(
11809                val,
11810                "PrcgId",
11811                Some(1),
11812                Some(35),
11813                &helpers::child_path(path, "PrcgId"),
11814                config,
11815                collector,
11816            );
11817        }
11818        if let Some(ref val) = self.prcg_id {
11819            helpers::validate_pattern(
11820                val,
11821                "PrcgId",
11822                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11823                &helpers::child_path(path, "PrcgId"),
11824                config,
11825                collector,
11826            );
11827        }
11828        if let Some(ref vec) = self.prtry
11829            && config.validate_optional_fields
11830        {
11831            for item in vec {
11832                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
11833            }
11834        }
11835    }
11836}
11837
11838// UnitOfMeasure1Code: Unit of measure equal to 4, 840 square yards.
11839#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11840pub enum UnitOfMeasure1Code {
11841    #[default]
11842    #[serde(rename = "PIEC")]
11843    CodePIEC,
11844    #[serde(rename = "TONS")]
11845    CodeTONS,
11846    #[serde(rename = "FOOT")]
11847    CodeFOOT,
11848    #[serde(rename = "GBGA")]
11849    CodeGBGA,
11850    #[serde(rename = "USGA")]
11851    CodeUSGA,
11852    #[serde(rename = "GRAM")]
11853    CodeGRAM,
11854    #[serde(rename = "INCH")]
11855    CodeINCH,
11856    #[serde(rename = "KILO")]
11857    CodeKILO,
11858    #[serde(rename = "PUND")]
11859    CodePUND,
11860    #[serde(rename = "METR")]
11861    CodeMETR,
11862    #[serde(rename = "CMET")]
11863    CodeCMET,
11864    #[serde(rename = "MMET")]
11865    CodeMMET,
11866    #[serde(rename = "LITR")]
11867    CodeLITR,
11868    #[serde(rename = "CELI")]
11869    CodeCELI,
11870    #[serde(rename = "MILI")]
11871    CodeMILI,
11872    #[serde(rename = "GBOU")]
11873    CodeGBOU,
11874    #[serde(rename = "USOU")]
11875    CodeUSOU,
11876    #[serde(rename = "GBQA")]
11877    CodeGBQA,
11878    #[serde(rename = "USQA")]
11879    CodeUSQA,
11880    #[serde(rename = "GBPI")]
11881    CodeGBPI,
11882    #[serde(rename = "USPI")]
11883    CodeUSPI,
11884    #[serde(rename = "MILE")]
11885    CodeMILE,
11886    #[serde(rename = "KMET")]
11887    CodeKMET,
11888    #[serde(rename = "YARD")]
11889    CodeYARD,
11890    #[serde(rename = "SQKI")]
11891    CodeSQKI,
11892    #[serde(rename = "HECT")]
11893    CodeHECT,
11894    #[serde(rename = "ARES")]
11895    CodeARES,
11896    #[serde(rename = "SMET")]
11897    CodeSMET,
11898    #[serde(rename = "SCMT")]
11899    CodeSCMT,
11900    #[serde(rename = "SMIL")]
11901    CodeSMIL,
11902    #[serde(rename = "SQMI")]
11903    CodeSQMI,
11904    #[serde(rename = "SQYA")]
11905    CodeSQYA,
11906    #[serde(rename = "SQFO")]
11907    CodeSQFO,
11908    #[serde(rename = "SQIN")]
11909    CodeSQIN,
11910    #[serde(rename = "ACRE")]
11911    CodeACRE,
11912}
11913
11914impl Validate for UnitOfMeasure1Code {
11915    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
11916        // Enum validation is typically empty
11917    }
11918}
11919
11920// UserInterface2Code: Cardholder display or interface.
11921#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11922pub enum UserInterface2Code {
11923    #[default]
11924    #[serde(rename = "MDSP")]
11925    CodeMDSP,
11926    #[serde(rename = "CDSP")]
11927    CodeCDSP,
11928}
11929
11930impl Validate for UserInterface2Code {
11931    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
11932        // Enum validation is typically empty
11933    }
11934}
11935
11936// YieldedOrValueType1Choice: Type of value in which the price is expressed.
11937#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11938pub struct YieldedOrValueType1Choice {
11939    #[serde(rename = "Yldd", skip_serializing_if = "Option::is_none")]
11940    pub yldd: Option<bool>,
11941    #[serde(rename = "ValTp", skip_serializing_if = "Option::is_none")]
11942    pub val_tp: Option<PriceValueType1Code>,
11943}
11944
11945impl Validate for YieldedOrValueType1Choice {
11946    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11947        if let Some(ref val) = self.val_tp
11948            && config.validate_optional_fields
11949        {
11950            val.validate(&helpers::child_path(path, "ValTp"), config, collector);
11951        }
11952    }
11953}