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