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