mx_message/document/
camt_054_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// AccountNotification171: Further details of the account notification.
116#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
117pub struct AccountNotification171 {
118    #[serde(rename = "Id")]
119    pub id: String,
120    #[serde(rename = "NtfctnPgntn", skip_serializing_if = "Option::is_none")]
121    pub ntfctn_pgntn: Option<Pagination1>,
122    #[serde(rename = "ElctrncSeqNb", skip_serializing_if = "Option::is_none")]
123    pub elctrnc_seq_nb: Option<f64>,
124    #[serde(rename = "RptgSeq", skip_serializing_if = "Option::is_none")]
125    pub rptg_seq: Option<SequenceRange1Choice1>,
126    #[serde(rename = "LglSeqNb", skip_serializing_if = "Option::is_none")]
127    pub lgl_seq_nb: Option<f64>,
128    #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
129    pub cre_dt_tm: Option<String>,
130    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
131    pub fr_to_dt: Option<DateTimePeriod11>,
132    #[serde(rename = "CpyDplctInd", skip_serializing_if = "Option::is_none")]
133    pub cpy_dplct_ind: Option<CopyDuplicate1Code>,
134    #[serde(rename = "RptgSrc", skip_serializing_if = "Option::is_none")]
135    pub rptg_src: Option<ReportingSource1Choice1>,
136    #[serde(rename = "Acct")]
137    pub acct: CashAccount391,
138    #[serde(rename = "RltdAcct", skip_serializing_if = "Option::is_none")]
139    pub rltd_acct: Option<CashAccount381>,
140    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
141    pub intrst: Option<Vec<AccountInterest41>>,
142    #[serde(rename = "TxsSummry", skip_serializing_if = "Option::is_none")]
143    pub txs_summry: Option<TotalTransactions61>,
144    #[serde(rename = "Ntry")]
145    pub ntry: Vec<ReportEntry101>,
146    #[serde(rename = "AddtlNtfctnInf", skip_serializing_if = "Option::is_none")]
147    pub addtl_ntfctn_inf: Option<String>,
148}
149
150impl Validate for AccountNotification171 {
151    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
152        helpers::validate_length(
153            &self.id,
154            "Id",
155            Some(1),
156            Some(35),
157            &helpers::child_path(path, "Id"),
158            config,
159            collector,
160        );
161        helpers::validate_pattern(
162            &self.id,
163            "Id",
164            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
165            &helpers::child_path(path, "Id"),
166            config,
167            collector,
168        );
169        if let Some(ref val) = self.ntfctn_pgntn
170            && config.validate_optional_fields
171        {
172            val.validate(&helpers::child_path(path, "NtfctnPgntn"), config, collector);
173        }
174        if let Some(ref val) = self.rptg_seq
175            && config.validate_optional_fields
176        {
177            val.validate(&helpers::child_path(path, "RptgSeq"), config, collector);
178        }
179        if let Some(ref val) = self.cre_dt_tm {
180            helpers::validate_pattern(
181                val,
182                "CreDtTm",
183                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
184                &helpers::child_path(path, "CreDtTm"),
185                config,
186                collector,
187            );
188        }
189        if let Some(ref val) = self.fr_to_dt
190            && config.validate_optional_fields
191        {
192            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
193        }
194        if let Some(ref val) = self.cpy_dplct_ind
195            && config.validate_optional_fields
196        {
197            val.validate(&helpers::child_path(path, "CpyDplctInd"), config, collector);
198        }
199        if let Some(ref val) = self.rptg_src
200            && config.validate_optional_fields
201        {
202            val.validate(&helpers::child_path(path, "RptgSrc"), config, collector);
203        }
204        self.acct
205            .validate(&helpers::child_path(path, "Acct"), config, collector);
206        if let Some(ref val) = self.rltd_acct
207            && config.validate_optional_fields
208        {
209            val.validate(&helpers::child_path(path, "RltdAcct"), config, collector);
210        }
211        if let Some(ref vec) = self.intrst
212            && config.validate_optional_fields
213        {
214            for item in vec {
215                item.validate(&helpers::child_path(path, "Intrst"), config, collector);
216            }
217        }
218        if let Some(ref val) = self.txs_summry
219            && config.validate_optional_fields
220        {
221            val.validate(&helpers::child_path(path, "TxsSummry"), config, collector);
222        }
223        for item in &self.ntry {
224            item.validate(&helpers::child_path(path, "Ntry"), config, collector);
225        }
226        if let Some(ref val) = self.addtl_ntfctn_inf {
227            helpers::validate_length(
228                val,
229                "AddtlNtfctnInf",
230                Some(1),
231                Some(500),
232                &helpers::child_path(path, "AddtlNtfctnInf"),
233                config,
234                collector,
235            );
236        }
237        if let Some(ref val) = self.addtl_ntfctn_inf {
238            helpers::validate_pattern(
239                val,
240                "AddtlNtfctnInf",
241                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
242                &helpers::child_path(path, "AddtlNtfctnInf"),
243                config,
244                collector,
245            );
246        }
247    }
248}
249
250// AccountSchemeName1Choice1: Name of the identification scheme, in a free text form.
251#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
252pub struct AccountSchemeName1Choice1 {
253    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
254    pub cd: Option<String>,
255    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
256    pub prtry: Option<String>,
257}
258
259impl Validate for AccountSchemeName1Choice1 {
260    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
261        if let Some(ref val) = self.cd {
262            helpers::validate_length(
263                val,
264                "Cd",
265                Some(1),
266                Some(4),
267                &helpers::child_path(path, "Cd"),
268                config,
269                collector,
270            );
271        }
272        if let Some(ref val) = self.prtry {
273            helpers::validate_length(
274                val,
275                "Prtry",
276                Some(1),
277                Some(35),
278                &helpers::child_path(path, "Prtry"),
279                config,
280                collector,
281            );
282        }
283        if let Some(ref val) = self.prtry {
284            helpers::validate_pattern(
285                val,
286                "Prtry",
287                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
288                &helpers::child_path(path, "Prtry"),
289                config,
290                collector,
291            );
292        }
293    }
294}
295
296// ActiveCurrencyAndAmount: A number of monetary units specified in an active currency where the unit of currency is explicit and compliant with ISO 4217.
297#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
298pub struct ActiveCurrencyAndAmount {
299    #[serde(rename = "@Ccy")]
300    pub ccy: String,
301    #[serde(rename = "$value")]
302    pub value: f64,
303}
304
305impl Validate for ActiveCurrencyAndAmount {
306    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
307}
308
309// 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.
310// Note: The decimal separator is a dot.
311#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
312pub struct ActiveOrHistoricCurrencyAnd13DecimalAmount {
313    #[serde(rename = "@Ccy")]
314    pub ccy: String,
315    #[serde(rename = "$value")]
316    pub value: f64,
317}
318
319impl Validate for ActiveOrHistoricCurrencyAnd13DecimalAmount {
320    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
321}
322
323// 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.
324#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
325pub struct ActiveOrHistoricCurrencyAndAmount {
326    #[serde(rename = "@Ccy")]
327    pub ccy: String,
328    #[serde(rename = "$value")]
329    pub value: f64,
330}
331
332impl Validate for ActiveOrHistoricCurrencyAndAmount {
333    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
334}
335
336// ActiveOrHistoricCurrencyAndAmountRange2: Medium of exchange of value, used to qualify an amount.
337#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
338pub struct ActiveOrHistoricCurrencyAndAmountRange2 {
339    #[serde(rename = "Amt")]
340    pub amt: ImpliedCurrencyAmountRange1Choice,
341    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
342    pub cdt_dbt_ind: Option<CreditDebitCode>,
343    #[serde(rename = "Ccy")]
344    pub ccy: String,
345}
346
347impl Validate for ActiveOrHistoricCurrencyAndAmountRange2 {
348    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
349        self.amt
350            .validate(&helpers::child_path(path, "Amt"), config, collector);
351        if let Some(ref val) = self.cdt_dbt_ind
352            && config.validate_optional_fields
353        {
354            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
355        }
356        helpers::validate_pattern(
357            &self.ccy,
358            "Ccy",
359            "[A-Z]{3,3}",
360            &helpers::child_path(path, "Ccy"),
361            config,
362            collector,
363        );
364    }
365}
366
367// AddressType2Code: Address is the address to which delivery is to take place.
368#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
369pub enum AddressType2Code {
370    #[default]
371    #[serde(rename = "ADDR")]
372    CodeADDR,
373    #[serde(rename = "PBOX")]
374    CodePBOX,
375    #[serde(rename = "HOME")]
376    CodeHOME,
377    #[serde(rename = "BIZZ")]
378    CodeBIZZ,
379    #[serde(rename = "MLTO")]
380    CodeMLTO,
381    #[serde(rename = "DLVY")]
382    CodeDLVY,
383}
384
385impl Validate for AddressType2Code {
386    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
387        // Enum validation is typically empty
388    }
389}
390
391// AddressType3Choice: Type of address expressed as a proprietary code.
392#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
393pub struct AddressType3Choice {
394    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
395    pub cd: Option<AddressType2Code>,
396    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
397    pub prtry: Option<GenericIdentification30>,
398}
399
400impl Validate for AddressType3Choice {
401    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
402        if let Some(ref val) = self.cd
403            && config.validate_optional_fields
404        {
405            val.validate(&helpers::child_path(path, "Cd"), config, collector);
406        }
407        if let Some(ref val) = self.prtry
408            && config.validate_optional_fields
409        {
410            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
411        }
412    }
413}
414
415// AddressType3Choice1: Type of address expressed as a proprietary code.
416#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
417pub struct AddressType3Choice1 {
418    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
419    pub cd: Option<AddressType2Code>,
420    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
421    pub prtry: Option<GenericIdentification301>,
422}
423
424impl Validate for AddressType3Choice1 {
425    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
426        if let Some(ref val) = self.cd
427            && config.validate_optional_fields
428        {
429            val.validate(&helpers::child_path(path, "Cd"), config, collector);
430        }
431        if let Some(ref val) = self.prtry
432            && config.validate_optional_fields
433        {
434            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
435        }
436    }
437}
438
439// AmountAndCurrencyExchange31: Set of elements used to provide information on the original amount and currency exchange.
440#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
441pub struct AmountAndCurrencyExchange31 {
442    #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
443    pub instd_amt: Option<AmountAndCurrencyExchangeDetails31>,
444    #[serde(rename = "TxAmt", skip_serializing_if = "Option::is_none")]
445    pub tx_amt: Option<AmountAndCurrencyExchangeDetails31>,
446    #[serde(rename = "CntrValAmt", skip_serializing_if = "Option::is_none")]
447    pub cntr_val_amt: Option<AmountAndCurrencyExchangeDetails31>,
448    #[serde(rename = "AnncdPstngAmt", skip_serializing_if = "Option::is_none")]
449    pub anncd_pstng_amt: Option<AmountAndCurrencyExchangeDetails31>,
450    #[serde(rename = "PrtryAmt", skip_serializing_if = "Option::is_none")]
451    pub prtry_amt: Option<Vec<AmountAndCurrencyExchangeDetails41>>,
452}
453
454impl Validate for AmountAndCurrencyExchange31 {
455    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
456        if let Some(ref val) = self.instd_amt
457            && config.validate_optional_fields
458        {
459            val.validate(&helpers::child_path(path, "InstdAmt"), config, collector);
460        }
461        if let Some(ref val) = self.tx_amt
462            && config.validate_optional_fields
463        {
464            val.validate(&helpers::child_path(path, "TxAmt"), config, collector);
465        }
466        if let Some(ref val) = self.cntr_val_amt
467            && config.validate_optional_fields
468        {
469            val.validate(&helpers::child_path(path, "CntrValAmt"), config, collector);
470        }
471        if let Some(ref val) = self.anncd_pstng_amt
472            && config.validate_optional_fields
473        {
474            val.validate(
475                &helpers::child_path(path, "AnncdPstngAmt"),
476                config,
477                collector,
478            );
479        }
480        if let Some(ref vec) = self.prtry_amt
481            && config.validate_optional_fields
482        {
483            for item in vec {
484                item.validate(&helpers::child_path(path, "PrtryAmt"), config, collector);
485            }
486        }
487    }
488}
489
490// AmountAndCurrencyExchangeDetails31: Set of elements used to provide details on the currency exchange.
491#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
492pub struct AmountAndCurrencyExchangeDetails31 {
493    #[serde(rename = "Amt")]
494    pub amt: ActiveOrHistoricCurrencyAndAmount,
495    #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
496    pub ccy_xchg: Option<CurrencyExchange51>,
497}
498
499impl Validate for AmountAndCurrencyExchangeDetails31 {
500    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
501        self.amt
502            .validate(&helpers::child_path(path, "Amt"), config, collector);
503        if let Some(ref val) = self.ccy_xchg
504            && config.validate_optional_fields
505        {
506            val.validate(&helpers::child_path(path, "CcyXchg"), config, collector);
507        }
508    }
509}
510
511// AmountAndCurrencyExchangeDetails41: Set of elements used to provide details on the currency exchange.
512#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
513pub struct AmountAndCurrencyExchangeDetails41 {
514    #[serde(rename = "Tp")]
515    pub tp: String,
516    #[serde(rename = "Amt")]
517    pub amt: ActiveOrHistoricCurrencyAndAmount,
518    #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
519    pub ccy_xchg: Option<CurrencyExchange51>,
520}
521
522impl Validate for AmountAndCurrencyExchangeDetails41 {
523    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
524        helpers::validate_length(
525            &self.tp,
526            "Tp",
527            Some(1),
528            Some(35),
529            &helpers::child_path(path, "Tp"),
530            config,
531            collector,
532        );
533        helpers::validate_pattern(
534            &self.tp,
535            "Tp",
536            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
537            &helpers::child_path(path, "Tp"),
538            config,
539            collector,
540        );
541        self.amt
542            .validate(&helpers::child_path(path, "Amt"), config, collector);
543        if let Some(ref val) = self.ccy_xchg
544            && config.validate_optional_fields
545        {
546            val.validate(&helpers::child_path(path, "CcyXchg"), config, collector);
547        }
548    }
549}
550
551// AmountAndDirection35: Indicates whether the amount is a credit or a debit amount.
552#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
553pub struct AmountAndDirection35 {
554    #[serde(rename = "Amt")]
555    pub amt: f64,
556    #[serde(rename = "CdtDbtInd")]
557    pub cdt_dbt_ind: CreditDebitCode,
558}
559
560impl Validate for AmountAndDirection35 {
561    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
562        self.cdt_dbt_ind
563            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
564    }
565}
566
567// AmountRangeBoundary1: Indicates whether the boundary amount is included in the range of amount values.
568#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
569pub struct AmountRangeBoundary1 {
570    #[serde(rename = "BdryAmt")]
571    pub bdry_amt: f64,
572    #[serde(rename = "Incl")]
573    pub incl: bool,
574}
575
576impl Validate for AmountRangeBoundary1 {
577    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
578}
579
580// AttendanceContext1Code: Unattended payment, no attendant present.
581#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
582pub enum AttendanceContext1Code {
583    #[default]
584    #[serde(rename = "ATTD")]
585    CodeATTD,
586    #[serde(rename = "SATT")]
587    CodeSATT,
588    #[serde(rename = "UATT")]
589    CodeUATT,
590}
591
592impl Validate for AttendanceContext1Code {
593    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
594        // Enum validation is typically empty
595    }
596}
597
598// AuthenticationEntity1Code: Merchant (for example signature verification by the attendant).
599#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
600pub enum AuthenticationEntity1Code {
601    #[default]
602    #[serde(rename = "ICCD")]
603    CodeICCD,
604    #[serde(rename = "AGNT")]
605    CodeAGNT,
606    #[serde(rename = "MERC")]
607    CodeMERC,
608}
609
610impl Validate for AuthenticationEntity1Code {
611    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
612        // Enum validation is typically empty
613    }
614}
615
616// AuthenticationMethod1Code: Channel-encrypted transaction.
617#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
618pub enum AuthenticationMethod1Code {
619    #[default]
620    #[serde(rename = "UKNW")]
621    CodeUKNW,
622    #[serde(rename = "BYPS")]
623    CodeBYPS,
624    #[serde(rename = "NPIN")]
625    CodeNPIN,
626    #[serde(rename = "FPIN")]
627    CodeFPIN,
628    #[serde(rename = "CPSG")]
629    CodeCPSG,
630    #[serde(rename = "PPSG")]
631    CodePPSG,
632    #[serde(rename = "MANU")]
633    CodeMANU,
634    #[serde(rename = "MERC")]
635    CodeMERC,
636    #[serde(rename = "SCRT")]
637    CodeSCRT,
638    #[serde(rename = "SNCT")]
639    CodeSNCT,
640    #[serde(rename = "SCNL")]
641    CodeSCNL,
642}
643
644impl Validate for AuthenticationMethod1Code {
645    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
646        // Enum validation is typically empty
647    }
648}
649
650// BankToCustomerDebitCreditNotificationV08: Notifies debit and credit entries for the account.
651#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
652pub struct BankToCustomerDebitCreditNotificationV08 {
653    #[serde(rename = "GrpHdr")]
654    pub grp_hdr: GroupHeader811,
655    #[serde(rename = "Ntfctn")]
656    pub ntfctn: Vec<AccountNotification171>,
657}
658
659impl Validate for BankToCustomerDebitCreditNotificationV08 {
660    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
661        self.grp_hdr
662            .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
663        for item in &self.ntfctn {
664            item.validate(&helpers::child_path(path, "Ntfctn"), config, collector);
665        }
666    }
667}
668
669// BankTransactionCodeStructure41: Bank transaction code in a proprietary form, as defined by the issuer.
670#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
671pub struct BankTransactionCodeStructure41 {
672    #[serde(rename = "Domn", skip_serializing_if = "Option::is_none")]
673    pub domn: Option<BankTransactionCodeStructure5>,
674    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
675    pub prtry: Option<ProprietaryBankTransactionCodeStructure11>,
676}
677
678impl Validate for BankTransactionCodeStructure41 {
679    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
680        if let Some(ref val) = self.domn
681            && config.validate_optional_fields
682        {
683            val.validate(&helpers::child_path(path, "Domn"), config, collector);
684        }
685        if let Some(ref val) = self.prtry
686            && config.validate_optional_fields
687        {
688            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
689        }
690    }
691}
692
693// BankTransactionCodeStructure5: Specifies the family and the sub-family of the bank transaction code, within a specific domain, in a structured and hierarchical format.
694#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
695pub struct BankTransactionCodeStructure5 {
696    #[serde(rename = "Cd")]
697    pub cd: String,
698    #[serde(rename = "Fmly")]
699    pub fmly: BankTransactionCodeStructure6,
700}
701
702impl Validate for BankTransactionCodeStructure5 {
703    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
704        helpers::validate_length(
705            &self.cd,
706            "Cd",
707            Some(1),
708            Some(4),
709            &helpers::child_path(path, "Cd"),
710            config,
711            collector,
712        );
713        self.fmly
714            .validate(&helpers::child_path(path, "Fmly"), config, collector);
715    }
716}
717
718// BankTransactionCodeStructure6: Specifies the sub-product family within a specific family.
719#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
720pub struct BankTransactionCodeStructure6 {
721    #[serde(rename = "Cd")]
722    pub cd: String,
723    #[serde(rename = "SubFmlyCd")]
724    pub sub_fmly_cd: String,
725}
726
727impl Validate for BankTransactionCodeStructure6 {
728    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
729        helpers::validate_length(
730            &self.cd,
731            "Cd",
732            Some(1),
733            Some(4),
734            &helpers::child_path(path, "Cd"),
735            config,
736            collector,
737        );
738        helpers::validate_length(
739            &self.sub_fmly_cd,
740            "SubFmlyCd",
741            Some(1),
742            Some(4),
743            &helpers::child_path(path, "SubFmlyCd"),
744            config,
745            collector,
746        );
747    }
748}
749
750// BatchInformation21: Indicates whether the batch entry is a credit or a debit entry.
751#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
752pub struct BatchInformation21 {
753    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
754    pub msg_id: Option<String>,
755    #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
756    pub pmt_inf_id: Option<String>,
757    #[serde(rename = "NbOfTxs", skip_serializing_if = "Option::is_none")]
758    pub nb_of_txs: Option<String>,
759    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
760    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
761    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
762    pub cdt_dbt_ind: Option<CreditDebitCode>,
763}
764
765impl Validate for BatchInformation21 {
766    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
767        if let Some(ref val) = self.msg_id {
768            helpers::validate_length(
769                val,
770                "MsgId",
771                Some(1),
772                Some(35),
773                &helpers::child_path(path, "MsgId"),
774                config,
775                collector,
776            );
777        }
778        if let Some(ref val) = self.msg_id {
779            helpers::validate_pattern(
780                val,
781                "MsgId",
782                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
783                &helpers::child_path(path, "MsgId"),
784                config,
785                collector,
786            );
787        }
788        if let Some(ref val) = self.pmt_inf_id {
789            helpers::validate_length(
790                val,
791                "PmtInfId",
792                Some(1),
793                Some(35),
794                &helpers::child_path(path, "PmtInfId"),
795                config,
796                collector,
797            );
798        }
799        if let Some(ref val) = self.pmt_inf_id {
800            helpers::validate_pattern(
801                val,
802                "PmtInfId",
803                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
804                &helpers::child_path(path, "PmtInfId"),
805                config,
806                collector,
807            );
808        }
809        if let Some(ref val) = self.nb_of_txs {
810            helpers::validate_pattern(
811                val,
812                "NbOfTxs",
813                "[0-9]{1,15}",
814                &helpers::child_path(path, "NbOfTxs"),
815                config,
816                collector,
817            );
818        }
819        if let Some(ref val) = self.ttl_amt
820            && config.validate_optional_fields
821        {
822            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
823        }
824        if let Some(ref val) = self.cdt_dbt_ind
825            && config.validate_optional_fields
826        {
827            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
828        }
829    }
830}
831
832// BranchAndFinancialInstitutionIdentification61: Identifies a specific branch of a financial institution.
833//
834// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
835#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
836pub struct BranchAndFinancialInstitutionIdentification61 {
837    #[serde(rename = "FinInstnId")]
838    pub fin_instn_id: FinancialInstitutionIdentification181,
839    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
840    pub brnch_id: Option<BranchData31>,
841}
842
843impl Validate for BranchAndFinancialInstitutionIdentification61 {
844    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
845        self.fin_instn_id
846            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
847        if let Some(ref val) = self.brnch_id
848            && config.validate_optional_fields
849        {
850            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
851        }
852    }
853}
854
855// BranchAndFinancialInstitutionIdentification62: Identifies a specific branch of a financial institution.
856//
857// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
858#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
859pub struct BranchAndFinancialInstitutionIdentification62 {
860    #[serde(rename = "FinInstnId")]
861    pub fin_instn_id: FinancialInstitutionIdentification182,
862    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
863    pub brnch_id: Option<BranchData32>,
864}
865
866impl Validate for BranchAndFinancialInstitutionIdentification62 {
867    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
868        self.fin_instn_id
869            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
870        if let Some(ref val) = self.brnch_id
871            && config.validate_optional_fields
872        {
873            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
874        }
875    }
876}
877
878// BranchAndFinancialInstitutionIdentification63: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
879#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
880pub struct BranchAndFinancialInstitutionIdentification63 {
881    #[serde(rename = "FinInstnId")]
882    pub fin_instn_id: FinancialInstitutionIdentification183,
883}
884
885impl Validate for BranchAndFinancialInstitutionIdentification63 {
886    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
887        self.fin_instn_id
888            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
889    }
890}
891
892// BranchAndFinancialInstitutionIdentification64: Identifies a specific branch of a financial institution.
893//
894// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
895#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
896pub struct BranchAndFinancialInstitutionIdentification64 {
897    #[serde(rename = "FinInstnId")]
898    pub fin_instn_id: FinancialInstitutionIdentification184,
899    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
900    pub brnch_id: Option<BranchData33>,
901}
902
903impl Validate for BranchAndFinancialInstitutionIdentification64 {
904    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
905        self.fin_instn_id
906            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
907        if let Some(ref val) = self.brnch_id
908            && config.validate_optional_fields
909        {
910            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
911        }
912    }
913}
914
915// BranchAndFinancialInstitutionIdentification65: Identifies a specific branch of a financial institution.
916//
917// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
918#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
919pub struct BranchAndFinancialInstitutionIdentification65 {
920    #[serde(rename = "FinInstnId")]
921    pub fin_instn_id: FinancialInstitutionIdentification184,
922    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
923    pub brnch_id: Option<BranchData32>,
924}
925
926impl Validate for BranchAndFinancialInstitutionIdentification65 {
927    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
928        self.fin_instn_id
929            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
930        if let Some(ref val) = self.brnch_id
931            && config.validate_optional_fields
932        {
933            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
934        }
935    }
936}
937
938// BranchAndFinancialInstitutionIdentification66: Identifies a specific branch of a financial institution.
939//
940// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
941#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
942pub struct BranchAndFinancialInstitutionIdentification66 {
943    #[serde(rename = "FinInstnId")]
944    pub fin_instn_id: FinancialInstitutionIdentification185,
945    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
946    pub brnch_id: Option<BranchData34>,
947}
948
949impl Validate for BranchAndFinancialInstitutionIdentification66 {
950    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
951        self.fin_instn_id
952            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
953        if let Some(ref val) = self.brnch_id
954            && config.validate_optional_fields
955        {
956            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
957        }
958    }
959}
960
961// BranchAndFinancialInstitutionIdentification67: Identifies a specific branch of a financial institution.
962//
963// Usage: This component should be used in case the identification information in the financial institution component does not provide identification up to branch level.
964#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
965pub struct BranchAndFinancialInstitutionIdentification67 {
966    #[serde(rename = "FinInstnId")]
967    pub fin_instn_id: FinancialInstitutionIdentification186,
968    #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
969    pub brnch_id: Option<BranchData32>,
970}
971
972impl Validate for BranchAndFinancialInstitutionIdentification67 {
973    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
974        self.fin_instn_id
975            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
976        if let Some(ref val) = self.brnch_id
977            && config.validate_optional_fields
978        {
979            val.validate(&helpers::child_path(path, "BrnchId"), config, collector);
980        }
981    }
982}
983
984// BranchData31: Information that locates and identifies a specific address, as defined by postal services.
985#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
986pub struct BranchData31 {
987    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
988    pub id: Option<String>,
989    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
990    pub lei: Option<String>,
991    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
992    pub nm: Option<String>,
993    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
994    pub pstl_adr: Option<PostalAddress243>,
995}
996
997impl Validate for BranchData31 {
998    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
999        if let Some(ref val) = self.id {
1000            helpers::validate_length(
1001                val,
1002                "Id",
1003                Some(1),
1004                Some(35),
1005                &helpers::child_path(path, "Id"),
1006                config,
1007                collector,
1008            );
1009        }
1010        if let Some(ref val) = self.id {
1011            helpers::validate_pattern(
1012                val,
1013                "Id",
1014                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1015                &helpers::child_path(path, "Id"),
1016                config,
1017                collector,
1018            );
1019        }
1020        if let Some(ref val) = self.lei {
1021            helpers::validate_pattern(
1022                val,
1023                "LEI",
1024                "[A-Z0-9]{18,18}[0-9]{2,2}",
1025                &helpers::child_path(path, "LEI"),
1026                config,
1027                collector,
1028            );
1029        }
1030        if let Some(ref val) = self.nm {
1031            helpers::validate_length(
1032                val,
1033                "Nm",
1034                Some(1),
1035                Some(140),
1036                &helpers::child_path(path, "Nm"),
1037                config,
1038                collector,
1039            );
1040        }
1041        if let Some(ref val) = self.nm {
1042            helpers::validate_pattern(
1043                val,
1044                "Nm",
1045                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1046                &helpers::child_path(path, "Nm"),
1047                config,
1048                collector,
1049            );
1050        }
1051        if let Some(ref val) = self.pstl_adr
1052            && config.validate_optional_fields
1053        {
1054            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1055        }
1056    }
1057}
1058
1059// BranchData32: Information that locates and identifies a specific address, as defined by postal services.
1060#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1061pub struct BranchData32 {
1062    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1063    pub id: Option<String>,
1064    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1065    pub lei: Option<String>,
1066    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1067    pub nm: Option<String>,
1068    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1069    pub pstl_adr: Option<PostalAddress241>,
1070}
1071
1072impl Validate for BranchData32 {
1073    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1074        if let Some(ref val) = self.id {
1075            helpers::validate_length(
1076                val,
1077                "Id",
1078                Some(1),
1079                Some(35),
1080                &helpers::child_path(path, "Id"),
1081                config,
1082                collector,
1083            );
1084        }
1085        if let Some(ref val) = self.id {
1086            helpers::validate_pattern(
1087                val,
1088                "Id",
1089                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1090                &helpers::child_path(path, "Id"),
1091                config,
1092                collector,
1093            );
1094        }
1095        if let Some(ref val) = self.lei {
1096            helpers::validate_pattern(
1097                val,
1098                "LEI",
1099                "[A-Z0-9]{18,18}[0-9]{2,2}",
1100                &helpers::child_path(path, "LEI"),
1101                config,
1102                collector,
1103            );
1104        }
1105        if let Some(ref val) = self.nm {
1106            helpers::validate_length(
1107                val,
1108                "Nm",
1109                Some(1),
1110                Some(140),
1111                &helpers::child_path(path, "Nm"),
1112                config,
1113                collector,
1114            );
1115        }
1116        if let Some(ref val) = self.nm {
1117            helpers::validate_pattern(
1118                val,
1119                "Nm",
1120                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1121                &helpers::child_path(path, "Nm"),
1122                config,
1123                collector,
1124            );
1125        }
1126        if let Some(ref val) = self.pstl_adr
1127            && config.validate_optional_fields
1128        {
1129            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1130        }
1131    }
1132}
1133
1134// BranchData33: Information that locates and identifies a specific address, as defined by postal services.
1135#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1136pub struct BranchData33 {
1137    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1138    pub id: Option<String>,
1139    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1140    pub lei: Option<String>,
1141    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1142    pub nm: Option<String>,
1143    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1144    pub pstl_adr: Option<PostalAddress244>,
1145}
1146
1147impl Validate for BranchData33 {
1148    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1149        if let Some(ref val) = self.id {
1150            helpers::validate_length(
1151                val,
1152                "Id",
1153                Some(1),
1154                Some(35),
1155                &helpers::child_path(path, "Id"),
1156                config,
1157                collector,
1158            );
1159        }
1160        if let Some(ref val) = self.lei {
1161            helpers::validate_pattern(
1162                val,
1163                "LEI",
1164                "[A-Z0-9]{18,18}[0-9]{2,2}",
1165                &helpers::child_path(path, "LEI"),
1166                config,
1167                collector,
1168            );
1169        }
1170        if let Some(ref val) = self.nm {
1171            helpers::validate_length(
1172                val,
1173                "Nm",
1174                Some(1),
1175                Some(140),
1176                &helpers::child_path(path, "Nm"),
1177                config,
1178                collector,
1179            );
1180        }
1181        if let Some(ref val) = self.pstl_adr
1182            && config.validate_optional_fields
1183        {
1184            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1185        }
1186    }
1187}
1188
1189// BranchData34: Information that locates and identifies a specific address, as defined by postal services.
1190#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1191pub struct BranchData34 {
1192    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1193    pub id: Option<String>,
1194    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1195    pub lei: Option<String>,
1196    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1197    pub nm: Option<String>,
1198    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1199    pub pstl_adr: Option<PostalAddress241>,
1200}
1201
1202impl Validate for BranchData34 {
1203    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1204        if let Some(ref val) = self.id {
1205            helpers::validate_length(
1206                val,
1207                "Id",
1208                Some(1),
1209                Some(35),
1210                &helpers::child_path(path, "Id"),
1211                config,
1212                collector,
1213            );
1214        }
1215        if let Some(ref val) = self.lei {
1216            helpers::validate_pattern(
1217                val,
1218                "LEI",
1219                "[A-Z0-9]{18,18}[0-9]{2,2}",
1220                &helpers::child_path(path, "LEI"),
1221                config,
1222                collector,
1223            );
1224        }
1225        if let Some(ref val) = self.nm {
1226            helpers::validate_length(
1227                val,
1228                "Nm",
1229                Some(1),
1230                Some(140),
1231                &helpers::child_path(path, "Nm"),
1232                config,
1233                collector,
1234            );
1235        }
1236        if let Some(ref val) = self.nm {
1237            helpers::validate_pattern(
1238                val,
1239                "Nm",
1240                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1241                &helpers::child_path(path, "Nm"),
1242                config,
1243                collector,
1244            );
1245        }
1246        if let Some(ref val) = self.pstl_adr
1247            && config.validate_optional_fields
1248        {
1249            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1250        }
1251    }
1252}
1253
1254// CSCManagement1Code: No card security code imprint.
1255#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1256pub enum CSCManagement1Code {
1257    #[default]
1258    #[serde(rename = "PRST")]
1259    CodePRST,
1260    #[serde(rename = "BYPS")]
1261    CodeBYPS,
1262    #[serde(rename = "UNRD")]
1263    CodeUNRD,
1264    #[serde(rename = "NCSC")]
1265    CodeNCSC,
1266}
1267
1268impl Validate for CSCManagement1Code {
1269    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1270        // Enum validation is typically empty
1271    }
1272}
1273
1274// CardAggregated21: Date range on which the globalisation applies.
1275#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1276pub struct CardAggregated21 {
1277    #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1278    pub addtl_svc: Option<CardPaymentServiceType2Code>,
1279    #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1280    pub tx_ctgy: Option<String>,
1281    #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1282    pub sale_rcncltn_id: Option<String>,
1283    #[serde(rename = "SeqNbRg", skip_serializing_if = "Option::is_none")]
1284    pub seq_nb_rg: Option<CardSequenceNumberRange11>,
1285    #[serde(rename = "TxDtRg", skip_serializing_if = "Option::is_none")]
1286    pub tx_dt_rg: Option<DateOrDateTimePeriod1Choice1>,
1287}
1288
1289impl Validate for CardAggregated21 {
1290    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1291        if let Some(ref val) = self.addtl_svc
1292            && config.validate_optional_fields
1293        {
1294            val.validate(&helpers::child_path(path, "AddtlSvc"), config, collector);
1295        }
1296        if let Some(ref val) = self.tx_ctgy {
1297            helpers::validate_length(
1298                val,
1299                "TxCtgy",
1300                Some(1),
1301                Some(4),
1302                &helpers::child_path(path, "TxCtgy"),
1303                config,
1304                collector,
1305            );
1306        }
1307        if let Some(ref val) = self.sale_rcncltn_id {
1308            helpers::validate_length(
1309                val,
1310                "SaleRcncltnId",
1311                Some(1),
1312                Some(35),
1313                &helpers::child_path(path, "SaleRcncltnId"),
1314                config,
1315                collector,
1316            );
1317        }
1318        if let Some(ref val) = self.sale_rcncltn_id {
1319            helpers::validate_pattern(
1320                val,
1321                "SaleRcncltnId",
1322                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1323                &helpers::child_path(path, "SaleRcncltnId"),
1324                config,
1325                collector,
1326            );
1327        }
1328        if let Some(ref val) = self.seq_nb_rg
1329            && config.validate_optional_fields
1330        {
1331            val.validate(&helpers::child_path(path, "SeqNbRg"), config, collector);
1332        }
1333        if let Some(ref val) = self.tx_dt_rg
1334            && config.validate_optional_fields
1335        {
1336            val.validate(&helpers::child_path(path, "TxDtRg"), config, collector);
1337        }
1338    }
1339}
1340
1341// CardDataReading1Code: Contactless proximity reader, with application conform to the standard EMV (standard initiated by Europay, Mastercard and Visa).
1342#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1343pub enum CardDataReading1Code {
1344    #[default]
1345    #[serde(rename = "TAGC")]
1346    CodeTAGC,
1347    #[serde(rename = "PHYS")]
1348    CodePHYS,
1349    #[serde(rename = "BRCD")]
1350    CodeBRCD,
1351    #[serde(rename = "MGST")]
1352    CodeMGST,
1353    #[serde(rename = "CICC")]
1354    CodeCICC,
1355    #[serde(rename = "DFLE")]
1356    CodeDFLE,
1357    #[serde(rename = "CTLS")]
1358    CodeCTLS,
1359    #[serde(rename = "ECTL")]
1360    CodeECTL,
1361}
1362
1363impl Validate for CardDataReading1Code {
1364    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1365        // Enum validation is typically empty
1366    }
1367}
1368
1369// CardEntry41: Prepaid account for the transfer or loading of an amount of money.
1370#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1371pub struct CardEntry41 {
1372    #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1373    pub card: Option<PaymentCard41>,
1374    #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1375    pub poi: Option<PointOfInteraction11>,
1376    #[serde(rename = "AggtdNtry", skip_serializing_if = "Option::is_none")]
1377    pub aggtd_ntry: Option<CardAggregated21>,
1378    #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1379    pub pre_pd_acct: Option<CashAccount382>,
1380}
1381
1382impl Validate for CardEntry41 {
1383    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1384        if let Some(ref val) = self.card
1385            && config.validate_optional_fields
1386        {
1387            val.validate(&helpers::child_path(path, "Card"), config, collector);
1388        }
1389        if let Some(ref val) = self.poi
1390            && config.validate_optional_fields
1391        {
1392            val.validate(&helpers::child_path(path, "POI"), config, collector);
1393        }
1394        if let Some(ref val) = self.aggtd_ntry
1395            && config.validate_optional_fields
1396        {
1397            val.validate(&helpers::child_path(path, "AggtdNtry"), config, collector);
1398        }
1399        if let Some(ref val) = self.pre_pd_acct
1400            && config.validate_optional_fields
1401        {
1402            val.validate(&helpers::child_path(path, "PrePdAcct"), config, collector);
1403        }
1404    }
1405}
1406
1407// CardIndividualTransaction21: Sequential number of the validation of the cash deposit.
1408// Usage: The sequential number is increased incrementally for each transaction.
1409#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1410pub struct CardIndividualTransaction21 {
1411    #[serde(rename = "ICCRltdData", skip_serializing_if = "Option::is_none")]
1412    pub icc_rltd_data: Option<String>,
1413    #[serde(rename = "PmtCntxt", skip_serializing_if = "Option::is_none")]
1414    pub pmt_cntxt: Option<PaymentContext3>,
1415    #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1416    pub addtl_svc: Option<CardPaymentServiceType2Code>,
1417    #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1418    pub tx_ctgy: Option<String>,
1419    #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1420    pub sale_rcncltn_id: Option<String>,
1421    #[serde(rename = "SaleRefNb", skip_serializing_if = "Option::is_none")]
1422    pub sale_ref_nb: Option<String>,
1423    #[serde(rename = "RePresntmntRsn", skip_serializing_if = "Option::is_none")]
1424    pub re_presntmnt_rsn: Option<String>,
1425    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
1426    pub seq_nb: Option<String>,
1427    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
1428    pub tx_id: Option<TransactionIdentifier11>,
1429    #[serde(rename = "Pdct", skip_serializing_if = "Option::is_none")]
1430    pub pdct: Option<Product21>,
1431    #[serde(rename = "VldtnDt", skip_serializing_if = "Option::is_none")]
1432    pub vldtn_dt: Option<String>,
1433    #[serde(rename = "VldtnSeqNb", skip_serializing_if = "Option::is_none")]
1434    pub vldtn_seq_nb: Option<String>,
1435}
1436
1437impl Validate for CardIndividualTransaction21 {
1438    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1439        if let Some(ref val) = self.icc_rltd_data {
1440            helpers::validate_length(
1441                val,
1442                "ICCRltdData",
1443                Some(1),
1444                Some(1025),
1445                &helpers::child_path(path, "ICCRltdData"),
1446                config,
1447                collector,
1448            );
1449        }
1450        if let Some(ref val) = self.icc_rltd_data {
1451            helpers::validate_pattern(
1452                val,
1453                "ICCRltdData",
1454                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1455                &helpers::child_path(path, "ICCRltdData"),
1456                config,
1457                collector,
1458            );
1459        }
1460        if let Some(ref val) = self.pmt_cntxt
1461            && config.validate_optional_fields
1462        {
1463            val.validate(&helpers::child_path(path, "PmtCntxt"), config, collector);
1464        }
1465        if let Some(ref val) = self.addtl_svc
1466            && config.validate_optional_fields
1467        {
1468            val.validate(&helpers::child_path(path, "AddtlSvc"), config, collector);
1469        }
1470        if let Some(ref val) = self.tx_ctgy {
1471            helpers::validate_length(
1472                val,
1473                "TxCtgy",
1474                Some(1),
1475                Some(4),
1476                &helpers::child_path(path, "TxCtgy"),
1477                config,
1478                collector,
1479            );
1480        }
1481        if let Some(ref val) = self.sale_rcncltn_id {
1482            helpers::validate_length(
1483                val,
1484                "SaleRcncltnId",
1485                Some(1),
1486                Some(35),
1487                &helpers::child_path(path, "SaleRcncltnId"),
1488                config,
1489                collector,
1490            );
1491        }
1492        if let Some(ref val) = self.sale_rcncltn_id {
1493            helpers::validate_pattern(
1494                val,
1495                "SaleRcncltnId",
1496                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1497                &helpers::child_path(path, "SaleRcncltnId"),
1498                config,
1499                collector,
1500            );
1501        }
1502        if let Some(ref val) = self.sale_ref_nb {
1503            helpers::validate_length(
1504                val,
1505                "SaleRefNb",
1506                Some(1),
1507                Some(35),
1508                &helpers::child_path(path, "SaleRefNb"),
1509                config,
1510                collector,
1511            );
1512        }
1513        if let Some(ref val) = self.sale_ref_nb {
1514            helpers::validate_pattern(
1515                val,
1516                "SaleRefNb",
1517                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1518                &helpers::child_path(path, "SaleRefNb"),
1519                config,
1520                collector,
1521            );
1522        }
1523        if let Some(ref val) = self.re_presntmnt_rsn {
1524            helpers::validate_length(
1525                val,
1526                "RePresntmntRsn",
1527                Some(1),
1528                Some(4),
1529                &helpers::child_path(path, "RePresntmntRsn"),
1530                config,
1531                collector,
1532            );
1533        }
1534        if let Some(ref val) = self.seq_nb {
1535            helpers::validate_length(
1536                val,
1537                "SeqNb",
1538                Some(1),
1539                Some(35),
1540                &helpers::child_path(path, "SeqNb"),
1541                config,
1542                collector,
1543            );
1544        }
1545        if let Some(ref val) = self.seq_nb {
1546            helpers::validate_pattern(
1547                val,
1548                "SeqNb",
1549                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1550                &helpers::child_path(path, "SeqNb"),
1551                config,
1552                collector,
1553            );
1554        }
1555        if let Some(ref val) = self.tx_id
1556            && config.validate_optional_fields
1557        {
1558            val.validate(&helpers::child_path(path, "TxId"), config, collector);
1559        }
1560        if let Some(ref val) = self.pdct
1561            && config.validate_optional_fields
1562        {
1563            val.validate(&helpers::child_path(path, "Pdct"), config, collector);
1564        }
1565        if let Some(ref val) = self.vldtn_seq_nb {
1566            helpers::validate_length(
1567                val,
1568                "VldtnSeqNb",
1569                Some(1),
1570                Some(35),
1571                &helpers::child_path(path, "VldtnSeqNb"),
1572                config,
1573                collector,
1574            );
1575        }
1576        if let Some(ref val) = self.vldtn_seq_nb {
1577            helpers::validate_pattern(
1578                val,
1579                "VldtnSeqNb",
1580                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1581                &helpers::child_path(path, "VldtnSeqNb"),
1582                config,
1583                collector,
1584            );
1585        }
1586    }
1587}
1588
1589// CardPaymentServiceType2Code: Voice authorisation.
1590#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1591pub enum CardPaymentServiceType2Code {
1592    #[default]
1593    #[serde(rename = "AGGR")]
1594    CodeAGGR,
1595    #[serde(rename = "DCCV")]
1596    CodeDCCV,
1597    #[serde(rename = "GRTT")]
1598    CodeGRTT,
1599    #[serde(rename = "INSP")]
1600    CodeINSP,
1601    #[serde(rename = "LOYT")]
1602    CodeLOYT,
1603    #[serde(rename = "NRES")]
1604    CodeNRES,
1605    #[serde(rename = "PUCO")]
1606    CodePUCO,
1607    #[serde(rename = "RECP")]
1608    CodeRECP,
1609    #[serde(rename = "SOAF")]
1610    CodeSOAF,
1611    #[serde(rename = "UNAF")]
1612    CodeUNAF,
1613    #[serde(rename = "VCAU")]
1614    CodeVCAU,
1615}
1616
1617impl Validate for CardPaymentServiceType2Code {
1618    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1619        // Enum validation is typically empty
1620    }
1621}
1622
1623// CardSecurityInformation1: Card security code (CSC).
1624#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1625pub struct CardSecurityInformation1 {
1626    #[serde(rename = "CSCMgmt")]
1627    pub csc_mgmt: CSCManagement1Code,
1628    #[serde(rename = "CSCVal", skip_serializing_if = "Option::is_none")]
1629    pub csc_val: Option<String>,
1630}
1631
1632impl Validate for CardSecurityInformation1 {
1633    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1634        self.csc_mgmt
1635            .validate(&helpers::child_path(path, "CSCMgmt"), config, collector);
1636        if let Some(ref val) = self.csc_val {
1637            helpers::validate_pattern(
1638                val,
1639                "CSCVal",
1640                "[0-9]{3,4}",
1641                &helpers::child_path(path, "CSCVal"),
1642                config,
1643                collector,
1644            );
1645        }
1646    }
1647}
1648
1649// CardSequenceNumberRange11: CardSequenceNumberRange1: LastTransactionSequenceNumberMessage element to be finalised once feedback from Card SEG has been received.
1650#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1651pub struct CardSequenceNumberRange11 {
1652    #[serde(rename = "FrstTx", skip_serializing_if = "Option::is_none")]
1653    pub frst_tx: Option<String>,
1654    #[serde(rename = "LastTx", skip_serializing_if = "Option::is_none")]
1655    pub last_tx: Option<String>,
1656}
1657
1658impl Validate for CardSequenceNumberRange11 {
1659    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1660        if let Some(ref val) = self.frst_tx {
1661            helpers::validate_length(
1662                val,
1663                "FrstTx",
1664                Some(1),
1665                Some(35),
1666                &helpers::child_path(path, "FrstTx"),
1667                config,
1668                collector,
1669            );
1670        }
1671        if let Some(ref val) = self.frst_tx {
1672            helpers::validate_pattern(
1673                val,
1674                "FrstTx",
1675                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1676                &helpers::child_path(path, "FrstTx"),
1677                config,
1678                collector,
1679            );
1680        }
1681        if let Some(ref val) = self.last_tx {
1682            helpers::validate_length(
1683                val,
1684                "LastTx",
1685                Some(1),
1686                Some(35),
1687                &helpers::child_path(path, "LastTx"),
1688                config,
1689                collector,
1690            );
1691        }
1692        if let Some(ref val) = self.last_tx {
1693            helpers::validate_pattern(
1694                val,
1695                "LastTx",
1696                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1697                &helpers::child_path(path, "LastTx"),
1698                config,
1699                collector,
1700            );
1701        }
1702    }
1703}
1704
1705// CardTransaction171: Prepaid account for the transfer or loading of an amount of money.
1706#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1707pub struct CardTransaction171 {
1708    #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1709    pub card: Option<PaymentCard41>,
1710    #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1711    pub poi: Option<PointOfInteraction11>,
1712    #[serde(rename = "Tx", skip_serializing_if = "Option::is_none")]
1713    pub tx: Option<CardTransaction3Choice1>,
1714    #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1715    pub pre_pd_acct: Option<CashAccount384>,
1716}
1717
1718impl Validate for CardTransaction171 {
1719    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1720        if let Some(ref val) = self.card
1721            && config.validate_optional_fields
1722        {
1723            val.validate(&helpers::child_path(path, "Card"), config, collector);
1724        }
1725        if let Some(ref val) = self.poi
1726            && config.validate_optional_fields
1727        {
1728            val.validate(&helpers::child_path(path, "POI"), config, collector);
1729        }
1730        if let Some(ref val) = self.tx
1731            && config.validate_optional_fields
1732        {
1733            val.validate(&helpers::child_path(path, "Tx"), config, collector);
1734        }
1735        if let Some(ref val) = self.pre_pd_acct
1736            && config.validate_optional_fields
1737        {
1738            val.validate(&helpers::child_path(path, "PrePdAcct"), config, collector);
1739        }
1740    }
1741}
1742
1743// CardTransaction3Choice1: Card transaction details for the individual transaction, as recorded at the POI (point of interaction).
1744#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1745pub struct CardTransaction3Choice1 {
1746    #[serde(rename = "Aggtd", skip_serializing_if = "Option::is_none")]
1747    pub aggtd: Option<CardAggregated21>,
1748    #[serde(rename = "Indv", skip_serializing_if = "Option::is_none")]
1749    pub indv: Option<CardIndividualTransaction21>,
1750}
1751
1752impl Validate for CardTransaction3Choice1 {
1753    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1754        if let Some(ref val) = self.aggtd
1755            && config.validate_optional_fields
1756        {
1757            val.validate(&helpers::child_path(path, "Aggtd"), config, collector);
1758        }
1759        if let Some(ref val) = self.indv
1760            && config.validate_optional_fields
1761        {
1762            val.validate(&helpers::child_path(path, "Indv"), config, collector);
1763        }
1764    }
1765}
1766
1767// CardholderAuthentication2: Entity or object in charge of verifying the cardholder authenticity.
1768#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1769pub struct CardholderAuthentication2 {
1770    #[serde(rename = "AuthntcnMtd")]
1771    pub authntcn_mtd: AuthenticationMethod1Code,
1772    #[serde(rename = "AuthntcnNtty")]
1773    pub authntcn_ntty: AuthenticationEntity1Code,
1774}
1775
1776impl Validate for CardholderAuthentication2 {
1777    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1778        self.authntcn_mtd
1779            .validate(&helpers::child_path(path, "AuthntcnMtd"), config, collector);
1780        self.authntcn_ntty.validate(
1781            &helpers::child_path(path, "AuthntcnNtty"),
1782            config,
1783            collector,
1784        );
1785    }
1786}
1787
1788// CardholderVerificationCapability1Code: Three domain secure (three domain secure authentication of the cardholder).
1789#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1790pub enum CardholderVerificationCapability1Code {
1791    #[default]
1792    #[serde(rename = "MNSG")]
1793    CodeMNSG,
1794    #[serde(rename = "NPIN")]
1795    CodeNPIN,
1796    #[serde(rename = "FCPN")]
1797    CodeFCPN,
1798    #[serde(rename = "FEPN")]
1799    CodeFEPN,
1800    #[serde(rename = "FDSG")]
1801    CodeFDSG,
1802    #[serde(rename = "FBIO")]
1803    CodeFBIO,
1804    #[serde(rename = "MNVR")]
1805    CodeMNVR,
1806    #[serde(rename = "FBIG")]
1807    CodeFBIG,
1808    #[serde(rename = "APKI")]
1809    CodeAPKI,
1810    #[serde(rename = "PKIS")]
1811    CodePKIS,
1812    #[serde(rename = "CHDT")]
1813    CodeCHDT,
1814    #[serde(rename = "SCEC")]
1815    CodeSCEC,
1816}
1817
1818impl Validate for CardholderVerificationCapability1Code {
1819    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1820        // Enum validation is typically empty
1821    }
1822}
1823
1824// CashAccount381: Specifies an alternate assumed name for the identification of the account.
1825#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1826pub struct CashAccount381 {
1827    #[serde(rename = "Id")]
1828    pub id: AccountIdentification4Choice1,
1829    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1830    pub tp: Option<CashAccountType2Choice1>,
1831    #[serde(rename = "Ccy")]
1832    pub ccy: String,
1833    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1834    pub nm: Option<String>,
1835    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1836    pub prxy: Option<ProxyAccountIdentification11>,
1837}
1838
1839impl Validate for CashAccount381 {
1840    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1841        self.id
1842            .validate(&helpers::child_path(path, "Id"), config, collector);
1843        if let Some(ref val) = self.tp
1844            && config.validate_optional_fields
1845        {
1846            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1847        }
1848        helpers::validate_pattern(
1849            &self.ccy,
1850            "Ccy",
1851            "[A-Z]{3,3}",
1852            &helpers::child_path(path, "Ccy"),
1853            config,
1854            collector,
1855        );
1856        if let Some(ref val) = self.nm {
1857            helpers::validate_length(
1858                val,
1859                "Nm",
1860                Some(1),
1861                Some(70),
1862                &helpers::child_path(path, "Nm"),
1863                config,
1864                collector,
1865            );
1866        }
1867        if let Some(ref val) = self.nm {
1868            helpers::validate_pattern(
1869                val,
1870                "Nm",
1871                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1872                &helpers::child_path(path, "Nm"),
1873                config,
1874                collector,
1875            );
1876        }
1877        if let Some(ref val) = self.prxy
1878            && config.validate_optional_fields
1879        {
1880            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
1881        }
1882    }
1883}
1884
1885// CashAccount382: Specifies an alternate assumed name for the identification of the account.
1886#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1887pub struct CashAccount382 {
1888    #[serde(rename = "Id")]
1889    pub id: AccountIdentification4Choice1,
1890    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1891    pub tp: Option<CashAccountType2Choice1>,
1892    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1893    pub ccy: Option<String>,
1894    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1895    pub nm: Option<String>,
1896    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1897    pub prxy: Option<ProxyAccountIdentification12>,
1898}
1899
1900impl Validate for CashAccount382 {
1901    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1902        self.id
1903            .validate(&helpers::child_path(path, "Id"), config, collector);
1904        if let Some(ref val) = self.tp
1905            && config.validate_optional_fields
1906        {
1907            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1908        }
1909        if let Some(ref val) = self.ccy {
1910            helpers::validate_pattern(
1911                val,
1912                "Ccy",
1913                "[A-Z]{3,3}",
1914                &helpers::child_path(path, "Ccy"),
1915                config,
1916                collector,
1917            );
1918        }
1919        if let Some(ref val) = self.nm {
1920            helpers::validate_length(
1921                val,
1922                "Nm",
1923                Some(1),
1924                Some(70),
1925                &helpers::child_path(path, "Nm"),
1926                config,
1927                collector,
1928            );
1929        }
1930        if let Some(ref val) = self.nm {
1931            helpers::validate_pattern(
1932                val,
1933                "Nm",
1934                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1935                &helpers::child_path(path, "Nm"),
1936                config,
1937                collector,
1938            );
1939        }
1940        if let Some(ref val) = self.prxy
1941            && config.validate_optional_fields
1942        {
1943            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
1944        }
1945    }
1946}
1947
1948// CashAccount383: Specifies an alternate assumed name for the identification of the account.
1949#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1950pub struct CashAccount383 {
1951    #[serde(rename = "Id")]
1952    pub id: AccountIdentification4Choice1,
1953    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1954    pub tp: Option<CashAccountType2Choice1>,
1955    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1956    pub ccy: Option<String>,
1957    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1958    pub nm: Option<String>,
1959    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1960    pub prxy: Option<ProxyAccountIdentification13>,
1961}
1962
1963impl Validate for CashAccount383 {
1964    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1965        self.id
1966            .validate(&helpers::child_path(path, "Id"), config, collector);
1967        if let Some(ref val) = self.tp
1968            && config.validate_optional_fields
1969        {
1970            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1971        }
1972        if let Some(ref val) = self.ccy {
1973            helpers::validate_pattern(
1974                val,
1975                "Ccy",
1976                "[A-Z]{3,3}",
1977                &helpers::child_path(path, "Ccy"),
1978                config,
1979                collector,
1980            );
1981        }
1982        if let Some(ref val) = self.nm {
1983            helpers::validate_length(
1984                val,
1985                "Nm",
1986                Some(1),
1987                Some(70),
1988                &helpers::child_path(path, "Nm"),
1989                config,
1990                collector,
1991            );
1992        }
1993        if let Some(ref val) = self.nm {
1994            helpers::validate_pattern(
1995                val,
1996                "Nm",
1997                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1998                &helpers::child_path(path, "Nm"),
1999                config,
2000                collector,
2001            );
2002        }
2003        if let Some(ref val) = self.prxy
2004            && config.validate_optional_fields
2005        {
2006            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2007        }
2008    }
2009}
2010
2011// CashAccount384: Specifies an alternate assumed name for the identification of the account.
2012#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2013pub struct CashAccount384 {
2014    #[serde(rename = "Id")]
2015    pub id: AccountIdentification4Choice1,
2016    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2017    pub tp: Option<CashAccountType2Choice1>,
2018    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
2019    pub ccy: Option<String>,
2020    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2021    pub nm: Option<String>,
2022    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
2023    pub prxy: Option<ProxyAccountIdentification11>,
2024}
2025
2026impl Validate for CashAccount384 {
2027    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2028        self.id
2029            .validate(&helpers::child_path(path, "Id"), config, collector);
2030        if let Some(ref val) = self.tp
2031            && config.validate_optional_fields
2032        {
2033            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2034        }
2035        if let Some(ref val) = self.ccy {
2036            helpers::validate_pattern(
2037                val,
2038                "Ccy",
2039                "[A-Z]{3,3}",
2040                &helpers::child_path(path, "Ccy"),
2041                config,
2042                collector,
2043            );
2044        }
2045        if let Some(ref val) = self.nm {
2046            helpers::validate_length(
2047                val,
2048                "Nm",
2049                Some(1),
2050                Some(70),
2051                &helpers::child_path(path, "Nm"),
2052                config,
2053                collector,
2054            );
2055        }
2056        if let Some(ref val) = self.nm {
2057            helpers::validate_pattern(
2058                val,
2059                "Nm",
2060                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2061                &helpers::child_path(path, "Nm"),
2062                config,
2063                collector,
2064            );
2065        }
2066        if let Some(ref val) = self.prxy
2067            && config.validate_optional_fields
2068        {
2069            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2070        }
2071    }
2072}
2073
2074// 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.
2075#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2076pub struct CashAccount391 {
2077    #[serde(rename = "Id")]
2078    pub id: AccountIdentification4Choice1,
2079    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2080    pub tp: Option<CashAccountType2Choice1>,
2081    #[serde(rename = "Ccy")]
2082    pub ccy: String,
2083    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2084    pub nm: Option<String>,
2085    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
2086    pub prxy: Option<ProxyAccountIdentification11>,
2087    #[serde(rename = "Ownr", skip_serializing_if = "Option::is_none")]
2088    pub ownr: Option<PartyIdentification1352>,
2089    #[serde(rename = "Svcr", skip_serializing_if = "Option::is_none")]
2090    pub svcr: Option<BranchAndFinancialInstitutionIdentification61>,
2091}
2092
2093impl Validate for CashAccount391 {
2094    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2095        self.id
2096            .validate(&helpers::child_path(path, "Id"), config, collector);
2097        if let Some(ref val) = self.tp
2098            && config.validate_optional_fields
2099        {
2100            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2101        }
2102        helpers::validate_pattern(
2103            &self.ccy,
2104            "Ccy",
2105            "[A-Z]{3,3}",
2106            &helpers::child_path(path, "Ccy"),
2107            config,
2108            collector,
2109        );
2110        if let Some(ref val) = self.nm {
2111            helpers::validate_length(
2112                val,
2113                "Nm",
2114                Some(1),
2115                Some(70),
2116                &helpers::child_path(path, "Nm"),
2117                config,
2118                collector,
2119            );
2120        }
2121        if let Some(ref val) = self.nm {
2122            helpers::validate_pattern(
2123                val,
2124                "Nm",
2125                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2126                &helpers::child_path(path, "Nm"),
2127                config,
2128                collector,
2129            );
2130        }
2131        if let Some(ref val) = self.prxy
2132            && config.validate_optional_fields
2133        {
2134            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2135        }
2136        if let Some(ref val) = self.ownr
2137            && config.validate_optional_fields
2138        {
2139            val.validate(&helpers::child_path(path, "Ownr"), config, collector);
2140        }
2141        if let Some(ref val) = self.svcr
2142            && config.validate_optional_fields
2143        {
2144            val.validate(&helpers::child_path(path, "Svcr"), config, collector);
2145        }
2146    }
2147}
2148
2149// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
2150#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2151pub struct CashAccountType2Choice1 {
2152    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2153    pub cd: Option<String>,
2154    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2155    pub prtry: Option<String>,
2156}
2157
2158impl Validate for CashAccountType2Choice1 {
2159    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2160        if let Some(ref val) = self.cd {
2161            helpers::validate_length(
2162                val,
2163                "Cd",
2164                Some(1),
2165                Some(4),
2166                &helpers::child_path(path, "Cd"),
2167                config,
2168                collector,
2169            );
2170        }
2171        if let Some(ref val) = self.prtry {
2172            helpers::validate_length(
2173                val,
2174                "Prtry",
2175                Some(1),
2176                Some(35),
2177                &helpers::child_path(path, "Prtry"),
2178                config,
2179                collector,
2180            );
2181        }
2182        if let Some(ref val) = self.prtry {
2183            helpers::validate_pattern(
2184                val,
2185                "Prtry",
2186                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2187                &helpers::child_path(path, "Prtry"),
2188                config,
2189                collector,
2190            );
2191        }
2192    }
2193}
2194
2195// CashAvailability1: Indicates whether the availability balance is a credit or a debit balance.
2196// Usage: A zero balance is considered to be a credit balance.
2197#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2198pub struct CashAvailability1 {
2199    #[serde(rename = "Dt")]
2200    pub dt: CashAvailabilityDate1Choice,
2201    #[serde(rename = "Amt")]
2202    pub amt: ActiveOrHistoricCurrencyAndAmount,
2203    #[serde(rename = "CdtDbtInd")]
2204    pub cdt_dbt_ind: CreditDebitCode,
2205}
2206
2207impl Validate for CashAvailability1 {
2208    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2209        self.dt
2210            .validate(&helpers::child_path(path, "Dt"), config, collector);
2211        self.amt
2212            .validate(&helpers::child_path(path, "Amt"), config, collector);
2213        self.cdt_dbt_ind
2214            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2215    }
2216}
2217
2218// CashAvailabilityDate1Choice: Identifies the actual availability date.
2219#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2220pub struct CashAvailabilityDate1Choice {
2221    #[serde(rename = "NbOfDays", skip_serializing_if = "Option::is_none")]
2222    pub nb_of_days: Option<String>,
2223    #[serde(rename = "ActlDt", skip_serializing_if = "Option::is_none")]
2224    pub actl_dt: Option<String>,
2225}
2226
2227impl Validate for CashAvailabilityDate1Choice {
2228    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2229        if let Some(ref val) = self.nb_of_days {
2230            helpers::validate_pattern(
2231                val,
2232                "NbOfDays",
2233                "[\\+]{0,1}[0-9]{1,15}",
2234                &helpers::child_path(path, "NbOfDays"),
2235                config,
2236                collector,
2237            );
2238        }
2239    }
2240}
2241
2242// CashDeposit1: Specifies the total amount of money in the cash deposit, that is the note denomination times the number of notes.
2243#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2244pub struct CashDeposit1 {
2245    #[serde(rename = "NoteDnmtn")]
2246    pub note_dnmtn: ActiveCurrencyAndAmount,
2247    #[serde(rename = "NbOfNotes")]
2248    pub nb_of_notes: String,
2249    #[serde(rename = "Amt")]
2250    pub amt: ActiveCurrencyAndAmount,
2251}
2252
2253impl Validate for CashDeposit1 {
2254    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2255        self.note_dnmtn
2256            .validate(&helpers::child_path(path, "NoteDnmtn"), config, collector);
2257        helpers::validate_pattern(
2258            &self.nb_of_notes,
2259            "NbOfNotes",
2260            "[0-9]{1,15}",
2261            &helpers::child_path(path, "NbOfNotes"),
2262            config,
2263            collector,
2264        );
2265        self.amt
2266            .validate(&helpers::child_path(path, "Amt"), config, collector);
2267    }
2268}
2269
2270// ChargeBearerType1Code: Charges are to be applied following the rules agreed in the service level and/or scheme.
2271#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2272pub enum ChargeBearerType1Code {
2273    #[default]
2274    #[serde(rename = "DEBT")]
2275    CodeDEBT,
2276    #[serde(rename = "CRED")]
2277    CodeCRED,
2278    #[serde(rename = "SHAR")]
2279    CodeSHAR,
2280    #[serde(rename = "SLEV")]
2281    CodeSLEV,
2282}
2283
2284impl Validate for ChargeBearerType1Code {
2285    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2286        // Enum validation is typically empty
2287    }
2288}
2289
2290// ChargeType3Choice1: Type of charge in a proprietary form, as defined by the issuer.
2291#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2292pub struct ChargeType3Choice1 {
2293    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2294    pub cd: Option<String>,
2295    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2296    pub prtry: Option<GenericIdentification31>,
2297}
2298
2299impl Validate for ChargeType3Choice1 {
2300    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2301        if let Some(ref val) = self.cd {
2302            helpers::validate_length(
2303                val,
2304                "Cd",
2305                Some(1),
2306                Some(4),
2307                &helpers::child_path(path, "Cd"),
2308                config,
2309                collector,
2310            );
2311        }
2312        if let Some(ref val) = self.prtry
2313            && config.validate_optional_fields
2314        {
2315            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
2316        }
2317    }
2318}
2319
2320// Charges61: Provides details of the individual charges record.
2321#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2322pub struct Charges61 {
2323    #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2324    pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2325    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2326    pub rcrd: Option<Vec<ChargesRecord31>>,
2327}
2328
2329impl Validate for Charges61 {
2330    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2331        if let Some(ref val) = self.ttl_chrgs_and_tax_amt
2332            && config.validate_optional_fields
2333        {
2334            val.validate(
2335                &helpers::child_path(path, "TtlChrgsAndTaxAmt"),
2336                config,
2337                collector,
2338            );
2339        }
2340        if let Some(ref vec) = self.rcrd
2341            && config.validate_optional_fields
2342        {
2343            for item in vec {
2344                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
2345            }
2346        }
2347    }
2348}
2349
2350// Charges62: Provides details of the individual charges record.
2351#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2352pub struct Charges62 {
2353    #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2354    pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2355    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2356    pub rcrd: Option<Vec<ChargesRecord32>>,
2357}
2358
2359impl Validate for Charges62 {
2360    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2361        if let Some(ref val) = self.ttl_chrgs_and_tax_amt
2362            && config.validate_optional_fields
2363        {
2364            val.validate(
2365                &helpers::child_path(path, "TtlChrgsAndTaxAmt"),
2366                config,
2367                collector,
2368            );
2369        }
2370        if let Some(ref vec) = self.rcrd
2371            && config.validate_optional_fields
2372        {
2373            for item in vec {
2374                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
2375            }
2376        }
2377    }
2378}
2379
2380// ChargesRecord31: Provides details on the tax applied to charges.
2381#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2382pub struct ChargesRecord31 {
2383    #[serde(rename = "Amt")]
2384    pub amt: ActiveOrHistoricCurrencyAndAmount,
2385    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2386    pub cdt_dbt_ind: Option<CreditDebitCode>,
2387    #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2388    pub chrg_incl_ind: Option<bool>,
2389    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2390    pub tp: Option<ChargeType3Choice1>,
2391    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2392    pub rate: Option<f64>,
2393    #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2394    pub br: Option<ChargeBearerType1Code>,
2395    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2396    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
2397    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2398    pub tax: Option<TaxCharges21>,
2399}
2400
2401impl Validate for ChargesRecord31 {
2402    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2403        self.amt
2404            .validate(&helpers::child_path(path, "Amt"), config, collector);
2405        if let Some(ref val) = self.cdt_dbt_ind
2406            && config.validate_optional_fields
2407        {
2408            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2409        }
2410        if let Some(ref val) = self.tp
2411            && config.validate_optional_fields
2412        {
2413            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2414        }
2415        if let Some(ref val) = self.br
2416            && config.validate_optional_fields
2417        {
2418            val.validate(&helpers::child_path(path, "Br"), config, collector);
2419        }
2420        if let Some(ref val) = self.agt
2421            && config.validate_optional_fields
2422        {
2423            val.validate(&helpers::child_path(path, "Agt"), config, collector);
2424        }
2425        if let Some(ref val) = self.tax
2426            && config.validate_optional_fields
2427        {
2428            val.validate(&helpers::child_path(path, "Tax"), config, collector);
2429        }
2430    }
2431}
2432
2433// ChargesRecord32: Provides details on the tax applied to charges.
2434#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2435pub struct ChargesRecord32 {
2436    #[serde(rename = "Amt")]
2437    pub amt: ActiveOrHistoricCurrencyAndAmount,
2438    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2439    pub cdt_dbt_ind: Option<CreditDebitCode>,
2440    #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2441    pub chrg_incl_ind: Option<bool>,
2442    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2443    pub tp: Option<ChargeType3Choice1>,
2444    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2445    pub rate: Option<f64>,
2446    #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2447    pub br: Option<ChargeBearerType1Code>,
2448    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2449    pub agt: Option<BranchAndFinancialInstitutionIdentification63>,
2450    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2451    pub tax: Option<TaxCharges21>,
2452}
2453
2454impl Validate for ChargesRecord32 {
2455    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2456        self.amt
2457            .validate(&helpers::child_path(path, "Amt"), config, collector);
2458        if let Some(ref val) = self.cdt_dbt_ind
2459            && config.validate_optional_fields
2460        {
2461            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2462        }
2463        if let Some(ref val) = self.tp
2464            && config.validate_optional_fields
2465        {
2466            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2467        }
2468        if let Some(ref val) = self.br
2469            && config.validate_optional_fields
2470        {
2471            val.validate(&helpers::child_path(path, "Br"), config, collector);
2472        }
2473        if let Some(ref val) = self.agt
2474            && config.validate_optional_fields
2475        {
2476            val.validate(&helpers::child_path(path, "Agt"), config, collector);
2477        }
2478        if let Some(ref val) = self.tax
2479            && config.validate_optional_fields
2480        {
2481            val.validate(&helpers::child_path(path, "Tax"), config, collector);
2482        }
2483    }
2484}
2485
2486// ClearingSystemIdentification2Choice: Identification code for a clearing system, that has not yet been identified in the list of clearing systems.
2487#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2488pub struct ClearingSystemIdentification2Choice {
2489    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2490    pub cd: Option<String>,
2491    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2492    pub prtry: Option<String>,
2493}
2494
2495impl Validate for ClearingSystemIdentification2Choice {
2496    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2497        if let Some(ref val) = self.cd {
2498            helpers::validate_length(
2499                val,
2500                "Cd",
2501                Some(1),
2502                Some(5),
2503                &helpers::child_path(path, "Cd"),
2504                config,
2505                collector,
2506            );
2507        }
2508        if let Some(ref val) = self.prtry {
2509            helpers::validate_length(
2510                val,
2511                "Prtry",
2512                Some(1),
2513                Some(35),
2514                &helpers::child_path(path, "Prtry"),
2515                config,
2516                collector,
2517            );
2518        }
2519    }
2520}
2521
2522// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
2523#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2524pub struct ClearingSystemIdentification2Choice1 {
2525    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2526    pub cd: Option<String>,
2527}
2528
2529impl Validate for ClearingSystemIdentification2Choice1 {
2530    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2531        if let Some(ref val) = self.cd {
2532            helpers::validate_length(
2533                val,
2534                "Cd",
2535                Some(1),
2536                Some(5),
2537                &helpers::child_path(path, "Cd"),
2538                config,
2539                collector,
2540            );
2541        }
2542    }
2543}
2544
2545// ClearingSystemIdentification2Choice2: Identification code for a clearing system, that has not yet been identified in the list of clearing systems.
2546#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2547pub struct ClearingSystemIdentification2Choice2 {
2548    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2549    pub cd: Option<String>,
2550    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2551    pub prtry: Option<String>,
2552}
2553
2554impl Validate for ClearingSystemIdentification2Choice2 {
2555    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2556        if let Some(ref val) = self.cd {
2557            helpers::validate_length(
2558                val,
2559                "Cd",
2560                Some(1),
2561                Some(5),
2562                &helpers::child_path(path, "Cd"),
2563                config,
2564                collector,
2565            );
2566        }
2567        if let Some(ref val) = self.prtry {
2568            helpers::validate_length(
2569                val,
2570                "Prtry",
2571                Some(1),
2572                Some(35),
2573                &helpers::child_path(path, "Prtry"),
2574                config,
2575                collector,
2576            );
2577        }
2578        if let Some(ref val) = self.prtry {
2579            helpers::validate_pattern(
2580                val,
2581                "Prtry",
2582                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2583                &helpers::child_path(path, "Prtry"),
2584                config,
2585                collector,
2586            );
2587        }
2588    }
2589}
2590
2591// ClearingSystemMemberIdentification2: Identification of a member of a clearing system.
2592#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2593pub struct ClearingSystemMemberIdentification2 {
2594    #[serde(rename = "ClrSysId", skip_serializing_if = "Option::is_none")]
2595    pub clr_sys_id: Option<ClearingSystemIdentification2Choice>,
2596    #[serde(rename = "MmbId")]
2597    pub mmb_id: String,
2598}
2599
2600impl Validate for ClearingSystemMemberIdentification2 {
2601    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2602        if let Some(ref val) = self.clr_sys_id
2603            && config.validate_optional_fields
2604        {
2605            val.validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2606        }
2607        helpers::validate_length(
2608            &self.mmb_id,
2609            "MmbId",
2610            Some(1),
2611            Some(35),
2612            &helpers::child_path(path, "MmbId"),
2613            config,
2614            collector,
2615        );
2616    }
2617}
2618
2619// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
2620#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2621pub struct ClearingSystemMemberIdentification21 {
2622    #[serde(rename = "ClrSysId")]
2623    pub clr_sys_id: ClearingSystemIdentification2Choice1,
2624    #[serde(rename = "MmbId")]
2625    pub mmb_id: String,
2626}
2627
2628impl Validate for ClearingSystemMemberIdentification21 {
2629    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2630        self.clr_sys_id
2631            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2632        helpers::validate_length(
2633            &self.mmb_id,
2634            "MmbId",
2635            Some(1),
2636            Some(28),
2637            &helpers::child_path(path, "MmbId"),
2638            config,
2639            collector,
2640        );
2641        helpers::validate_pattern(
2642            &self.mmb_id,
2643            "MmbId",
2644            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2645            &helpers::child_path(path, "MmbId"),
2646            config,
2647            collector,
2648        );
2649    }
2650}
2651
2652// ClearingSystemMemberIdentification22: Identification of a member of a clearing system.
2653#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2654pub struct ClearingSystemMemberIdentification22 {
2655    #[serde(rename = "ClrSysId")]
2656    pub clr_sys_id: ClearingSystemIdentification2Choice2,
2657    #[serde(rename = "MmbId")]
2658    pub mmb_id: String,
2659}
2660
2661impl Validate for ClearingSystemMemberIdentification22 {
2662    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2663        self.clr_sys_id
2664            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2665        helpers::validate_length(
2666            &self.mmb_id,
2667            "MmbId",
2668            Some(1),
2669            Some(28),
2670            &helpers::child_path(path, "MmbId"),
2671            config,
2672            collector,
2673        );
2674        helpers::validate_pattern(
2675            &self.mmb_id,
2676            "MmbId",
2677            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2678            &helpers::child_path(path, "MmbId"),
2679            config,
2680            collector,
2681        );
2682    }
2683}
2684
2685// Contact41: Name by which a party is known and which is usually used to identify that party.
2686#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2687pub struct Contact41 {
2688    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2689    pub nm: Option<String>,
2690}
2691
2692impl Validate for Contact41 {
2693    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2694        if let Some(ref val) = self.nm {
2695            helpers::validate_length(
2696                val,
2697                "Nm",
2698                Some(1),
2699                Some(140),
2700                &helpers::child_path(path, "Nm"),
2701                config,
2702                collector,
2703            );
2704        }
2705        if let Some(ref val) = self.nm {
2706            helpers::validate_pattern(
2707                val,
2708                "Nm",
2709                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2710                &helpers::child_path(path, "Nm"),
2711                config,
2712                collector,
2713            );
2714        }
2715    }
2716}
2717
2718// Contact42: Preferred method used to reach the contact.
2719#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2720pub struct Contact42 {
2721    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2722    pub nm: Option<String>,
2723    #[serde(rename = "PrefrdMtd", skip_serializing_if = "Option::is_none")]
2724    pub prefrd_mtd: Option<PreferredContactMethod1Code>,
2725}
2726
2727impl Validate for Contact42 {
2728    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2729        if let Some(ref val) = self.nm {
2730            helpers::validate_length(
2731                val,
2732                "Nm",
2733                Some(1),
2734                Some(140),
2735                &helpers::child_path(path, "Nm"),
2736                config,
2737                collector,
2738            );
2739        }
2740        if let Some(ref val) = self.nm {
2741            helpers::validate_pattern(
2742                val,
2743                "Nm",
2744                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2745                &helpers::child_path(path, "Nm"),
2746                config,
2747                collector,
2748            );
2749        }
2750        if let Some(ref val) = self.prefrd_mtd
2751            && config.validate_optional_fields
2752        {
2753            val.validate(&helpers::child_path(path, "PrefrdMtd"), config, collector);
2754        }
2755    }
2756}
2757
2758// Contact43: Name by which a party is known and which is usually used to identify that party.
2759#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2760pub struct Contact43 {
2761    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2762    pub nm: Option<String>,
2763}
2764
2765impl Validate for Contact43 {
2766    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2767        if let Some(ref val) = self.nm {
2768            helpers::validate_length(
2769                val,
2770                "Nm",
2771                Some(1),
2772                Some(140),
2773                &helpers::child_path(path, "Nm"),
2774                config,
2775                collector,
2776            );
2777        }
2778    }
2779}
2780
2781// CopyDuplicate1Code: Message is for information/confirmation purposes. It is a duplicate of a message previously sent.
2782#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2783pub enum CopyDuplicate1Code {
2784    #[default]
2785    #[serde(rename = "CODU")]
2786    CodeCODU,
2787    #[serde(rename = "COPY")]
2788    CodeCOPY,
2789    #[serde(rename = "DUPL")]
2790    CodeDUPL,
2791}
2792
2793impl Validate for CopyDuplicate1Code {
2794    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2795        // Enum validation is typically empty
2796    }
2797}
2798
2799// CorporateAction91: Identification of a corporate action assigned by an official central body/entity within a given market.
2800#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2801pub struct CorporateAction91 {
2802    #[serde(rename = "EvtTp")]
2803    pub evt_tp: String,
2804    #[serde(rename = "EvtId")]
2805    pub evt_id: String,
2806}
2807
2808impl Validate for CorporateAction91 {
2809    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2810        helpers::validate_length(
2811            &self.evt_tp,
2812            "EvtTp",
2813            Some(1),
2814            Some(35),
2815            &helpers::child_path(path, "EvtTp"),
2816            config,
2817            collector,
2818        );
2819        helpers::validate_pattern(
2820            &self.evt_tp,
2821            "EvtTp",
2822            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2823            &helpers::child_path(path, "EvtTp"),
2824            config,
2825            collector,
2826        );
2827        helpers::validate_length(
2828            &self.evt_id,
2829            "EvtId",
2830            Some(1),
2831            Some(35),
2832            &helpers::child_path(path, "EvtId"),
2833            config,
2834            collector,
2835        );
2836        helpers::validate_pattern(
2837            &self.evt_id,
2838            "EvtId",
2839            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2840            &helpers::child_path(path, "EvtId"),
2841            config,
2842            collector,
2843        );
2844    }
2845}
2846
2847// CreditDebitCode: Operation is a decrease.
2848#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2849pub enum CreditDebitCode {
2850    #[default]
2851    #[serde(rename = "CRDT")]
2852    CodeCRDT,
2853    #[serde(rename = "DBIT")]
2854    CodeDBIT,
2855}
2856
2857impl Validate for CreditDebitCode {
2858    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2859        // Enum validation is typically empty
2860    }
2861}
2862
2863// CreditorReferenceInformation21: Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction.
2864//
2865// 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.
2866//
2867// 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.
2868#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2869pub struct CreditorReferenceInformation21 {
2870    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2871    pub tp: Option<CreditorReferenceType21>,
2872    #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
2873    pub ref_attr: Option<String>,
2874}
2875
2876impl Validate for CreditorReferenceInformation21 {
2877    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2878        if let Some(ref val) = self.tp
2879            && config.validate_optional_fields
2880        {
2881            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2882        }
2883        if let Some(ref val) = self.ref_attr {
2884            helpers::validate_length(
2885                val,
2886                "Ref",
2887                Some(1),
2888                Some(35),
2889                &helpers::child_path(path, "Ref"),
2890                config,
2891                collector,
2892            );
2893        }
2894        if let Some(ref val) = self.ref_attr {
2895            helpers::validate_pattern(
2896                val,
2897                "Ref",
2898                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2899                &helpers::child_path(path, "Ref"),
2900                config,
2901                collector,
2902            );
2903        }
2904    }
2905}
2906
2907// CreditorReferenceType1Choice1: Creditor reference type, in a proprietary form.
2908#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2909pub struct CreditorReferenceType1Choice1 {
2910    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2911    pub cd: Option<DocumentType3Code>,
2912    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2913    pub prtry: Option<String>,
2914}
2915
2916impl Validate for CreditorReferenceType1Choice1 {
2917    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2918        if let Some(ref val) = self.cd
2919            && config.validate_optional_fields
2920        {
2921            val.validate(&helpers::child_path(path, "Cd"), config, collector);
2922        }
2923        if let Some(ref val) = self.prtry {
2924            helpers::validate_length(
2925                val,
2926                "Prtry",
2927                Some(1),
2928                Some(35),
2929                &helpers::child_path(path, "Prtry"),
2930                config,
2931                collector,
2932            );
2933        }
2934        if let Some(ref val) = self.prtry {
2935            helpers::validate_pattern(
2936                val,
2937                "Prtry",
2938                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2939                &helpers::child_path(path, "Prtry"),
2940                config,
2941                collector,
2942            );
2943        }
2944    }
2945}
2946
2947// CreditorReferenceType21: Entity that assigns the credit reference type.
2948#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2949pub struct CreditorReferenceType21 {
2950    #[serde(rename = "CdOrPrtry")]
2951    pub cd_or_prtry: CreditorReferenceType1Choice1,
2952    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2953    pub issr: Option<String>,
2954}
2955
2956impl Validate for CreditorReferenceType21 {
2957    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2958        self.cd_or_prtry
2959            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
2960        if let Some(ref val) = self.issr {
2961            helpers::validate_length(
2962                val,
2963                "Issr",
2964                Some(1),
2965                Some(35),
2966                &helpers::child_path(path, "Issr"),
2967                config,
2968                collector,
2969            );
2970        }
2971        if let Some(ref val) = self.issr {
2972            helpers::validate_pattern(
2973                val,
2974                "Issr",
2975                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2976                &helpers::child_path(path, "Issr"),
2977                config,
2978                collector,
2979            );
2980        }
2981    }
2982}
2983
2984// CurrencyExchange51: Date and time at which an exchange rate is quoted.
2985#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2986pub struct CurrencyExchange51 {
2987    #[serde(rename = "SrcCcy")]
2988    pub src_ccy: String,
2989    #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2990    pub trgt_ccy: Option<String>,
2991    #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2992    pub unit_ccy: Option<String>,
2993    #[serde(rename = "XchgRate")]
2994    pub xchg_rate: f64,
2995    #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2996    pub ctrct_id: Option<String>,
2997    #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2998    pub qtn_dt: Option<String>,
2999}
3000
3001impl Validate for CurrencyExchange51 {
3002    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3003        helpers::validate_pattern(
3004            &self.src_ccy,
3005            "SrcCcy",
3006            "[A-Z]{3,3}",
3007            &helpers::child_path(path, "SrcCcy"),
3008            config,
3009            collector,
3010        );
3011        if let Some(ref val) = self.trgt_ccy {
3012            helpers::validate_pattern(
3013                val,
3014                "TrgtCcy",
3015                "[A-Z]{3,3}",
3016                &helpers::child_path(path, "TrgtCcy"),
3017                config,
3018                collector,
3019            );
3020        }
3021        if let Some(ref val) = self.unit_ccy {
3022            helpers::validate_pattern(
3023                val,
3024                "UnitCcy",
3025                "[A-Z]{3,3}",
3026                &helpers::child_path(path, "UnitCcy"),
3027                config,
3028                collector,
3029            );
3030        }
3031        if let Some(ref val) = self.ctrct_id {
3032            helpers::validate_length(
3033                val,
3034                "CtrctId",
3035                Some(1),
3036                Some(35),
3037                &helpers::child_path(path, "CtrctId"),
3038                config,
3039                collector,
3040            );
3041        }
3042        if let Some(ref val) = self.ctrct_id {
3043            helpers::validate_pattern(
3044                val,
3045                "CtrctId",
3046                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3047                &helpers::child_path(path, "CtrctId"),
3048                config,
3049                collector,
3050            );
3051        }
3052        if let Some(ref val) = self.qtn_dt {
3053            helpers::validate_pattern(
3054                val,
3055                "QtnDt",
3056                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3057                &helpers::child_path(path, "QtnDt"),
3058                config,
3059                collector,
3060            );
3061        }
3062    }
3063}
3064
3065// DateAndDateTime2Choice1: Specified date and time.
3066#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3067pub struct DateAndDateTime2Choice1 {
3068    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3069    pub dt: Option<String>,
3070    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3071    pub dt_tm: Option<String>,
3072}
3073
3074impl Validate for DateAndDateTime2Choice1 {
3075    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3076        if let Some(ref val) = self.dt_tm {
3077            helpers::validate_pattern(
3078                val,
3079                "DtTm",
3080                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3081                &helpers::child_path(path, "DtTm"),
3082                config,
3083                collector,
3084            );
3085        }
3086    }
3087}
3088
3089// DateAndDateTime2Choice2: Specified date and time.
3090#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3091pub struct DateAndDateTime2Choice2 {
3092    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3093    pub dt_tm: Option<String>,
3094}
3095
3096impl Validate for DateAndDateTime2Choice2 {
3097    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3098        if let Some(ref val) = self.dt_tm {
3099            helpers::validate_pattern(
3100                val,
3101                "DtTm",
3102                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3103                &helpers::child_path(path, "DtTm"),
3104                config,
3105                collector,
3106            );
3107        }
3108    }
3109}
3110
3111// DateAndPlaceOfBirth11: Country where a person was born.
3112#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3113pub struct DateAndPlaceOfBirth11 {
3114    #[serde(rename = "BirthDt")]
3115    pub birth_dt: String,
3116    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
3117    pub prvc_of_birth: Option<String>,
3118    #[serde(rename = "CityOfBirth")]
3119    pub city_of_birth: String,
3120    #[serde(rename = "CtryOfBirth")]
3121    pub ctry_of_birth: String,
3122}
3123
3124impl Validate for DateAndPlaceOfBirth11 {
3125    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3126        if let Some(ref val) = self.prvc_of_birth {
3127            helpers::validate_length(
3128                val,
3129                "PrvcOfBirth",
3130                Some(1),
3131                Some(35),
3132                &helpers::child_path(path, "PrvcOfBirth"),
3133                config,
3134                collector,
3135            );
3136        }
3137        if let Some(ref val) = self.prvc_of_birth {
3138            helpers::validate_pattern(
3139                val,
3140                "PrvcOfBirth",
3141                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3142                &helpers::child_path(path, "PrvcOfBirth"),
3143                config,
3144                collector,
3145            );
3146        }
3147        helpers::validate_length(
3148            &self.city_of_birth,
3149            "CityOfBirth",
3150            Some(1),
3151            Some(35),
3152            &helpers::child_path(path, "CityOfBirth"),
3153            config,
3154            collector,
3155        );
3156        helpers::validate_pattern(
3157            &self.city_of_birth,
3158            "CityOfBirth",
3159            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3160            &helpers::child_path(path, "CityOfBirth"),
3161            config,
3162            collector,
3163        );
3164        helpers::validate_pattern(
3165            &self.ctry_of_birth,
3166            "CtryOfBirth",
3167            "[A-Z]{2,2}",
3168            &helpers::child_path(path, "CtryOfBirth"),
3169            config,
3170            collector,
3171        );
3172    }
3173}
3174
3175// DateOrDateTimePeriod1Choice1: Period expressed a dates and times.
3176#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3177pub struct DateOrDateTimePeriod1Choice1 {
3178    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3179    pub dt: Option<DatePeriod2>,
3180    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3181    pub dt_tm: Option<DateTimePeriod11>,
3182}
3183
3184impl Validate for DateOrDateTimePeriod1Choice1 {
3185    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3186        if let Some(ref val) = self.dt
3187            && config.validate_optional_fields
3188        {
3189            val.validate(&helpers::child_path(path, "Dt"), config, collector);
3190        }
3191        if let Some(ref val) = self.dt_tm
3192            && config.validate_optional_fields
3193        {
3194            val.validate(&helpers::child_path(path, "DtTm"), config, collector);
3195        }
3196    }
3197}
3198
3199// DatePeriod2: End date of the range.
3200#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3201pub struct DatePeriod2 {
3202    #[serde(rename = "FrDt")]
3203    pub fr_dt: String,
3204    #[serde(rename = "ToDt")]
3205    pub to_dt: String,
3206}
3207
3208impl Validate for DatePeriod2 {
3209    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
3210}
3211
3212// DateTimePeriod11: Date and time at which the period ends.
3213#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3214pub struct DateTimePeriod11 {
3215    #[serde(rename = "FrDtTm")]
3216    pub fr_dt_tm: String,
3217    #[serde(rename = "ToDtTm")]
3218    pub to_dt_tm: String,
3219}
3220
3221impl Validate for DateTimePeriod11 {
3222    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3223        helpers::validate_pattern(
3224            &self.fr_dt_tm,
3225            "FrDtTm",
3226            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3227            &helpers::child_path(path, "FrDtTm"),
3228            config,
3229            collector,
3230        );
3231        helpers::validate_pattern(
3232            &self.to_dt_tm,
3233            "ToDtTm",
3234            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3235            &helpers::child_path(path, "ToDtTm"),
3236            config,
3237            collector,
3238        );
3239    }
3240}
3241
3242// DiscountAmountAndType11: Amount of money, which has been typed.
3243#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3244pub struct DiscountAmountAndType11 {
3245    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3246    pub tp: Option<DiscountAmountType1Choice1>,
3247    #[serde(rename = "Amt")]
3248    pub amt: ActiveOrHistoricCurrencyAndAmount,
3249}
3250
3251impl Validate for DiscountAmountAndType11 {
3252    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3253        if let Some(ref val) = self.tp
3254            && config.validate_optional_fields
3255        {
3256            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3257        }
3258        self.amt
3259            .validate(&helpers::child_path(path, "Amt"), config, collector);
3260    }
3261}
3262
3263// DiscountAmountAndType12: Amount of money, which has been typed.
3264#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3265pub struct DiscountAmountAndType12 {
3266    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3267    pub tp: Option<DiscountAmountType1Choice2>,
3268    #[serde(rename = "Amt")]
3269    pub amt: ActiveOrHistoricCurrencyAndAmount,
3270}
3271
3272impl Validate for DiscountAmountAndType12 {
3273    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3274        if let Some(ref val) = self.tp
3275            && config.validate_optional_fields
3276        {
3277            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3278        }
3279        self.amt
3280            .validate(&helpers::child_path(path, "Amt"), config, collector);
3281    }
3282}
3283
3284// DiscountAmountType1Choice1: Specifies the amount type, in a free-text form.
3285#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3286pub struct DiscountAmountType1Choice1 {
3287    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3288    pub cd: Option<String>,
3289    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3290    pub prtry: Option<String>,
3291}
3292
3293impl Validate for DiscountAmountType1Choice1 {
3294    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3295        if let Some(ref val) = self.cd {
3296            helpers::validate_length(
3297                val,
3298                "Cd",
3299                Some(1),
3300                Some(4),
3301                &helpers::child_path(path, "Cd"),
3302                config,
3303                collector,
3304            );
3305        }
3306        if let Some(ref val) = self.prtry {
3307            helpers::validate_length(
3308                val,
3309                "Prtry",
3310                Some(1),
3311                Some(35),
3312                &helpers::child_path(path, "Prtry"),
3313                config,
3314                collector,
3315            );
3316        }
3317        if let Some(ref val) = self.prtry {
3318            helpers::validate_pattern(
3319                val,
3320                "Prtry",
3321                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3322                &helpers::child_path(path, "Prtry"),
3323                config,
3324                collector,
3325            );
3326        }
3327    }
3328}
3329
3330// DiscountAmountType1Choice2: Specifies the amount type, in a free-text form.
3331#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3332pub struct DiscountAmountType1Choice2 {
3333    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3334    pub cd: Option<String>,
3335    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3336    pub prtry: Option<String>,
3337}
3338
3339impl Validate for DiscountAmountType1Choice2 {
3340    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3341        if let Some(ref val) = self.cd {
3342            helpers::validate_length(
3343                val,
3344                "Cd",
3345                Some(1),
3346                Some(4),
3347                &helpers::child_path(path, "Cd"),
3348                config,
3349                collector,
3350            );
3351        }
3352        if let Some(ref val) = self.prtry {
3353            helpers::validate_length(
3354                val,
3355                "Prtry",
3356                Some(1),
3357                Some(35),
3358                &helpers::child_path(path, "Prtry"),
3359                config,
3360                collector,
3361            );
3362        }
3363        if let Some(ref val) = self.prtry {
3364            helpers::validate_pattern(
3365                val,
3366                "Prtry",
3367                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3368                &helpers::child_path(path, "Prtry"),
3369                config,
3370                collector,
3371            );
3372        }
3373    }
3374}
3375
3376// DisplayCapabilities1: Number of columns of the display component.
3377#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3378pub struct DisplayCapabilities1 {
3379    #[serde(rename = "DispTp")]
3380    pub disp_tp: UserInterface2Code,
3381    #[serde(rename = "NbOfLines")]
3382    pub nb_of_lines: String,
3383    #[serde(rename = "LineWidth")]
3384    pub line_width: String,
3385}
3386
3387impl Validate for DisplayCapabilities1 {
3388    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3389        self.disp_tp
3390            .validate(&helpers::child_path(path, "DispTp"), config, collector);
3391        helpers::validate_pattern(
3392            &self.nb_of_lines,
3393            "NbOfLines",
3394            "[0-9]{1,3}",
3395            &helpers::child_path(path, "NbOfLines"),
3396            config,
3397            collector,
3398        );
3399        helpers::validate_pattern(
3400            &self.line_width,
3401            "LineWidth",
3402            "[0-9]{1,3}",
3403            &helpers::child_path(path, "LineWidth"),
3404            config,
3405            collector,
3406        );
3407    }
3408}
3409
3410// DocumentAdjustment11: Provides further details on the document adjustment.
3411#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3412pub struct DocumentAdjustment11 {
3413    #[serde(rename = "Amt")]
3414    pub amt: ActiveOrHistoricCurrencyAndAmount,
3415    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
3416    pub cdt_dbt_ind: Option<CreditDebitCode>,
3417    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
3418    pub rsn: Option<String>,
3419    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
3420    pub addtl_inf: Option<String>,
3421}
3422
3423impl Validate for DocumentAdjustment11 {
3424    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3425        self.amt
3426            .validate(&helpers::child_path(path, "Amt"), config, collector);
3427        if let Some(ref val) = self.cdt_dbt_ind
3428            && config.validate_optional_fields
3429        {
3430            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
3431        }
3432        if let Some(ref val) = self.rsn {
3433            helpers::validate_length(
3434                val,
3435                "Rsn",
3436                Some(1),
3437                Some(4),
3438                &helpers::child_path(path, "Rsn"),
3439                config,
3440                collector,
3441            );
3442        }
3443        if let Some(ref val) = self.rsn {
3444            helpers::validate_pattern(
3445                val,
3446                "Rsn",
3447                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3448                &helpers::child_path(path, "Rsn"),
3449                config,
3450                collector,
3451            );
3452        }
3453        if let Some(ref val) = self.addtl_inf {
3454            helpers::validate_length(
3455                val,
3456                "AddtlInf",
3457                Some(1),
3458                Some(140),
3459                &helpers::child_path(path, "AddtlInf"),
3460                config,
3461                collector,
3462            );
3463        }
3464        if let Some(ref val) = self.addtl_inf {
3465            helpers::validate_pattern(
3466                val,
3467                "AddtlInf",
3468                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3469                &helpers::child_path(path, "AddtlInf"),
3470                config,
3471                collector,
3472            );
3473        }
3474    }
3475}
3476
3477// DocumentLineIdentification11: Date associated with the referred document line.
3478#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3479pub struct DocumentLineIdentification11 {
3480    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3481    pub tp: Option<DocumentLineType11>,
3482    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
3483    pub nb: Option<String>,
3484    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
3485    pub rltd_dt: Option<String>,
3486}
3487
3488impl Validate for DocumentLineIdentification11 {
3489    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3490        if let Some(ref val) = self.tp
3491            && config.validate_optional_fields
3492        {
3493            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3494        }
3495        if let Some(ref val) = self.nb {
3496            helpers::validate_length(
3497                val,
3498                "Nb",
3499                Some(1),
3500                Some(35),
3501                &helpers::child_path(path, "Nb"),
3502                config,
3503                collector,
3504            );
3505        }
3506        if let Some(ref val) = self.nb {
3507            helpers::validate_pattern(
3508                val,
3509                "Nb",
3510                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3511                &helpers::child_path(path, "Nb"),
3512                config,
3513                collector,
3514            );
3515        }
3516    }
3517}
3518
3519// DocumentLineInformation11: Provides details on the amounts of the document line.
3520#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3521pub struct DocumentLineInformation11 {
3522    #[serde(rename = "Id")]
3523    pub id: Vec<DocumentLineIdentification11>,
3524    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
3525    pub desc: Option<String>,
3526    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
3527    pub amt: Option<RemittanceAmount31>,
3528}
3529
3530impl Validate for DocumentLineInformation11 {
3531    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3532        for item in &self.id {
3533            item.validate(&helpers::child_path(path, "Id"), config, collector);
3534        }
3535        if let Some(ref val) = self.desc {
3536            helpers::validate_length(
3537                val,
3538                "Desc",
3539                Some(1),
3540                Some(35),
3541                &helpers::child_path(path, "Desc"),
3542                config,
3543                collector,
3544            );
3545        }
3546        if let Some(ref val) = self.desc {
3547            helpers::validate_pattern(
3548                val,
3549                "Desc",
3550                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3551                &helpers::child_path(path, "Desc"),
3552                config,
3553                collector,
3554            );
3555        }
3556        if let Some(ref val) = self.amt
3557            && config.validate_optional_fields
3558        {
3559            val.validate(&helpers::child_path(path, "Amt"), config, collector);
3560        }
3561    }
3562}
3563
3564// DocumentLineType1Choice1: Proprietary identification of the type of the remittance document.
3565#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3566pub struct DocumentLineType1Choice1 {
3567    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3568    pub cd: Option<String>,
3569    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3570    pub prtry: Option<String>,
3571}
3572
3573impl Validate for DocumentLineType1Choice1 {
3574    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3575        if let Some(ref val) = self.cd {
3576            helpers::validate_length(
3577                val,
3578                "Cd",
3579                Some(1),
3580                Some(4),
3581                &helpers::child_path(path, "Cd"),
3582                config,
3583                collector,
3584            );
3585        }
3586        if let Some(ref val) = self.prtry {
3587            helpers::validate_length(
3588                val,
3589                "Prtry",
3590                Some(1),
3591                Some(35),
3592                &helpers::child_path(path, "Prtry"),
3593                config,
3594                collector,
3595            );
3596        }
3597        if let Some(ref val) = self.prtry {
3598            helpers::validate_pattern(
3599                val,
3600                "Prtry",
3601                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3602                &helpers::child_path(path, "Prtry"),
3603                config,
3604                collector,
3605            );
3606        }
3607    }
3608}
3609
3610// DocumentLineType11: Identification of the issuer of the reference document line identificationtype.
3611#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3612pub struct DocumentLineType11 {
3613    #[serde(rename = "CdOrPrtry")]
3614    pub cd_or_prtry: DocumentLineType1Choice1,
3615    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3616    pub issr: Option<String>,
3617}
3618
3619impl Validate for DocumentLineType11 {
3620    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3621        self.cd_or_prtry
3622            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
3623        if let Some(ref val) = self.issr {
3624            helpers::validate_length(
3625                val,
3626                "Issr",
3627                Some(1),
3628                Some(35),
3629                &helpers::child_path(path, "Issr"),
3630                config,
3631                collector,
3632            );
3633        }
3634        if let Some(ref val) = self.issr {
3635            helpers::validate_pattern(
3636                val,
3637                "Issr",
3638                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3639                &helpers::child_path(path, "Issr"),
3640                config,
3641                collector,
3642            );
3643        }
3644    }
3645}
3646
3647// DocumentType3Code: Document is a structured communication reference provided by the creditor to identify the referred transaction.
3648#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3649pub enum DocumentType3Code {
3650    #[default]
3651    #[serde(rename = "RADM")]
3652    CodeRADM,
3653    #[serde(rename = "RPIN")]
3654    CodeRPIN,
3655    #[serde(rename = "FXDR")]
3656    CodeFXDR,
3657    #[serde(rename = "DISP")]
3658    CodeDISP,
3659    #[serde(rename = "PUOR")]
3660    CodePUOR,
3661    #[serde(rename = "SCOR")]
3662    CodeSCOR,
3663}
3664
3665impl Validate for DocumentType3Code {
3666    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3667        // Enum validation is typically empty
3668    }
3669}
3670
3671// DocumentType6Code: Document is a purchase order.
3672#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3673pub enum DocumentType6Code {
3674    #[default]
3675    #[serde(rename = "MSIN")]
3676    CodeMSIN,
3677    #[serde(rename = "CNFA")]
3678    CodeCNFA,
3679    #[serde(rename = "DNFA")]
3680    CodeDNFA,
3681    #[serde(rename = "CINV")]
3682    CodeCINV,
3683    #[serde(rename = "CREN")]
3684    CodeCREN,
3685    #[serde(rename = "DEBN")]
3686    CodeDEBN,
3687    #[serde(rename = "HIRI")]
3688    CodeHIRI,
3689    #[serde(rename = "SBIN")]
3690    CodeSBIN,
3691    #[serde(rename = "CMCN")]
3692    CodeCMCN,
3693    #[serde(rename = "SOAC")]
3694    CodeSOAC,
3695    #[serde(rename = "DISP")]
3696    CodeDISP,
3697    #[serde(rename = "BOLD")]
3698    CodeBOLD,
3699    #[serde(rename = "VCHR")]
3700    CodeVCHR,
3701    #[serde(rename = "AROI")]
3702    CodeAROI,
3703    #[serde(rename = "TSUT")]
3704    CodeTSUT,
3705    #[serde(rename = "PUOR")]
3706    CodePUOR,
3707}
3708
3709impl Validate for DocumentType6Code {
3710    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3711        // Enum validation is typically empty
3712    }
3713}
3714
3715// EntryDetails91: Provides information on the underlying transaction(s).
3716#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3717pub struct EntryDetails91 {
3718    #[serde(rename = "Btch", skip_serializing_if = "Option::is_none")]
3719    pub btch: Option<BatchInformation21>,
3720    #[serde(rename = "TxDtls", skip_serializing_if = "Option::is_none")]
3721    pub tx_dtls: Option<Vec<EntryTransaction101>>,
3722}
3723
3724impl Validate for EntryDetails91 {
3725    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3726        if let Some(ref val) = self.btch
3727            && config.validate_optional_fields
3728        {
3729            val.validate(&helpers::child_path(path, "Btch"), config, collector);
3730        }
3731        if let Some(ref vec) = self.tx_dtls
3732            && config.validate_optional_fields
3733        {
3734            for item in vec {
3735                item.validate(&helpers::child_path(path, "TxDtls"), config, collector);
3736            }
3737        }
3738    }
3739}
3740
3741// EntryStatus1Choice1: Entry status, in a coded form.
3742#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3743pub struct EntryStatus1Choice1 {
3744    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3745    pub cd: Option<String>,
3746}
3747
3748impl Validate for EntryStatus1Choice1 {
3749    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3750        if let Some(ref val) = self.cd {
3751            helpers::validate_length(
3752                val,
3753                "Cd",
3754                Some(1),
3755                Some(4),
3756                &helpers::child_path(path, "Cd"),
3757                config,
3758                collector,
3759            );
3760        }
3761    }
3762}
3763
3764// EntryTransaction101: Further details of the transaction.
3765#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3766pub struct EntryTransaction101 {
3767    #[serde(rename = "Refs")]
3768    pub refs: TransactionReferences61,
3769    #[serde(rename = "Amt")]
3770    pub amt: ActiveOrHistoricCurrencyAndAmount,
3771    #[serde(rename = "CdtDbtInd")]
3772    pub cdt_dbt_ind: CreditDebitCode,
3773    #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
3774    pub amt_dtls: Option<AmountAndCurrencyExchange31>,
3775    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
3776    pub avlbty: Option<Vec<CashAvailability1>>,
3777    #[serde(rename = "BkTxCd", skip_serializing_if = "Option::is_none")]
3778    pub bk_tx_cd: Option<BankTransactionCodeStructure41>,
3779    #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
3780    pub chrgs: Option<Charges62>,
3781    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
3782    pub intrst: Option<TransactionInterest41>,
3783    #[serde(rename = "RltdPties", skip_serializing_if = "Option::is_none")]
3784    pub rltd_pties: Option<TransactionParties61>,
3785    #[serde(rename = "RltdAgts", skip_serializing_if = "Option::is_none")]
3786    pub rltd_agts: Option<TransactionAgents51>,
3787    #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3788    pub lcl_instrm: Option<LocalInstrument2Choice1>,
3789    #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
3790    pub purp: Option<Purpose2Choice1>,
3791    #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
3792    pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
3793    #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
3794    pub rmt_inf: Option<RemittanceInformation161>,
3795    #[serde(rename = "RltdDts")]
3796    pub rltd_dts: TransactionDates31,
3797    #[serde(rename = "RltdPric", skip_serializing_if = "Option::is_none")]
3798    pub rltd_pric: Option<TransactionPrice4Choice1>,
3799    #[serde(rename = "RltdQties", skip_serializing_if = "Option::is_none")]
3800    pub rltd_qties: Option<Vec<TransactionQuantities3Choice1>>,
3801    #[serde(rename = "FinInstrmId", skip_serializing_if = "Option::is_none")]
3802    pub fin_instrm_id: Option<SecurityIdentification191>,
3803    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
3804    pub tax: Option<TaxInformation81>,
3805    #[serde(rename = "RtrInf", skip_serializing_if = "Option::is_none")]
3806    pub rtr_inf: Option<PaymentReturnReason51>,
3807    #[serde(rename = "CorpActn", skip_serializing_if = "Option::is_none")]
3808    pub corp_actn: Option<CorporateAction91>,
3809    #[serde(rename = "SfkpgAcct", skip_serializing_if = "Option::is_none")]
3810    pub sfkpg_acct: Option<SecuritiesAccount191>,
3811    #[serde(rename = "CshDpst", skip_serializing_if = "Option::is_none")]
3812    pub csh_dpst: Option<Vec<CashDeposit1>>,
3813    #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
3814    pub card_tx: Option<CardTransaction171>,
3815    #[serde(rename = "AddtlTxInf", skip_serializing_if = "Option::is_none")]
3816    pub addtl_tx_inf: Option<String>,
3817}
3818
3819impl Validate for EntryTransaction101 {
3820    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3821        self.refs
3822            .validate(&helpers::child_path(path, "Refs"), config, collector);
3823        self.amt
3824            .validate(&helpers::child_path(path, "Amt"), config, collector);
3825        self.cdt_dbt_ind
3826            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
3827        if let Some(ref val) = self.amt_dtls
3828            && config.validate_optional_fields
3829        {
3830            val.validate(&helpers::child_path(path, "AmtDtls"), config, collector);
3831        }
3832        if let Some(ref vec) = self.avlbty
3833            && config.validate_optional_fields
3834        {
3835            for item in vec {
3836                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
3837            }
3838        }
3839        if let Some(ref val) = self.bk_tx_cd
3840            && config.validate_optional_fields
3841        {
3842            val.validate(&helpers::child_path(path, "BkTxCd"), config, collector);
3843        }
3844        if let Some(ref val) = self.chrgs
3845            && config.validate_optional_fields
3846        {
3847            val.validate(&helpers::child_path(path, "Chrgs"), config, collector);
3848        }
3849        if let Some(ref val) = self.intrst
3850            && config.validate_optional_fields
3851        {
3852            val.validate(&helpers::child_path(path, "Intrst"), config, collector);
3853        }
3854        if let Some(ref val) = self.rltd_pties
3855            && config.validate_optional_fields
3856        {
3857            val.validate(&helpers::child_path(path, "RltdPties"), config, collector);
3858        }
3859        if let Some(ref val) = self.rltd_agts
3860            && config.validate_optional_fields
3861        {
3862            val.validate(&helpers::child_path(path, "RltdAgts"), config, collector);
3863        }
3864        if let Some(ref val) = self.lcl_instrm
3865            && config.validate_optional_fields
3866        {
3867            val.validate(&helpers::child_path(path, "LclInstrm"), config, collector);
3868        }
3869        if let Some(ref val) = self.purp
3870            && config.validate_optional_fields
3871        {
3872            val.validate(&helpers::child_path(path, "Purp"), config, collector);
3873        }
3874        if let Some(ref vec) = self.rltd_rmt_inf
3875            && config.validate_optional_fields
3876        {
3877            for item in vec {
3878                item.validate(&helpers::child_path(path, "RltdRmtInf"), config, collector);
3879            }
3880        }
3881        if let Some(ref val) = self.rmt_inf
3882            && config.validate_optional_fields
3883        {
3884            val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
3885        }
3886        self.rltd_dts
3887            .validate(&helpers::child_path(path, "RltdDts"), config, collector);
3888        if let Some(ref val) = self.rltd_pric
3889            && config.validate_optional_fields
3890        {
3891            val.validate(&helpers::child_path(path, "RltdPric"), config, collector);
3892        }
3893        if let Some(ref vec) = self.rltd_qties
3894            && config.validate_optional_fields
3895        {
3896            for item in vec {
3897                item.validate(&helpers::child_path(path, "RltdQties"), config, collector);
3898            }
3899        }
3900        if let Some(ref val) = self.fin_instrm_id
3901            && config.validate_optional_fields
3902        {
3903            val.validate(&helpers::child_path(path, "FinInstrmId"), config, collector);
3904        }
3905        if let Some(ref val) = self.tax
3906            && config.validate_optional_fields
3907        {
3908            val.validate(&helpers::child_path(path, "Tax"), config, collector);
3909        }
3910        if let Some(ref val) = self.rtr_inf
3911            && config.validate_optional_fields
3912        {
3913            val.validate(&helpers::child_path(path, "RtrInf"), config, collector);
3914        }
3915        if let Some(ref val) = self.corp_actn
3916            && config.validate_optional_fields
3917        {
3918            val.validate(&helpers::child_path(path, "CorpActn"), config, collector);
3919        }
3920        if let Some(ref val) = self.sfkpg_acct
3921            && config.validate_optional_fields
3922        {
3923            val.validate(&helpers::child_path(path, "SfkpgAcct"), config, collector);
3924        }
3925        if let Some(ref vec) = self.csh_dpst
3926            && config.validate_optional_fields
3927        {
3928            for item in vec {
3929                item.validate(&helpers::child_path(path, "CshDpst"), config, collector);
3930            }
3931        }
3932        if let Some(ref val) = self.card_tx
3933            && config.validate_optional_fields
3934        {
3935            val.validate(&helpers::child_path(path, "CardTx"), config, collector);
3936        }
3937        if let Some(ref val) = self.addtl_tx_inf {
3938            helpers::validate_length(
3939                val,
3940                "AddtlTxInf",
3941                Some(1),
3942                Some(500),
3943                &helpers::child_path(path, "AddtlTxInf"),
3944                config,
3945                collector,
3946            );
3947        }
3948        if let Some(ref val) = self.addtl_tx_inf {
3949            helpers::validate_pattern(
3950                val,
3951                "AddtlTxInf",
3952                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3953                &helpers::child_path(path, "AddtlTxInf"),
3954                config,
3955                collector,
3956            );
3957        }
3958    }
3959}
3960
3961// FinancialIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
3962#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3963pub struct FinancialIdentificationSchemeName1Choice1 {
3964    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3965    pub cd: Option<String>,
3966    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3967    pub prtry: Option<String>,
3968}
3969
3970impl Validate for FinancialIdentificationSchemeName1Choice1 {
3971    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3972        if let Some(ref val) = self.cd {
3973            helpers::validate_length(
3974                val,
3975                "Cd",
3976                Some(1),
3977                Some(4),
3978                &helpers::child_path(path, "Cd"),
3979                config,
3980                collector,
3981            );
3982        }
3983        if let Some(ref val) = self.prtry {
3984            helpers::validate_length(
3985                val,
3986                "Prtry",
3987                Some(1),
3988                Some(35),
3989                &helpers::child_path(path, "Prtry"),
3990                config,
3991                collector,
3992            );
3993        }
3994        if let Some(ref val) = self.prtry {
3995            helpers::validate_pattern(
3996                val,
3997                "Prtry",
3998                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3999                &helpers::child_path(path, "Prtry"),
4000                config,
4001                collector,
4002            );
4003        }
4004    }
4005}
4006
4007// FinancialInstitutionIdentification181: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4008#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4009pub struct FinancialInstitutionIdentification181 {
4010    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4011    pub bicfi: Option<String>,
4012    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4013    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
4014    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4015    pub lei: Option<String>,
4016    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4017    pub nm: Option<String>,
4018    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4019    pub pstl_adr: Option<PostalAddress242>,
4020    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4021    pub othr: Option<GenericFinancialIdentification11>,
4022}
4023
4024impl Validate for FinancialInstitutionIdentification181 {
4025    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4026        if let Some(ref val) = self.bicfi {
4027            helpers::validate_pattern(
4028                val,
4029                "BICFI",
4030                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4031                &helpers::child_path(path, "BICFI"),
4032                config,
4033                collector,
4034            );
4035        }
4036        if let Some(ref val) = self.clr_sys_mmb_id
4037            && config.validate_optional_fields
4038        {
4039            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4040        }
4041        if let Some(ref val) = self.lei {
4042            helpers::validate_pattern(
4043                val,
4044                "LEI",
4045                "[A-Z0-9]{18,18}[0-9]{2,2}",
4046                &helpers::child_path(path, "LEI"),
4047                config,
4048                collector,
4049            );
4050        }
4051        if let Some(ref val) = self.nm {
4052            helpers::validate_length(
4053                val,
4054                "Nm",
4055                Some(1),
4056                Some(140),
4057                &helpers::child_path(path, "Nm"),
4058                config,
4059                collector,
4060            );
4061        }
4062        if let Some(ref val) = self.nm {
4063            helpers::validate_pattern(
4064                val,
4065                "Nm",
4066                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4067                &helpers::child_path(path, "Nm"),
4068                config,
4069                collector,
4070            );
4071        }
4072        if let Some(ref val) = self.pstl_adr
4073            && config.validate_optional_fields
4074        {
4075            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4076        }
4077        if let Some(ref val) = self.othr
4078            && config.validate_optional_fields
4079        {
4080            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4081        }
4082    }
4083}
4084
4085// FinancialInstitutionIdentification182: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4086#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4087pub struct FinancialInstitutionIdentification182 {
4088    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4089    pub bicfi: Option<String>,
4090    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4091    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
4092    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4093    pub lei: Option<String>,
4094    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4095    pub nm: Option<String>,
4096    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4097    pub pstl_adr: Option<PostalAddress241>,
4098    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4099    pub othr: Option<GenericFinancialIdentification11>,
4100}
4101
4102impl Validate for FinancialInstitutionIdentification182 {
4103    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4104        if let Some(ref val) = self.bicfi {
4105            helpers::validate_pattern(
4106                val,
4107                "BICFI",
4108                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4109                &helpers::child_path(path, "BICFI"),
4110                config,
4111                collector,
4112            );
4113        }
4114        if let Some(ref val) = self.clr_sys_mmb_id
4115            && config.validate_optional_fields
4116        {
4117            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4118        }
4119        if let Some(ref val) = self.lei {
4120            helpers::validate_pattern(
4121                val,
4122                "LEI",
4123                "[A-Z0-9]{18,18}[0-9]{2,2}",
4124                &helpers::child_path(path, "LEI"),
4125                config,
4126                collector,
4127            );
4128        }
4129        if let Some(ref val) = self.nm {
4130            helpers::validate_length(
4131                val,
4132                "Nm",
4133                Some(1),
4134                Some(140),
4135                &helpers::child_path(path, "Nm"),
4136                config,
4137                collector,
4138            );
4139        }
4140        if let Some(ref val) = self.nm {
4141            helpers::validate_pattern(
4142                val,
4143                "Nm",
4144                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4145                &helpers::child_path(path, "Nm"),
4146                config,
4147                collector,
4148            );
4149        }
4150        if let Some(ref val) = self.pstl_adr
4151            && config.validate_optional_fields
4152        {
4153            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4154        }
4155        if let Some(ref val) = self.othr
4156            && config.validate_optional_fields
4157        {
4158            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4159        }
4160    }
4161}
4162
4163// FinancialInstitutionIdentification183: Information that locates and identifies a specific address, as defined by postal services.
4164#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4165pub struct FinancialInstitutionIdentification183 {
4166    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4167    pub bicfi: Option<String>,
4168    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4169    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
4170    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4171    pub lei: Option<String>,
4172    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4173    pub nm: Option<String>,
4174    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4175    pub pstl_adr: Option<PostalAddress243>,
4176}
4177
4178impl Validate for FinancialInstitutionIdentification183 {
4179    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4180        if let Some(ref val) = self.bicfi {
4181            helpers::validate_pattern(
4182                val,
4183                "BICFI",
4184                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4185                &helpers::child_path(path, "BICFI"),
4186                config,
4187                collector,
4188            );
4189        }
4190        if let Some(ref val) = self.clr_sys_mmb_id
4191            && config.validate_optional_fields
4192        {
4193            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4194        }
4195        if let Some(ref val) = self.lei {
4196            helpers::validate_pattern(
4197                val,
4198                "LEI",
4199                "[A-Z0-9]{18,18}[0-9]{2,2}",
4200                &helpers::child_path(path, "LEI"),
4201                config,
4202                collector,
4203            );
4204        }
4205        if let Some(ref val) = self.nm {
4206            helpers::validate_length(
4207                val,
4208                "Nm",
4209                Some(1),
4210                Some(140),
4211                &helpers::child_path(path, "Nm"),
4212                config,
4213                collector,
4214            );
4215        }
4216        if let Some(ref val) = self.nm {
4217            helpers::validate_pattern(
4218                val,
4219                "Nm",
4220                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4221                &helpers::child_path(path, "Nm"),
4222                config,
4223                collector,
4224            );
4225        }
4226        if let Some(ref val) = self.pstl_adr
4227            && config.validate_optional_fields
4228        {
4229            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4230        }
4231    }
4232}
4233
4234// FinancialInstitutionIdentification184: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4235#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4236pub struct FinancialInstitutionIdentification184 {
4237    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4238    pub bicfi: Option<String>,
4239    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4240    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
4241    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4242    pub lei: Option<String>,
4243    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4244    pub nm: Option<String>,
4245    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4246    pub pstl_adr: Option<PostalAddress241>,
4247    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4248    pub othr: Option<GenericFinancialIdentification11>,
4249}
4250
4251impl Validate for FinancialInstitutionIdentification184 {
4252    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4253        if let Some(ref val) = self.bicfi {
4254            helpers::validate_pattern(
4255                val,
4256                "BICFI",
4257                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4258                &helpers::child_path(path, "BICFI"),
4259                config,
4260                collector,
4261            );
4262        }
4263        if let Some(ref val) = self.clr_sys_mmb_id
4264            && config.validate_optional_fields
4265        {
4266            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4267        }
4268        if let Some(ref val) = self.lei {
4269            helpers::validate_pattern(
4270                val,
4271                "LEI",
4272                "[A-Z0-9]{18,18}[0-9]{2,2}",
4273                &helpers::child_path(path, "LEI"),
4274                config,
4275                collector,
4276            );
4277        }
4278        if let Some(ref val) = self.nm {
4279            helpers::validate_length(
4280                val,
4281                "Nm",
4282                Some(1),
4283                Some(140),
4284                &helpers::child_path(path, "Nm"),
4285                config,
4286                collector,
4287            );
4288        }
4289        if let Some(ref val) = self.nm {
4290            helpers::validate_pattern(
4291                val,
4292                "Nm",
4293                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4294                &helpers::child_path(path, "Nm"),
4295                config,
4296                collector,
4297            );
4298        }
4299        if let Some(ref val) = self.pstl_adr
4300            && config.validate_optional_fields
4301        {
4302            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4303        }
4304        if let Some(ref val) = self.othr
4305            && config.validate_optional_fields
4306        {
4307            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4308        }
4309    }
4310}
4311
4312// FinancialInstitutionIdentification185: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4313#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4314pub struct FinancialInstitutionIdentification185 {
4315    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4316    pub bicfi: Option<String>,
4317    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4318    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification2>,
4319    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4320    pub lei: Option<String>,
4321    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4322    pub nm: Option<String>,
4323    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4324    pub pstl_adr: Option<PostalAddress241>,
4325    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4326    pub othr: Option<GenericFinancialIdentification11>,
4327}
4328
4329impl Validate for FinancialInstitutionIdentification185 {
4330    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4331        if let Some(ref val) = self.bicfi {
4332            helpers::validate_pattern(
4333                val,
4334                "BICFI",
4335                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4336                &helpers::child_path(path, "BICFI"),
4337                config,
4338                collector,
4339            );
4340        }
4341        if let Some(ref val) = self.clr_sys_mmb_id
4342            && config.validate_optional_fields
4343        {
4344            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4345        }
4346        if let Some(ref val) = self.lei {
4347            helpers::validate_pattern(
4348                val,
4349                "LEI",
4350                "[A-Z0-9]{18,18}[0-9]{2,2}",
4351                &helpers::child_path(path, "LEI"),
4352                config,
4353                collector,
4354            );
4355        }
4356        if let Some(ref val) = self.nm {
4357            helpers::validate_length(
4358                val,
4359                "Nm",
4360                Some(1),
4361                Some(140),
4362                &helpers::child_path(path, "Nm"),
4363                config,
4364                collector,
4365            );
4366        }
4367        if let Some(ref val) = self.nm {
4368            helpers::validate_pattern(
4369                val,
4370                "Nm",
4371                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4372                &helpers::child_path(path, "Nm"),
4373                config,
4374                collector,
4375            );
4376        }
4377        if let Some(ref val) = self.pstl_adr
4378            && config.validate_optional_fields
4379        {
4380            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4381        }
4382        if let Some(ref val) = self.othr
4383            && config.validate_optional_fields
4384        {
4385            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4386        }
4387    }
4388}
4389
4390// FinancialInstitutionIdentification186: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4391#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4392pub struct FinancialInstitutionIdentification186 {
4393    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4394    pub bicfi: Option<String>,
4395    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4396    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
4397    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4398    pub lei: Option<String>,
4399    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4400    pub nm: Option<String>,
4401    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4402    pub pstl_adr: Option<PostalAddress243>,
4403    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4404    pub othr: Option<GenericFinancialIdentification11>,
4405}
4406
4407impl Validate for FinancialInstitutionIdentification186 {
4408    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4409        if let Some(ref val) = self.bicfi {
4410            helpers::validate_pattern(
4411                val,
4412                "BICFI",
4413                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4414                &helpers::child_path(path, "BICFI"),
4415                config,
4416                collector,
4417            );
4418        }
4419        if let Some(ref val) = self.clr_sys_mmb_id
4420            && config.validate_optional_fields
4421        {
4422            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4423        }
4424        if let Some(ref val) = self.lei {
4425            helpers::validate_pattern(
4426                val,
4427                "LEI",
4428                "[A-Z0-9]{18,18}[0-9]{2,2}",
4429                &helpers::child_path(path, "LEI"),
4430                config,
4431                collector,
4432            );
4433        }
4434        if let Some(ref val) = self.nm {
4435            helpers::validate_length(
4436                val,
4437                "Nm",
4438                Some(1),
4439                Some(140),
4440                &helpers::child_path(path, "Nm"),
4441                config,
4442                collector,
4443            );
4444        }
4445        if let Some(ref val) = self.nm {
4446            helpers::validate_pattern(
4447                val,
4448                "Nm",
4449                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4450                &helpers::child_path(path, "Nm"),
4451                config,
4452                collector,
4453            );
4454        }
4455        if let Some(ref val) = self.pstl_adr
4456            && config.validate_optional_fields
4457        {
4458            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4459        }
4460        if let Some(ref val) = self.othr
4461            && config.validate_optional_fields
4462        {
4463            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4464        }
4465    }
4466}
4467
4468// 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.
4469#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4470pub struct FinancialInstrumentQuantity1Choice {
4471    #[serde(rename = "Unit", skip_serializing_if = "Option::is_none")]
4472    pub unit: Option<f64>,
4473    #[serde(rename = "FaceAmt", skip_serializing_if = "Option::is_none")]
4474    pub face_amt: Option<f64>,
4475    #[serde(rename = "AmtsdVal", skip_serializing_if = "Option::is_none")]
4476    pub amtsd_val: Option<f64>,
4477}
4478
4479impl Validate for FinancialInstrumentQuantity1Choice {
4480    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
4481}
4482
4483// FromToAmountRange1: Upper boundary of a range of amount values.
4484#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4485pub struct FromToAmountRange1 {
4486    #[serde(rename = "FrAmt")]
4487    pub fr_amt: AmountRangeBoundary1,
4488    #[serde(rename = "ToAmt")]
4489    pub to_amt: AmountRangeBoundary1,
4490}
4491
4492impl Validate for FromToAmountRange1 {
4493    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4494        self.fr_amt
4495            .validate(&helpers::child_path(path, "FrAmt"), config, collector);
4496        self.to_amt
4497            .validate(&helpers::child_path(path, "ToAmt"), config, collector);
4498    }
4499}
4500
4501// Garnishment31: Indicates if the employment of the person to whom the garnishment applies (that is, the ultimate debtor) has been terminated.
4502#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4503pub struct Garnishment31 {
4504    #[serde(rename = "Tp")]
4505    pub tp: GarnishmentType11,
4506    #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
4507    pub grnshee: Option<PartyIdentification1359>,
4508    #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
4509    pub grnshmt_admstr: Option<PartyIdentification1359>,
4510    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4511    pub ref_nb: Option<String>,
4512    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4513    pub dt: Option<String>,
4514    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4515    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4516    #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
4517    pub fmly_mdcl_insrnc_ind: Option<bool>,
4518    #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
4519    pub mplyee_termntn_ind: Option<bool>,
4520}
4521
4522impl Validate for Garnishment31 {
4523    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4524        self.tp
4525            .validate(&helpers::child_path(path, "Tp"), config, collector);
4526        if let Some(ref val) = self.grnshee
4527            && config.validate_optional_fields
4528        {
4529            val.validate(&helpers::child_path(path, "Grnshee"), config, collector);
4530        }
4531        if let Some(ref val) = self.grnshmt_admstr
4532            && config.validate_optional_fields
4533        {
4534            val.validate(
4535                &helpers::child_path(path, "GrnshmtAdmstr"),
4536                config,
4537                collector,
4538            );
4539        }
4540        if let Some(ref val) = self.ref_nb {
4541            helpers::validate_length(
4542                val,
4543                "RefNb",
4544                Some(1),
4545                Some(140),
4546                &helpers::child_path(path, "RefNb"),
4547                config,
4548                collector,
4549            );
4550        }
4551        if let Some(ref val) = self.ref_nb {
4552            helpers::validate_pattern(
4553                val,
4554                "RefNb",
4555                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4556                &helpers::child_path(path, "RefNb"),
4557                config,
4558                collector,
4559            );
4560        }
4561        if let Some(ref val) = self.rmtd_amt
4562            && config.validate_optional_fields
4563        {
4564            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
4565        }
4566    }
4567}
4568
4569// GarnishmentType1Choice1: Proprietary identification of the type of garnishment.
4570#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4571pub struct GarnishmentType1Choice1 {
4572    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4573    pub cd: Option<String>,
4574    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4575    pub prtry: Option<String>,
4576}
4577
4578impl Validate for GarnishmentType1Choice1 {
4579    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4580        if let Some(ref val) = self.cd {
4581            helpers::validate_length(
4582                val,
4583                "Cd",
4584                Some(1),
4585                Some(4),
4586                &helpers::child_path(path, "Cd"),
4587                config,
4588                collector,
4589            );
4590        }
4591        if let Some(ref val) = self.prtry {
4592            helpers::validate_length(
4593                val,
4594                "Prtry",
4595                Some(1),
4596                Some(35),
4597                &helpers::child_path(path, "Prtry"),
4598                config,
4599                collector,
4600            );
4601        }
4602        if let Some(ref val) = self.prtry {
4603            helpers::validate_pattern(
4604                val,
4605                "Prtry",
4606                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4607                &helpers::child_path(path, "Prtry"),
4608                config,
4609                collector,
4610            );
4611        }
4612    }
4613}
4614
4615// GarnishmentType11: Identification of the issuer of the garnishment type.
4616#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4617pub struct GarnishmentType11 {
4618    #[serde(rename = "CdOrPrtry")]
4619    pub cd_or_prtry: GarnishmentType1Choice1,
4620    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4621    pub issr: Option<String>,
4622}
4623
4624impl Validate for GarnishmentType11 {
4625    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4626        self.cd_or_prtry
4627            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
4628        if let Some(ref val) = self.issr {
4629            helpers::validate_length(
4630                val,
4631                "Issr",
4632                Some(1),
4633                Some(35),
4634                &helpers::child_path(path, "Issr"),
4635                config,
4636                collector,
4637            );
4638        }
4639        if let Some(ref val) = self.issr {
4640            helpers::validate_pattern(
4641                val,
4642                "Issr",
4643                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4644                &helpers::child_path(path, "Issr"),
4645                config,
4646                collector,
4647            );
4648        }
4649    }
4650}
4651
4652// GenericAccountIdentification11: Entity that assigns the identification.
4653#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4654pub struct GenericAccountIdentification11 {
4655    #[serde(rename = "Id")]
4656    pub id: String,
4657    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4658    pub schme_nm: Option<AccountSchemeName1Choice1>,
4659    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4660    pub issr: Option<String>,
4661}
4662
4663impl Validate for GenericAccountIdentification11 {
4664    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4665        helpers::validate_length(
4666            &self.id,
4667            "Id",
4668            Some(1),
4669            Some(34),
4670            &helpers::child_path(path, "Id"),
4671            config,
4672            collector,
4673        );
4674        helpers::validate_pattern(
4675            &self.id,
4676            "Id",
4677            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
4678            &helpers::child_path(path, "Id"),
4679            config,
4680            collector,
4681        );
4682        if let Some(ref val) = self.schme_nm
4683            && config.validate_optional_fields
4684        {
4685            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4686        }
4687        if let Some(ref val) = self.issr {
4688            helpers::validate_length(
4689                val,
4690                "Issr",
4691                Some(1),
4692                Some(35),
4693                &helpers::child_path(path, "Issr"),
4694                config,
4695                collector,
4696            );
4697        }
4698        if let Some(ref val) = self.issr {
4699            helpers::validate_pattern(
4700                val,
4701                "Issr",
4702                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4703                &helpers::child_path(path, "Issr"),
4704                config,
4705                collector,
4706            );
4707        }
4708    }
4709}
4710
4711// GenericFinancialIdentification11: Entity that assigns the identification.
4712#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4713pub struct GenericFinancialIdentification11 {
4714    #[serde(rename = "Id")]
4715    pub id: String,
4716    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4717    pub schme_nm: Option<FinancialIdentificationSchemeName1Choice1>,
4718    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4719    pub issr: Option<String>,
4720}
4721
4722impl Validate for GenericFinancialIdentification11 {
4723    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4724        helpers::validate_length(
4725            &self.id,
4726            "Id",
4727            Some(1),
4728            Some(35),
4729            &helpers::child_path(path, "Id"),
4730            config,
4731            collector,
4732        );
4733        helpers::validate_pattern(
4734            &self.id,
4735            "Id",
4736            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4737            &helpers::child_path(path, "Id"),
4738            config,
4739            collector,
4740        );
4741        if let Some(ref val) = self.schme_nm
4742            && config.validate_optional_fields
4743        {
4744            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4745        }
4746        if let Some(ref val) = self.issr {
4747            helpers::validate_length(
4748                val,
4749                "Issr",
4750                Some(1),
4751                Some(35),
4752                &helpers::child_path(path, "Issr"),
4753                config,
4754                collector,
4755            );
4756        }
4757        if let Some(ref val) = self.issr {
4758            helpers::validate_pattern(
4759                val,
4760                "Issr",
4761                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4762                &helpers::child_path(path, "Issr"),
4763                config,
4764                collector,
4765            );
4766        }
4767    }
4768}
4769
4770// GenericIdentification11: Entity that assigns the identification.
4771#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4772pub struct GenericIdentification11 {
4773    #[serde(rename = "Id")]
4774    pub id: String,
4775    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4776    pub schme_nm: Option<String>,
4777    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4778    pub issr: Option<String>,
4779}
4780
4781impl Validate for GenericIdentification11 {
4782    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4783        helpers::validate_length(
4784            &self.id,
4785            "Id",
4786            Some(1),
4787            Some(35),
4788            &helpers::child_path(path, "Id"),
4789            config,
4790            collector,
4791        );
4792        helpers::validate_pattern(
4793            &self.id,
4794            "Id",
4795            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4796            &helpers::child_path(path, "Id"),
4797            config,
4798            collector,
4799        );
4800        if let Some(ref val) = self.schme_nm {
4801            helpers::validate_length(
4802                val,
4803                "SchmeNm",
4804                Some(1),
4805                Some(35),
4806                &helpers::child_path(path, "SchmeNm"),
4807                config,
4808                collector,
4809            );
4810        }
4811        if let Some(ref val) = self.schme_nm {
4812            helpers::validate_pattern(
4813                val,
4814                "SchmeNm",
4815                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4816                &helpers::child_path(path, "SchmeNm"),
4817                config,
4818                collector,
4819            );
4820        }
4821        if let Some(ref val) = self.issr {
4822            helpers::validate_length(
4823                val,
4824                "Issr",
4825                Some(1),
4826                Some(35),
4827                &helpers::child_path(path, "Issr"),
4828                config,
4829                collector,
4830            );
4831        }
4832        if let Some(ref val) = self.issr {
4833            helpers::validate_pattern(
4834                val,
4835                "Issr",
4836                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4837                &helpers::child_path(path, "Issr"),
4838                config,
4839                collector,
4840            );
4841        }
4842    }
4843}
4844
4845// GenericIdentification30: Short textual description of the scheme.
4846#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4847pub struct GenericIdentification30 {
4848    #[serde(rename = "Id")]
4849    pub id: String,
4850    #[serde(rename = "Issr")]
4851    pub issr: String,
4852    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4853    pub schme_nm: Option<String>,
4854}
4855
4856impl Validate for GenericIdentification30 {
4857    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4858        helpers::validate_pattern(
4859            &self.id,
4860            "Id",
4861            "[a-zA-Z0-9]{4}",
4862            &helpers::child_path(path, "Id"),
4863            config,
4864            collector,
4865        );
4866        helpers::validate_length(
4867            &self.issr,
4868            "Issr",
4869            Some(1),
4870            Some(35),
4871            &helpers::child_path(path, "Issr"),
4872            config,
4873            collector,
4874        );
4875        if let Some(ref val) = self.schme_nm {
4876            helpers::validate_length(
4877                val,
4878                "SchmeNm",
4879                Some(1),
4880                Some(35),
4881                &helpers::child_path(path, "SchmeNm"),
4882                config,
4883                collector,
4884            );
4885        }
4886    }
4887}
4888
4889// GenericIdentification301: Short textual description of the scheme.
4890#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4891pub struct GenericIdentification301 {
4892    #[serde(rename = "Id")]
4893    pub id: String,
4894    #[serde(rename = "Issr")]
4895    pub issr: String,
4896    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4897    pub schme_nm: Option<String>,
4898}
4899
4900impl Validate for GenericIdentification301 {
4901    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4902        helpers::validate_pattern(
4903            &self.id,
4904            "Id",
4905            "[a-zA-Z0-9]{4}",
4906            &helpers::child_path(path, "Id"),
4907            config,
4908            collector,
4909        );
4910        helpers::validate_length(
4911            &self.issr,
4912            "Issr",
4913            Some(1),
4914            Some(35),
4915            &helpers::child_path(path, "Issr"),
4916            config,
4917            collector,
4918        );
4919        helpers::validate_pattern(
4920            &self.issr,
4921            "Issr",
4922            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4923            &helpers::child_path(path, "Issr"),
4924            config,
4925            collector,
4926        );
4927        if let Some(ref val) = self.schme_nm {
4928            helpers::validate_length(
4929                val,
4930                "SchmeNm",
4931                Some(1),
4932                Some(35),
4933                &helpers::child_path(path, "SchmeNm"),
4934                config,
4935                collector,
4936            );
4937        }
4938        if let Some(ref val) = self.schme_nm {
4939            helpers::validate_pattern(
4940                val,
4941                "SchmeNm",
4942                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4943                &helpers::child_path(path, "SchmeNm"),
4944                config,
4945                collector,
4946            );
4947        }
4948    }
4949}
4950
4951// GenericIdentification302: Short textual description of the scheme.
4952#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4953pub struct GenericIdentification302 {
4954    #[serde(rename = "Id")]
4955    pub id: String,
4956    #[serde(rename = "Issr")]
4957    pub issr: String,
4958    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4959    pub schme_nm: Option<String>,
4960}
4961
4962impl Validate for GenericIdentification302 {
4963    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4964        helpers::validate_pattern(
4965            &self.id,
4966            "Id",
4967            "[a-zA-Z0-9]{4}",
4968            &helpers::child_path(path, "Id"),
4969            config,
4970            collector,
4971        );
4972        helpers::validate_length(
4973            &self.issr,
4974            "Issr",
4975            Some(1),
4976            Some(35),
4977            &helpers::child_path(path, "Issr"),
4978            config,
4979            collector,
4980        );
4981        helpers::validate_pattern(
4982            &self.issr,
4983            "Issr",
4984            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4985            &helpers::child_path(path, "Issr"),
4986            config,
4987            collector,
4988        );
4989        if let Some(ref val) = self.schme_nm {
4990            helpers::validate_length(
4991                val,
4992                "SchmeNm",
4993                Some(1),
4994                Some(35),
4995                &helpers::child_path(path, "SchmeNm"),
4996                config,
4997                collector,
4998            );
4999        }
5000        if let Some(ref val) = self.schme_nm {
5001            helpers::validate_pattern(
5002                val,
5003                "SchmeNm",
5004                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5005                &helpers::child_path(path, "SchmeNm"),
5006                config,
5007                collector,
5008            );
5009        }
5010    }
5011}
5012
5013// GenericIdentification321: Name of the entity.
5014#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5015pub struct GenericIdentification321 {
5016    #[serde(rename = "Id")]
5017    pub id: String,
5018    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5019    pub tp: Option<PartyType3Code>,
5020    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5021    pub issr: Option<PartyType4Code>,
5022    #[serde(rename = "ShrtNm", skip_serializing_if = "Option::is_none")]
5023    pub shrt_nm: Option<String>,
5024}
5025
5026impl Validate for GenericIdentification321 {
5027    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5028        helpers::validate_length(
5029            &self.id,
5030            "Id",
5031            Some(1),
5032            Some(35),
5033            &helpers::child_path(path, "Id"),
5034            config,
5035            collector,
5036        );
5037        helpers::validate_pattern(
5038            &self.id,
5039            "Id",
5040            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5041            &helpers::child_path(path, "Id"),
5042            config,
5043            collector,
5044        );
5045        if let Some(ref val) = self.tp
5046            && config.validate_optional_fields
5047        {
5048            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5049        }
5050        if let Some(ref val) = self.issr
5051            && config.validate_optional_fields
5052        {
5053            val.validate(&helpers::child_path(path, "Issr"), config, collector);
5054        }
5055        if let Some(ref val) = self.shrt_nm {
5056            helpers::validate_length(
5057                val,
5058                "ShrtNm",
5059                Some(1),
5060                Some(35),
5061                &helpers::child_path(path, "ShrtNm"),
5062                config,
5063                collector,
5064            );
5065        }
5066        if let Some(ref val) = self.shrt_nm {
5067            helpers::validate_pattern(
5068                val,
5069                "ShrtNm",
5070                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5071                &helpers::child_path(path, "ShrtNm"),
5072                config,
5073                collector,
5074            );
5075        }
5076    }
5077}
5078
5079// GenericIdentification31: Entity that assigns the identification.
5080#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5081pub struct GenericIdentification31 {
5082    #[serde(rename = "Id")]
5083    pub id: String,
5084    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5085    pub issr: Option<String>,
5086}
5087
5088impl Validate for GenericIdentification31 {
5089    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5090        helpers::validate_length(
5091            &self.id,
5092            "Id",
5093            Some(1),
5094            Some(35),
5095            &helpers::child_path(path, "Id"),
5096            config,
5097            collector,
5098        );
5099        helpers::validate_pattern(
5100            &self.id,
5101            "Id",
5102            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5103            &helpers::child_path(path, "Id"),
5104            config,
5105            collector,
5106        );
5107        if let Some(ref val) = self.issr {
5108            helpers::validate_length(
5109                val,
5110                "Issr",
5111                Some(1),
5112                Some(35),
5113                &helpers::child_path(path, "Issr"),
5114                config,
5115                collector,
5116            );
5117        }
5118        if let Some(ref val) = self.issr {
5119            helpers::validate_pattern(
5120                val,
5121                "Issr",
5122                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5123                &helpers::child_path(path, "Issr"),
5124                config,
5125                collector,
5126            );
5127        }
5128    }
5129}
5130
5131// GenericOrganisationIdentification11: Entity that assigns the identification.
5132#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5133pub struct GenericOrganisationIdentification11 {
5134    #[serde(rename = "Id")]
5135    pub id: String,
5136    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5137    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
5138    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5139    pub issr: Option<String>,
5140}
5141
5142impl Validate for GenericOrganisationIdentification11 {
5143    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5144        helpers::validate_length(
5145            &self.id,
5146            "Id",
5147            Some(1),
5148            Some(35),
5149            &helpers::child_path(path, "Id"),
5150            config,
5151            collector,
5152        );
5153        helpers::validate_pattern(
5154            &self.id,
5155            "Id",
5156            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5157            &helpers::child_path(path, "Id"),
5158            config,
5159            collector,
5160        );
5161        if let Some(ref val) = self.schme_nm
5162            && config.validate_optional_fields
5163        {
5164            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5165        }
5166        if let Some(ref val) = self.issr {
5167            helpers::validate_length(
5168                val,
5169                "Issr",
5170                Some(1),
5171                Some(35),
5172                &helpers::child_path(path, "Issr"),
5173                config,
5174                collector,
5175            );
5176        }
5177        if let Some(ref val) = self.issr {
5178            helpers::validate_pattern(
5179                val,
5180                "Issr",
5181                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5182                &helpers::child_path(path, "Issr"),
5183                config,
5184                collector,
5185            );
5186        }
5187    }
5188}
5189
5190// GenericOrganisationIdentification12: Entity that assigns the identification.
5191#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5192pub struct GenericOrganisationIdentification12 {
5193    #[serde(rename = "Id")]
5194    pub id: String,
5195    #[serde(rename = "SchmeNm")]
5196    pub schme_nm: OrganisationIdentificationSchemeName1Choice1,
5197    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5198    pub issr: Option<String>,
5199}
5200
5201impl Validate for GenericOrganisationIdentification12 {
5202    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5203        helpers::validate_length(
5204            &self.id,
5205            "Id",
5206            Some(1),
5207            Some(35),
5208            &helpers::child_path(path, "Id"),
5209            config,
5210            collector,
5211        );
5212        helpers::validate_pattern(
5213            &self.id,
5214            "Id",
5215            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5216            &helpers::child_path(path, "Id"),
5217            config,
5218            collector,
5219        );
5220        self.schme_nm
5221            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5222        if let Some(ref val) = self.issr {
5223            helpers::validate_length(
5224                val,
5225                "Issr",
5226                Some(1),
5227                Some(35),
5228                &helpers::child_path(path, "Issr"),
5229                config,
5230                collector,
5231            );
5232        }
5233        if let Some(ref val) = self.issr {
5234            helpers::validate_pattern(
5235                val,
5236                "Issr",
5237                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5238                &helpers::child_path(path, "Issr"),
5239                config,
5240                collector,
5241            );
5242        }
5243    }
5244}
5245
5246// GenericOrganisationIdentification13: Entity that assigns the identification.
5247#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5248pub struct GenericOrganisationIdentification13 {
5249    #[serde(rename = "Id")]
5250    pub id: String,
5251    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5252    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice2>,
5253    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5254    pub issr: Option<String>,
5255}
5256
5257impl Validate for GenericOrganisationIdentification13 {
5258    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5259        helpers::validate_length(
5260            &self.id,
5261            "Id",
5262            Some(1),
5263            Some(35),
5264            &helpers::child_path(path, "Id"),
5265            config,
5266            collector,
5267        );
5268        helpers::validate_pattern(
5269            &self.id,
5270            "Id",
5271            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5272            &helpers::child_path(path, "Id"),
5273            config,
5274            collector,
5275        );
5276        if let Some(ref val) = self.schme_nm
5277            && config.validate_optional_fields
5278        {
5279            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5280        }
5281        if let Some(ref val) = self.issr {
5282            helpers::validate_length(
5283                val,
5284                "Issr",
5285                Some(1),
5286                Some(35),
5287                &helpers::child_path(path, "Issr"),
5288                config,
5289                collector,
5290            );
5291        }
5292        if let Some(ref val) = self.issr {
5293            helpers::validate_pattern(
5294                val,
5295                "Issr",
5296                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5297                &helpers::child_path(path, "Issr"),
5298                config,
5299                collector,
5300            );
5301        }
5302    }
5303}
5304
5305// GenericPersonIdentification11: Entity that assigns the identification.
5306#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5307pub struct GenericPersonIdentification11 {
5308    #[serde(rename = "Id")]
5309    pub id: String,
5310    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5311    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
5312    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5313    pub issr: Option<String>,
5314}
5315
5316impl Validate for GenericPersonIdentification11 {
5317    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5318        helpers::validate_length(
5319            &self.id,
5320            "Id",
5321            Some(1),
5322            Some(35),
5323            &helpers::child_path(path, "Id"),
5324            config,
5325            collector,
5326        );
5327        helpers::validate_pattern(
5328            &self.id,
5329            "Id",
5330            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5331            &helpers::child_path(path, "Id"),
5332            config,
5333            collector,
5334        );
5335        if let Some(ref val) = self.schme_nm
5336            && config.validate_optional_fields
5337        {
5338            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5339        }
5340        if let Some(ref val) = self.issr {
5341            helpers::validate_length(
5342                val,
5343                "Issr",
5344                Some(1),
5345                Some(35),
5346                &helpers::child_path(path, "Issr"),
5347                config,
5348                collector,
5349            );
5350        }
5351        if let Some(ref val) = self.issr {
5352            helpers::validate_pattern(
5353                val,
5354                "Issr",
5355                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5356                &helpers::child_path(path, "Issr"),
5357                config,
5358                collector,
5359            );
5360        }
5361    }
5362}
5363
5364// GenericPersonIdentification12: Entity that assigns the identification.
5365#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5366pub struct GenericPersonIdentification12 {
5367    #[serde(rename = "Id")]
5368    pub id: String,
5369    #[serde(rename = "SchmeNm")]
5370    pub schme_nm: PersonIdentificationSchemeName1Choice1,
5371    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5372    pub issr: Option<String>,
5373}
5374
5375impl Validate for GenericPersonIdentification12 {
5376    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5377        helpers::validate_length(
5378            &self.id,
5379            "Id",
5380            Some(1),
5381            Some(35),
5382            &helpers::child_path(path, "Id"),
5383            config,
5384            collector,
5385        );
5386        helpers::validate_pattern(
5387            &self.id,
5388            "Id",
5389            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5390            &helpers::child_path(path, "Id"),
5391            config,
5392            collector,
5393        );
5394        self.schme_nm
5395            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5396        if let Some(ref val) = self.issr {
5397            helpers::validate_length(
5398                val,
5399                "Issr",
5400                Some(1),
5401                Some(35),
5402                &helpers::child_path(path, "Issr"),
5403                config,
5404                collector,
5405            );
5406        }
5407        if let Some(ref val) = self.issr {
5408            helpers::validate_pattern(
5409                val,
5410                "Issr",
5411                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5412                &helpers::child_path(path, "Issr"),
5413                config,
5414                collector,
5415            );
5416        }
5417    }
5418}
5419
5420// GenericPersonIdentification13: Entity that assigns the identification.
5421#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5422pub struct GenericPersonIdentification13 {
5423    #[serde(rename = "Id")]
5424    pub id: String,
5425    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5426    pub schme_nm: Option<PersonIdentificationSchemeName1Choice2>,
5427    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5428    pub issr: Option<String>,
5429}
5430
5431impl Validate for GenericPersonIdentification13 {
5432    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5433        helpers::validate_length(
5434            &self.id,
5435            "Id",
5436            Some(1),
5437            Some(35),
5438            &helpers::child_path(path, "Id"),
5439            config,
5440            collector,
5441        );
5442        helpers::validate_pattern(
5443            &self.id,
5444            "Id",
5445            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5446            &helpers::child_path(path, "Id"),
5447            config,
5448            collector,
5449        );
5450        if let Some(ref val) = self.schme_nm
5451            && config.validate_optional_fields
5452        {
5453            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5454        }
5455        if let Some(ref val) = self.issr {
5456            helpers::validate_length(
5457                val,
5458                "Issr",
5459                Some(1),
5460                Some(35),
5461                &helpers::child_path(path, "Issr"),
5462                config,
5463                collector,
5464            );
5465        }
5466        if let Some(ref val) = self.issr {
5467            helpers::validate_pattern(
5468                val,
5469                "Issr",
5470                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5471                &helpers::child_path(path, "Issr"),
5472                config,
5473                collector,
5474            );
5475        }
5476    }
5477}
5478
5479// GroupHeader811: Further details of the message.
5480#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5481pub struct GroupHeader811 {
5482    #[serde(rename = "MsgId")]
5483    pub msg_id: String,
5484    #[serde(rename = "CreDtTm")]
5485    pub cre_dt_tm: String,
5486    #[serde(rename = "MsgRcpt", skip_serializing_if = "Option::is_none")]
5487    pub msg_rcpt: Option<PartyIdentification1351>,
5488    #[serde(rename = "OrgnlBizQry", skip_serializing_if = "Option::is_none")]
5489    pub orgnl_biz_qry: Option<OriginalBusinessQuery11>,
5490    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
5491    pub addtl_inf: Option<String>,
5492}
5493
5494impl Validate for GroupHeader811 {
5495    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5496        helpers::validate_length(
5497            &self.msg_id,
5498            "MsgId",
5499            Some(1),
5500            Some(35),
5501            &helpers::child_path(path, "MsgId"),
5502            config,
5503            collector,
5504        );
5505        helpers::validate_pattern(
5506            &self.msg_id,
5507            "MsgId",
5508            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5509            &helpers::child_path(path, "MsgId"),
5510            config,
5511            collector,
5512        );
5513        helpers::validate_pattern(
5514            &self.cre_dt_tm,
5515            "CreDtTm",
5516            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
5517            &helpers::child_path(path, "CreDtTm"),
5518            config,
5519            collector,
5520        );
5521        if let Some(ref val) = self.msg_rcpt
5522            && config.validate_optional_fields
5523        {
5524            val.validate(&helpers::child_path(path, "MsgRcpt"), config, collector);
5525        }
5526        if let Some(ref val) = self.orgnl_biz_qry
5527            && config.validate_optional_fields
5528        {
5529            val.validate(&helpers::child_path(path, "OrgnlBizQry"), config, collector);
5530        }
5531        if let Some(ref val) = self.addtl_inf {
5532            helpers::validate_length(
5533                val,
5534                "AddtlInf",
5535                Some(1),
5536                Some(500),
5537                &helpers::child_path(path, "AddtlInf"),
5538                config,
5539                collector,
5540            );
5541        }
5542        if let Some(ref val) = self.addtl_inf {
5543            helpers::validate_pattern(
5544                val,
5545                "AddtlInf",
5546                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5547                &helpers::child_path(path, "AddtlInf"),
5548                config,
5549                collector,
5550            );
5551        }
5552    }
5553}
5554
5555// IdentificationSource3Choice1: Unique and unambiguous identification source using a proprietary identification scheme.
5556#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5557pub struct IdentificationSource3Choice1 {
5558    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5559    pub cd: Option<String>,
5560    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5561    pub prtry: Option<String>,
5562}
5563
5564impl Validate for IdentificationSource3Choice1 {
5565    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5566        if let Some(ref val) = self.cd {
5567            helpers::validate_length(
5568                val,
5569                "Cd",
5570                Some(1),
5571                Some(4),
5572                &helpers::child_path(path, "Cd"),
5573                config,
5574                collector,
5575            );
5576        }
5577        if let Some(ref val) = self.prtry {
5578            helpers::validate_length(
5579                val,
5580                "Prtry",
5581                Some(1),
5582                Some(35),
5583                &helpers::child_path(path, "Prtry"),
5584                config,
5585                collector,
5586            );
5587        }
5588        if let Some(ref val) = self.prtry {
5589            helpers::validate_pattern(
5590                val,
5591                "Prtry",
5592                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5593                &helpers::child_path(path, "Prtry"),
5594                config,
5595                collector,
5596            );
5597        }
5598    }
5599}
5600
5601// ImpliedCurrencyAmountRange1Choice: Value that an amount must not match to be considered valid.
5602#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5603pub struct ImpliedCurrencyAmountRange1Choice {
5604    #[serde(rename = "FrAmt", skip_serializing_if = "Option::is_none")]
5605    pub fr_amt: Option<AmountRangeBoundary1>,
5606    #[serde(rename = "ToAmt", skip_serializing_if = "Option::is_none")]
5607    pub to_amt: Option<AmountRangeBoundary1>,
5608    #[serde(rename = "FrToAmt", skip_serializing_if = "Option::is_none")]
5609    pub fr_to_amt: Option<FromToAmountRange1>,
5610    #[serde(rename = "EQAmt", skip_serializing_if = "Option::is_none")]
5611    pub eq_amt: Option<f64>,
5612    #[serde(rename = "NEQAmt", skip_serializing_if = "Option::is_none")]
5613    pub neq_amt: Option<f64>,
5614}
5615
5616impl Validate for ImpliedCurrencyAmountRange1Choice {
5617    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5618        if let Some(ref val) = self.fr_amt
5619            && config.validate_optional_fields
5620        {
5621            val.validate(&helpers::child_path(path, "FrAmt"), config, collector);
5622        }
5623        if let Some(ref val) = self.to_amt
5624            && config.validate_optional_fields
5625        {
5626            val.validate(&helpers::child_path(path, "ToAmt"), config, collector);
5627        }
5628        if let Some(ref val) = self.fr_to_amt
5629            && config.validate_optional_fields
5630        {
5631            val.validate(&helpers::child_path(path, "FrToAmt"), config, collector);
5632        }
5633    }
5634}
5635
5636// InterestRecord21: Provides details on the tax applied to charges.
5637#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5638pub struct InterestRecord21 {
5639    #[serde(rename = "Amt")]
5640    pub amt: ActiveOrHistoricCurrencyAndAmount,
5641    #[serde(rename = "CdtDbtInd")]
5642    pub cdt_dbt_ind: CreditDebitCode,
5643    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5644    pub tp: Option<InterestType1Choice1>,
5645    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
5646    pub rate: Option<Rate41>,
5647    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5648    pub fr_to_dt: Option<DateTimePeriod11>,
5649    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
5650    pub rsn: Option<String>,
5651    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
5652    pub tax: Option<TaxCharges21>,
5653}
5654
5655impl Validate for InterestRecord21 {
5656    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5657        self.amt
5658            .validate(&helpers::child_path(path, "Amt"), config, collector);
5659        self.cdt_dbt_ind
5660            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
5661        if let Some(ref val) = self.tp
5662            && config.validate_optional_fields
5663        {
5664            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5665        }
5666        if let Some(ref val) = self.rate
5667            && config.validate_optional_fields
5668        {
5669            val.validate(&helpers::child_path(path, "Rate"), config, collector);
5670        }
5671        if let Some(ref val) = self.fr_to_dt
5672            && config.validate_optional_fields
5673        {
5674            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
5675        }
5676        if let Some(ref val) = self.rsn {
5677            helpers::validate_length(
5678                val,
5679                "Rsn",
5680                Some(1),
5681                Some(35),
5682                &helpers::child_path(path, "Rsn"),
5683                config,
5684                collector,
5685            );
5686        }
5687        if let Some(ref val) = self.rsn {
5688            helpers::validate_pattern(
5689                val,
5690                "Rsn",
5691                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5692                &helpers::child_path(path, "Rsn"),
5693                config,
5694                collector,
5695            );
5696        }
5697        if let Some(ref val) = self.tax
5698            && config.validate_optional_fields
5699        {
5700            val.validate(&helpers::child_path(path, "Tax"), config, collector);
5701        }
5702    }
5703}
5704
5705// InterestType1Choice1: Specifies the type of interest in uncoded form.
5706#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5707pub struct InterestType1Choice1 {
5708    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5709    pub cd: Option<InterestType1Code>,
5710    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5711    pub prtry: Option<String>,
5712}
5713
5714impl Validate for InterestType1Choice1 {
5715    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5716        if let Some(ref val) = self.cd
5717            && config.validate_optional_fields
5718        {
5719            val.validate(&helpers::child_path(path, "Cd"), config, collector);
5720        }
5721        if let Some(ref val) = self.prtry {
5722            helpers::validate_length(
5723                val,
5724                "Prtry",
5725                Some(1),
5726                Some(35),
5727                &helpers::child_path(path, "Prtry"),
5728                config,
5729                collector,
5730            );
5731        }
5732        if let Some(ref val) = self.prtry {
5733            helpers::validate_pattern(
5734                val,
5735                "Prtry",
5736                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5737                &helpers::child_path(path, "Prtry"),
5738                config,
5739                collector,
5740            );
5741        }
5742    }
5743}
5744
5745// InterestType1Code: Period of time between the end of a business day and the start of the next business day (usually the day after).
5746#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5747pub enum InterestType1Code {
5748    #[default]
5749    #[serde(rename = "INDY")]
5750    CodeINDY,
5751    #[serde(rename = "OVRN")]
5752    CodeOVRN,
5753}
5754
5755impl Validate for InterestType1Code {
5756    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5757        // Enum validation is typically empty
5758    }
5759}
5760
5761// LocalInstrument2Choice1: Specifies the local instrument, as a proprietary code.
5762#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5763pub struct LocalInstrument2Choice1 {
5764    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5765    pub cd: Option<String>,
5766    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5767    pub prtry: Option<String>,
5768}
5769
5770impl Validate for LocalInstrument2Choice1 {
5771    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5772        if let Some(ref val) = self.cd {
5773            helpers::validate_length(
5774                val,
5775                "Cd",
5776                Some(1),
5777                Some(35),
5778                &helpers::child_path(path, "Cd"),
5779                config,
5780                collector,
5781            );
5782        }
5783        if let Some(ref val) = self.prtry {
5784            helpers::validate_length(
5785                val,
5786                "Prtry",
5787                Some(1),
5788                Some(35),
5789                &helpers::child_path(path, "Prtry"),
5790                config,
5791                collector,
5792            );
5793        }
5794        if let Some(ref val) = self.prtry {
5795            helpers::validate_pattern(
5796                val,
5797                "Prtry",
5798                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5799                &helpers::child_path(path, "Prtry"),
5800                config,
5801                collector,
5802            );
5803        }
5804    }
5805}
5806
5807// MessageIdentification21: Specifies the identification of the message that will be used to provide additional details.
5808#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5809pub struct MessageIdentification21 {
5810    #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5811    pub msg_nm_id: Option<String>,
5812    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
5813    pub msg_id: Option<String>,
5814}
5815
5816impl Validate for MessageIdentification21 {
5817    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5818        if let Some(ref val) = self.msg_nm_id {
5819            helpers::validate_length(
5820                val,
5821                "MsgNmId",
5822                Some(1),
5823                Some(35),
5824                &helpers::child_path(path, "MsgNmId"),
5825                config,
5826                collector,
5827            );
5828        }
5829        if let Some(ref val) = self.msg_nm_id {
5830            helpers::validate_pattern(
5831                val,
5832                "MsgNmId",
5833                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5834                &helpers::child_path(path, "MsgNmId"),
5835                config,
5836                collector,
5837            );
5838        }
5839        if let Some(ref val) = self.msg_id {
5840            helpers::validate_length(
5841                val,
5842                "MsgId",
5843                Some(1),
5844                Some(35),
5845                &helpers::child_path(path, "MsgId"),
5846                config,
5847                collector,
5848            );
5849        }
5850        if let Some(ref val) = self.msg_id {
5851            helpers::validate_pattern(
5852                val,
5853                "MsgId",
5854                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5855                &helpers::child_path(path, "MsgId"),
5856                config,
5857                collector,
5858            );
5859        }
5860    }
5861}
5862
5863// NameAndAddress161: Postal address of a party.
5864#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5865pub struct NameAndAddress161 {
5866    #[serde(rename = "Nm")]
5867    pub nm: String,
5868    #[serde(rename = "Adr")]
5869    pub adr: PostalAddress241,
5870}
5871
5872impl Validate for NameAndAddress161 {
5873    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5874        helpers::validate_length(
5875            &self.nm,
5876            "Nm",
5877            Some(1),
5878            Some(140),
5879            &helpers::child_path(path, "Nm"),
5880            config,
5881            collector,
5882        );
5883        helpers::validate_pattern(
5884            &self.nm,
5885            "Nm",
5886            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5887            &helpers::child_path(path, "Nm"),
5888            config,
5889            collector,
5890        );
5891        self.adr
5892            .validate(&helpers::child_path(path, "Adr"), config, collector);
5893    }
5894}
5895
5896// NumberAndSumOfTransactions1: Total of all individual entries included in the report.
5897#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5898pub struct NumberAndSumOfTransactions1 {
5899    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5900    pub nb_of_ntries: Option<String>,
5901    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5902    pub sum: Option<f64>,
5903}
5904
5905impl Validate for NumberAndSumOfTransactions1 {
5906    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5907        if let Some(ref val) = self.nb_of_ntries {
5908            helpers::validate_pattern(
5909                val,
5910                "NbOfNtries",
5911                "[0-9]{1,15}",
5912                &helpers::child_path(path, "NbOfNtries"),
5913                config,
5914                collector,
5915            );
5916        }
5917    }
5918}
5919
5920// NumberAndSumOfTransactions4: Resulting debit or credit amount of the netted amounts for all debit and credit entries.
5921#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5922pub struct NumberAndSumOfTransactions4 {
5923    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5924    pub nb_of_ntries: Option<String>,
5925    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5926    pub sum: Option<f64>,
5927    #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
5928    pub ttl_net_ntry: Option<AmountAndDirection35>,
5929}
5930
5931impl Validate for NumberAndSumOfTransactions4 {
5932    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5933        if let Some(ref val) = self.nb_of_ntries {
5934            helpers::validate_pattern(
5935                val,
5936                "NbOfNtries",
5937                "[0-9]{1,15}",
5938                &helpers::child_path(path, "NbOfNtries"),
5939                config,
5940                collector,
5941            );
5942        }
5943        if let Some(ref val) = self.ttl_net_ntry
5944            && config.validate_optional_fields
5945        {
5946            val.validate(&helpers::child_path(path, "TtlNetNtry"), config, collector);
5947        }
5948    }
5949}
5950
5951// OnLineCapability1Code: Off-line capable with possible on-line requests to the acquirer.
5952#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5953pub enum OnLineCapability1Code {
5954    #[default]
5955    #[serde(rename = "OFLN")]
5956    CodeOFLN,
5957    #[serde(rename = "ONLN")]
5958    CodeONLN,
5959    #[serde(rename = "SMON")]
5960    CodeSMON,
5961}
5962
5963impl Validate for OnLineCapability1Code {
5964    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5965        // Enum validation is typically empty
5966    }
5967}
5968
5969// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
5970#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5971pub struct OrganisationIdentification291 {
5972    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5973    pub any_bic: Option<String>,
5974    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5975    pub lei: Option<String>,
5976    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5977    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
5978}
5979
5980impl Validate for OrganisationIdentification291 {
5981    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5982        if let Some(ref val) = self.any_bic {
5983            helpers::validate_pattern(
5984                val,
5985                "AnyBIC",
5986                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
5987                &helpers::child_path(path, "AnyBIC"),
5988                config,
5989                collector,
5990            );
5991        }
5992        if let Some(ref val) = self.lei {
5993            helpers::validate_pattern(
5994                val,
5995                "LEI",
5996                "[A-Z0-9]{18,18}[0-9]{2,2}",
5997                &helpers::child_path(path, "LEI"),
5998                config,
5999                collector,
6000            );
6001        }
6002        if let Some(ref vec) = self.othr
6003            && config.validate_optional_fields
6004        {
6005            for item in vec {
6006                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6007            }
6008        }
6009    }
6010}
6011
6012// OrganisationIdentification292: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
6013#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6014pub struct OrganisationIdentification292 {
6015    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
6016    pub any_bic: Option<String>,
6017    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
6018    pub lei: Option<String>,
6019    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6020    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
6021}
6022
6023impl Validate for OrganisationIdentification292 {
6024    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6025        if let Some(ref val) = self.any_bic {
6026            helpers::validate_pattern(
6027                val,
6028                "AnyBIC",
6029                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
6030                &helpers::child_path(path, "AnyBIC"),
6031                config,
6032                collector,
6033            );
6034        }
6035        if let Some(ref val) = self.lei {
6036            helpers::validate_pattern(
6037                val,
6038                "LEI",
6039                "[A-Z0-9]{18,18}[0-9]{2,2}",
6040                &helpers::child_path(path, "LEI"),
6041                config,
6042                collector,
6043            );
6044        }
6045        if let Some(ref vec) = self.othr
6046            && config.validate_optional_fields
6047        {
6048            for item in vec {
6049                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6050            }
6051        }
6052    }
6053}
6054
6055// OrganisationIdentification293: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
6056#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6057pub struct OrganisationIdentification293 {
6058    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
6059    pub any_bic: Option<String>,
6060    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
6061    pub lei: Option<String>,
6062    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6063    pub othr: Option<Vec<GenericOrganisationIdentification12>>,
6064}
6065
6066impl Validate for OrganisationIdentification293 {
6067    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6068        if let Some(ref val) = self.any_bic {
6069            helpers::validate_pattern(
6070                val,
6071                "AnyBIC",
6072                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
6073                &helpers::child_path(path, "AnyBIC"),
6074                config,
6075                collector,
6076            );
6077        }
6078        if let Some(ref val) = self.lei {
6079            helpers::validate_pattern(
6080                val,
6081                "LEI",
6082                "[A-Z0-9]{18,18}[0-9]{2,2}",
6083                &helpers::child_path(path, "LEI"),
6084                config,
6085                collector,
6086            );
6087        }
6088        if let Some(ref vec) = self.othr
6089            && config.validate_optional_fields
6090        {
6091            for item in vec {
6092                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6093            }
6094        }
6095    }
6096}
6097
6098// OrganisationIdentification294: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
6099#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6100pub struct OrganisationIdentification294 {
6101    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
6102    pub any_bic: Option<String>,
6103    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
6104    pub lei: Option<String>,
6105    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6106    pub othr: Option<Vec<GenericOrganisationIdentification13>>,
6107}
6108
6109impl Validate for OrganisationIdentification294 {
6110    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6111        if let Some(ref val) = self.any_bic {
6112            helpers::validate_pattern(
6113                val,
6114                "AnyBIC",
6115                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
6116                &helpers::child_path(path, "AnyBIC"),
6117                config,
6118                collector,
6119            );
6120        }
6121        if let Some(ref val) = self.lei {
6122            helpers::validate_pattern(
6123                val,
6124                "LEI",
6125                "[A-Z0-9]{18,18}[0-9]{2,2}",
6126                &helpers::child_path(path, "LEI"),
6127                config,
6128                collector,
6129            );
6130        }
6131        if let Some(ref vec) = self.othr
6132            && config.validate_optional_fields
6133        {
6134            for item in vec {
6135                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6136            }
6137        }
6138    }
6139}
6140
6141// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
6142#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6143pub struct OrganisationIdentificationSchemeName1Choice1 {
6144    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6145    pub cd: Option<String>,
6146    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6147    pub prtry: Option<String>,
6148}
6149
6150impl Validate for OrganisationIdentificationSchemeName1Choice1 {
6151    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6152        if let Some(ref val) = self.cd {
6153            helpers::validate_length(
6154                val,
6155                "Cd",
6156                Some(1),
6157                Some(4),
6158                &helpers::child_path(path, "Cd"),
6159                config,
6160                collector,
6161            );
6162        }
6163        if let Some(ref val) = self.prtry {
6164            helpers::validate_length(
6165                val,
6166                "Prtry",
6167                Some(1),
6168                Some(35),
6169                &helpers::child_path(path, "Prtry"),
6170                config,
6171                collector,
6172            );
6173        }
6174        if let Some(ref val) = self.prtry {
6175            helpers::validate_pattern(
6176                val,
6177                "Prtry",
6178                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6179                &helpers::child_path(path, "Prtry"),
6180                config,
6181                collector,
6182            );
6183        }
6184    }
6185}
6186
6187// OrganisationIdentificationSchemeName1Choice2: Name of the identification scheme, in a free text form.
6188#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6189pub struct OrganisationIdentificationSchemeName1Choice2 {
6190    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6191    pub cd: Option<String>,
6192    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6193    pub prtry: Option<String>,
6194}
6195
6196impl Validate for OrganisationIdentificationSchemeName1Choice2 {
6197    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6198        if let Some(ref val) = self.cd {
6199            helpers::validate_length(
6200                val,
6201                "Cd",
6202                Some(1),
6203                Some(4),
6204                &helpers::child_path(path, "Cd"),
6205                config,
6206                collector,
6207            );
6208        }
6209        if let Some(ref val) = self.prtry {
6210            helpers::validate_length(
6211                val,
6212                "Prtry",
6213                Some(1),
6214                Some(35),
6215                &helpers::child_path(path, "Prtry"),
6216                config,
6217                collector,
6218            );
6219        }
6220        if let Some(ref val) = self.prtry {
6221            helpers::validate_pattern(
6222                val,
6223                "Prtry",
6224                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6225                &helpers::child_path(path, "Prtry"),
6226                config,
6227                collector,
6228            );
6229        }
6230    }
6231}
6232
6233// 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.
6234#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6235pub struct OriginalAndCurrentQuantities1 {
6236    #[serde(rename = "FaceAmt")]
6237    pub face_amt: f64,
6238    #[serde(rename = "AmtsdVal")]
6239    pub amtsd_val: f64,
6240}
6241
6242impl Validate for OriginalAndCurrentQuantities1 {
6243    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
6244}
6245
6246// OriginalBusinessQuery11: Date and time at which the message was created.
6247#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6248pub struct OriginalBusinessQuery11 {
6249    #[serde(rename = "MsgId")]
6250    pub msg_id: String,
6251    #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
6252    pub msg_nm_id: Option<String>,
6253    #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
6254    pub cre_dt_tm: Option<String>,
6255}
6256
6257impl Validate for OriginalBusinessQuery11 {
6258    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6259        helpers::validate_length(
6260            &self.msg_id,
6261            "MsgId",
6262            Some(1),
6263            Some(35),
6264            &helpers::child_path(path, "MsgId"),
6265            config,
6266            collector,
6267        );
6268        helpers::validate_pattern(
6269            &self.msg_id,
6270            "MsgId",
6271            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6272            &helpers::child_path(path, "MsgId"),
6273            config,
6274            collector,
6275        );
6276        if let Some(ref val) = self.msg_nm_id {
6277            helpers::validate_length(
6278                val,
6279                "MsgNmId",
6280                Some(1),
6281                Some(35),
6282                &helpers::child_path(path, "MsgNmId"),
6283                config,
6284                collector,
6285            );
6286        }
6287        if let Some(ref val) = self.msg_nm_id {
6288            helpers::validate_pattern(
6289                val,
6290                "MsgNmId",
6291                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6292                &helpers::child_path(path, "MsgNmId"),
6293                config,
6294                collector,
6295            );
6296        }
6297        if let Some(ref val) = self.cre_dt_tm {
6298            helpers::validate_pattern(
6299                val,
6300                "CreDtTm",
6301                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
6302                &helpers::child_path(path, "CreDtTm"),
6303                config,
6304                collector,
6305            );
6306        }
6307    }
6308}
6309
6310// OtherIdentification11: Type of the identification.
6311#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6312pub struct OtherIdentification11 {
6313    #[serde(rename = "Id")]
6314    pub id: String,
6315    #[serde(rename = "Sfx", skip_serializing_if = "Option::is_none")]
6316    pub sfx: Option<String>,
6317    #[serde(rename = "Tp")]
6318    pub tp: IdentificationSource3Choice1,
6319}
6320
6321impl Validate for OtherIdentification11 {
6322    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6323        helpers::validate_length(
6324            &self.id,
6325            "Id",
6326            Some(1),
6327            Some(35),
6328            &helpers::child_path(path, "Id"),
6329            config,
6330            collector,
6331        );
6332        helpers::validate_pattern(
6333            &self.id,
6334            "Id",
6335            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6336            &helpers::child_path(path, "Id"),
6337            config,
6338            collector,
6339        );
6340        if let Some(ref val) = self.sfx {
6341            helpers::validate_length(
6342                val,
6343                "Sfx",
6344                Some(1),
6345                Some(16),
6346                &helpers::child_path(path, "Sfx"),
6347                config,
6348                collector,
6349            );
6350        }
6351        if let Some(ref val) = self.sfx {
6352            helpers::validate_pattern(
6353                val,
6354                "Sfx",
6355                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6356                &helpers::child_path(path, "Sfx"),
6357                config,
6358                collector,
6359            );
6360        }
6361        self.tp
6362            .validate(&helpers::child_path(path, "Tp"), config, collector);
6363    }
6364}
6365
6366// POIComponentType1Code: Personal identification number (or PIN) entry device (PED).
6367#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6368pub enum POIComponentType1Code {
6369    #[default]
6370    #[serde(rename = "SOFT")]
6371    CodeSOFT,
6372    #[serde(rename = "EMVK")]
6373    CodeEMVK,
6374    #[serde(rename = "EMVO")]
6375    CodeEMVO,
6376    #[serde(rename = "MRIT")]
6377    CodeMRIT,
6378    #[serde(rename = "CHIT")]
6379    CodeCHIT,
6380    #[serde(rename = "SECM")]
6381    CodeSECM,
6382    #[serde(rename = "PEDV")]
6383    CodePEDV,
6384}
6385
6386impl Validate for POIComponentType1Code {
6387    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6388        // Enum validation is typically empty
6389    }
6390}
6391
6392// Pagination1: Indicates the last page.
6393#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6394pub struct Pagination1 {
6395    #[serde(rename = "PgNb")]
6396    pub pg_nb: String,
6397    #[serde(rename = "LastPgInd")]
6398    pub last_pg_ind: bool,
6399}
6400
6401impl Validate for Pagination1 {
6402    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6403        helpers::validate_pattern(
6404            &self.pg_nb,
6405            "PgNb",
6406            "[0-9]{1,5}",
6407            &helpers::child_path(path, "PgNb"),
6408            config,
6409            collector,
6410        );
6411    }
6412}
6413
6414// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
6415#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6416pub struct Party38Choice1 {
6417    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6418    pub org_id: Option<OrganisationIdentification291>,
6419    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6420    pub prvt_id: Option<PersonIdentification131>,
6421}
6422
6423impl Validate for Party38Choice1 {
6424    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6425        if let Some(ref val) = self.org_id
6426            && config.validate_optional_fields
6427        {
6428            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
6429        }
6430        if let Some(ref val) = self.prvt_id
6431            && config.validate_optional_fields
6432        {
6433            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
6434        }
6435    }
6436}
6437
6438// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
6439#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6440pub struct Party38Choice2 {
6441    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6442    pub org_id: Option<OrganisationIdentification292>,
6443    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6444    pub prvt_id: Option<PersonIdentification132>,
6445}
6446
6447impl Validate for Party38Choice2 {
6448    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6449        if let Some(ref val) = self.org_id
6450            && config.validate_optional_fields
6451        {
6452            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
6453        }
6454        if let Some(ref val) = self.prvt_id
6455            && config.validate_optional_fields
6456        {
6457            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
6458        }
6459    }
6460}
6461
6462// Party38Choice3: Unique and unambiguous identification of a person, for example a passport.
6463#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6464pub struct Party38Choice3 {
6465    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6466    pub org_id: Option<OrganisationIdentification293>,
6467    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6468    pub prvt_id: Option<PersonIdentification133>,
6469}
6470
6471impl Validate for Party38Choice3 {
6472    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6473        if let Some(ref val) = self.org_id
6474            && config.validate_optional_fields
6475        {
6476            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
6477        }
6478        if let Some(ref val) = self.prvt_id
6479            && config.validate_optional_fields
6480        {
6481            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
6482        }
6483    }
6484}
6485
6486// Party38Choice4: Unique and unambiguous identification of a person, for example a passport.
6487#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6488pub struct Party38Choice4 {
6489    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6490    pub org_id: Option<OrganisationIdentification294>,
6491    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6492    pub prvt_id: Option<PersonIdentification134>,
6493}
6494
6495impl Validate for Party38Choice4 {
6496    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6497        if let Some(ref val) = self.org_id
6498            && config.validate_optional_fields
6499        {
6500            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
6501        }
6502        if let Some(ref val) = self.prvt_id
6503            && config.validate_optional_fields
6504        {
6505            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
6506        }
6507    }
6508}
6509
6510// Party40Choice1: Identification of a financial institution.
6511#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6512pub struct Party40Choice1 {
6513    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6514    pub pty: Option<PartyIdentification1353>,
6515    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6516    pub agt: Option<BranchAndFinancialInstitutionIdentification64>,
6517}
6518
6519impl Validate for Party40Choice1 {
6520    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6521        if let Some(ref val) = self.pty
6522            && config.validate_optional_fields
6523        {
6524            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6525        }
6526        if let Some(ref val) = self.agt
6527            && config.validate_optional_fields
6528        {
6529            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6530        }
6531    }
6532}
6533
6534// Party40Choice2: Identification of a financial institution.
6535#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6536pub struct Party40Choice2 {
6537    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6538    pub pty: Option<PartyIdentification1354>,
6539    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6540    pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6541}
6542
6543impl Validate for Party40Choice2 {
6544    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6545        if let Some(ref val) = self.pty
6546            && config.validate_optional_fields
6547        {
6548            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6549        }
6550        if let Some(ref val) = self.agt
6551            && config.validate_optional_fields
6552        {
6553            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6554        }
6555    }
6556}
6557
6558// Party40Choice3: Identification of a financial institution.
6559#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6560pub struct Party40Choice3 {
6561    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6562    pub pty: Option<PartyIdentification1355>,
6563    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6564    pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6565}
6566
6567impl Validate for Party40Choice3 {
6568    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6569        if let Some(ref val) = self.pty
6570            && config.validate_optional_fields
6571        {
6572            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6573        }
6574        if let Some(ref val) = self.agt
6575            && config.validate_optional_fields
6576        {
6577            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6578        }
6579    }
6580}
6581
6582// Party40Choice4: Identification of a financial institution.
6583#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6584pub struct Party40Choice4 {
6585    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6586    pub pty: Option<PartyIdentification1356>,
6587    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6588    pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6589}
6590
6591impl Validate for Party40Choice4 {
6592    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6593        if let Some(ref val) = self.pty
6594            && config.validate_optional_fields
6595        {
6596            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6597        }
6598        if let Some(ref val) = self.agt
6599            && config.validate_optional_fields
6600        {
6601            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6602        }
6603    }
6604}
6605
6606// Party40Choice5: Identification of a financial institution.
6607#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6608pub struct Party40Choice5 {
6609    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6610    pub pty: Option<PartyIdentification1357>,
6611    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6612    pub agt: Option<BranchAndFinancialInstitutionIdentification66>,
6613}
6614
6615impl Validate for Party40Choice5 {
6616    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6617        if let Some(ref val) = self.pty
6618            && config.validate_optional_fields
6619        {
6620            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6621        }
6622        if let Some(ref val) = self.agt
6623            && config.validate_optional_fields
6624        {
6625            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6626        }
6627    }
6628}
6629
6630// PartyIdentification1351: Set of elements used to indicate how to contact the party.
6631#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6632pub struct PartyIdentification1351 {
6633    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6634    pub nm: Option<String>,
6635    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6636    pub pstl_adr: Option<PostalAddress241>,
6637    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6638    pub id: Option<Party38Choice1>,
6639    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6640    pub ctct_dtls: Option<Contact41>,
6641}
6642
6643impl Validate for PartyIdentification1351 {
6644    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6645        if let Some(ref val) = self.nm {
6646            helpers::validate_length(
6647                val,
6648                "Nm",
6649                Some(1),
6650                Some(140),
6651                &helpers::child_path(path, "Nm"),
6652                config,
6653                collector,
6654            );
6655        }
6656        if let Some(ref val) = self.nm {
6657            helpers::validate_pattern(
6658                val,
6659                "Nm",
6660                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6661                &helpers::child_path(path, "Nm"),
6662                config,
6663                collector,
6664            );
6665        }
6666        if let Some(ref val) = self.pstl_adr
6667            && config.validate_optional_fields
6668        {
6669            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6670        }
6671        if let Some(ref val) = self.id
6672            && config.validate_optional_fields
6673        {
6674            val.validate(&helpers::child_path(path, "Id"), config, collector);
6675        }
6676        if let Some(ref val) = self.ctct_dtls
6677            && config.validate_optional_fields
6678        {
6679            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6680        }
6681    }
6682}
6683
6684// PartyIdentification13510: Set of elements used to indicate how to contact the party.
6685#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6686pub struct PartyIdentification13510 {
6687    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6688    pub nm: Option<String>,
6689    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6690    pub pstl_adr: Option<PostalAddress243>,
6691    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6692    pub id: Option<Party38Choice1>,
6693    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6694    pub ctry_of_res: Option<String>,
6695    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6696    pub ctct_dtls: Option<Contact42>,
6697}
6698
6699impl Validate for PartyIdentification13510 {
6700    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6701        if let Some(ref val) = self.nm {
6702            helpers::validate_length(
6703                val,
6704                "Nm",
6705                Some(1),
6706                Some(140),
6707                &helpers::child_path(path, "Nm"),
6708                config,
6709                collector,
6710            );
6711        }
6712        if let Some(ref val) = self.nm {
6713            helpers::validate_pattern(
6714                val,
6715                "Nm",
6716                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6717                &helpers::child_path(path, "Nm"),
6718                config,
6719                collector,
6720            );
6721        }
6722        if let Some(ref val) = self.pstl_adr
6723            && config.validate_optional_fields
6724        {
6725            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6726        }
6727        if let Some(ref val) = self.id
6728            && config.validate_optional_fields
6729        {
6730            val.validate(&helpers::child_path(path, "Id"), config, collector);
6731        }
6732        if let Some(ref val) = self.ctry_of_res {
6733            helpers::validate_pattern(
6734                val,
6735                "CtryOfRes",
6736                "[A-Z]{2,2}",
6737                &helpers::child_path(path, "CtryOfRes"),
6738                config,
6739                collector,
6740            );
6741        }
6742        if let Some(ref val) = self.ctct_dtls
6743            && config.validate_optional_fields
6744        {
6745            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6746        }
6747    }
6748}
6749
6750// 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.
6751#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6752pub struct PartyIdentification1352 {
6753    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6754    pub nm: Option<String>,
6755    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6756    pub pstl_adr: Option<PostalAddress241>,
6757    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6758    pub id: Option<Party38Choice1>,
6759    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6760    pub ctry_of_res: Option<String>,
6761}
6762
6763impl Validate for PartyIdentification1352 {
6764    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6765        if let Some(ref val) = self.nm {
6766            helpers::validate_length(
6767                val,
6768                "Nm",
6769                Some(1),
6770                Some(140),
6771                &helpers::child_path(path, "Nm"),
6772                config,
6773                collector,
6774            );
6775        }
6776        if let Some(ref val) = self.nm {
6777            helpers::validate_pattern(
6778                val,
6779                "Nm",
6780                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6781                &helpers::child_path(path, "Nm"),
6782                config,
6783                collector,
6784            );
6785        }
6786        if let Some(ref val) = self.pstl_adr
6787            && config.validate_optional_fields
6788        {
6789            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6790        }
6791        if let Some(ref val) = self.id
6792            && config.validate_optional_fields
6793        {
6794            val.validate(&helpers::child_path(path, "Id"), config, collector);
6795        }
6796        if let Some(ref val) = self.ctry_of_res {
6797            helpers::validate_pattern(
6798                val,
6799                "CtryOfRes",
6800                "[A-Z]{2,2}",
6801                &helpers::child_path(path, "CtryOfRes"),
6802                config,
6803                collector,
6804            );
6805        }
6806    }
6807}
6808
6809// PartyIdentification1353: Country in which a person resides (the place of a person's home). In the case of a company, it is the country from which the affairs of that company are directed.
6810#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6811pub struct PartyIdentification1353 {
6812    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6813    pub nm: Option<String>,
6814    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6815    pub pstl_adr: Option<PostalAddress241>,
6816    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6817    pub id: Option<Party38Choice2>,
6818    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6819    pub ctry_of_res: Option<String>,
6820}
6821
6822impl Validate for PartyIdentification1353 {
6823    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6824        if let Some(ref val) = self.nm {
6825            helpers::validate_length(
6826                val,
6827                "Nm",
6828                Some(1),
6829                Some(140),
6830                &helpers::child_path(path, "Nm"),
6831                config,
6832                collector,
6833            );
6834        }
6835        if let Some(ref val) = self.nm {
6836            helpers::validate_pattern(
6837                val,
6838                "Nm",
6839                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6840                &helpers::child_path(path, "Nm"),
6841                config,
6842                collector,
6843            );
6844        }
6845        if let Some(ref val) = self.pstl_adr
6846            && config.validate_optional_fields
6847        {
6848            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6849        }
6850        if let Some(ref val) = self.id
6851            && config.validate_optional_fields
6852        {
6853            val.validate(&helpers::child_path(path, "Id"), config, collector);
6854        }
6855        if let Some(ref val) = self.ctry_of_res {
6856            helpers::validate_pattern(
6857                val,
6858                "CtryOfRes",
6859                "[A-Z]{2,2}",
6860                &helpers::child_path(path, "CtryOfRes"),
6861                config,
6862                collector,
6863            );
6864        }
6865    }
6866}
6867
6868// PartyIdentification1354: Set of elements used to indicate how to contact the party.
6869#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6870pub struct PartyIdentification1354 {
6871    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6872    pub nm: Option<String>,
6873    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6874    pub pstl_adr: Option<PostalAddress243>,
6875    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6876    pub id: Option<Party38Choice3>,
6877    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6878    pub ctry_of_res: Option<String>,
6879    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6880    pub ctct_dtls: Option<Contact42>,
6881}
6882
6883impl Validate for PartyIdentification1354 {
6884    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6885        if let Some(ref val) = self.nm {
6886            helpers::validate_length(
6887                val,
6888                "Nm",
6889                Some(1),
6890                Some(140),
6891                &helpers::child_path(path, "Nm"),
6892                config,
6893                collector,
6894            );
6895        }
6896        if let Some(ref val) = self.nm {
6897            helpers::validate_pattern(
6898                val,
6899                "Nm",
6900                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6901                &helpers::child_path(path, "Nm"),
6902                config,
6903                collector,
6904            );
6905        }
6906        if let Some(ref val) = self.pstl_adr
6907            && config.validate_optional_fields
6908        {
6909            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6910        }
6911        if let Some(ref val) = self.id
6912            && config.validate_optional_fields
6913        {
6914            val.validate(&helpers::child_path(path, "Id"), config, collector);
6915        }
6916        if let Some(ref val) = self.ctry_of_res {
6917            helpers::validate_pattern(
6918                val,
6919                "CtryOfRes",
6920                "[A-Z]{2,2}",
6921                &helpers::child_path(path, "CtryOfRes"),
6922                config,
6923                collector,
6924            );
6925        }
6926        if let Some(ref val) = self.ctct_dtls
6927            && config.validate_optional_fields
6928        {
6929            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6930        }
6931    }
6932}
6933
6934// PartyIdentification1355: Set of elements used to indicate how to contact the party.
6935#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6936pub struct PartyIdentification1355 {
6937    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6938    pub nm: Option<String>,
6939    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6940    pub pstl_adr: Option<PostalAddress241>,
6941    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6942    pub id: Option<Party38Choice1>,
6943    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6944    pub ctry_of_res: Option<String>,
6945    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6946    pub ctct_dtls: Option<Contact43>,
6947}
6948
6949impl Validate for PartyIdentification1355 {
6950    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6951        if let Some(ref val) = self.nm {
6952            helpers::validate_length(
6953                val,
6954                "Nm",
6955                Some(1),
6956                Some(140),
6957                &helpers::child_path(path, "Nm"),
6958                config,
6959                collector,
6960            );
6961        }
6962        if let Some(ref val) = self.nm {
6963            helpers::validate_pattern(
6964                val,
6965                "Nm",
6966                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6967                &helpers::child_path(path, "Nm"),
6968                config,
6969                collector,
6970            );
6971        }
6972        if let Some(ref val) = self.pstl_adr
6973            && config.validate_optional_fields
6974        {
6975            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6976        }
6977        if let Some(ref val) = self.id
6978            && config.validate_optional_fields
6979        {
6980            val.validate(&helpers::child_path(path, "Id"), config, collector);
6981        }
6982        if let Some(ref val) = self.ctry_of_res {
6983            helpers::validate_pattern(
6984                val,
6985                "CtryOfRes",
6986                "[A-Z]{2,2}",
6987                &helpers::child_path(path, "CtryOfRes"),
6988                config,
6989                collector,
6990            );
6991        }
6992        if let Some(ref val) = self.ctct_dtls
6993            && config.validate_optional_fields
6994        {
6995            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6996        }
6997    }
6998}
6999
7000// PartyIdentification1356: Set of elements used to indicate how to contact the party.
7001#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7002pub struct PartyIdentification1356 {
7003    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7004    pub nm: Option<String>,
7005    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7006    pub pstl_adr: Option<PostalAddress241>,
7007    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7008    pub id: Option<Party38Choice1>,
7009    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7010    pub ctry_of_res: Option<String>,
7011    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7012    pub ctct_dtls: Option<Contact41>,
7013}
7014
7015impl Validate for PartyIdentification1356 {
7016    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7017        if let Some(ref val) = self.nm {
7018            helpers::validate_length(
7019                val,
7020                "Nm",
7021                Some(1),
7022                Some(140),
7023                &helpers::child_path(path, "Nm"),
7024                config,
7025                collector,
7026            );
7027        }
7028        if let Some(ref val) = self.nm {
7029            helpers::validate_pattern(
7030                val,
7031                "Nm",
7032                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7033                &helpers::child_path(path, "Nm"),
7034                config,
7035                collector,
7036            );
7037        }
7038        if let Some(ref val) = self.pstl_adr
7039            && config.validate_optional_fields
7040        {
7041            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
7042        }
7043        if let Some(ref val) = self.id
7044            && config.validate_optional_fields
7045        {
7046            val.validate(&helpers::child_path(path, "Id"), config, collector);
7047        }
7048        if let Some(ref val) = self.ctry_of_res {
7049            helpers::validate_pattern(
7050                val,
7051                "CtryOfRes",
7052                "[A-Z]{2,2}",
7053                &helpers::child_path(path, "CtryOfRes"),
7054                config,
7055                collector,
7056            );
7057        }
7058        if let Some(ref val) = self.ctct_dtls
7059            && config.validate_optional_fields
7060        {
7061            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
7062        }
7063    }
7064}
7065
7066// PartyIdentification1357: Set of elements used to indicate how to contact the party.
7067#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7068pub struct PartyIdentification1357 {
7069    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7070    pub nm: Option<String>,
7071    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7072    pub pstl_adr: Option<PostalAddress241>,
7073    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7074    pub id: Option<Party38Choice1>,
7075    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7076    pub ctry_of_res: Option<String>,
7077    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7078    pub ctct_dtls: Option<Contact41>,
7079}
7080
7081impl Validate for PartyIdentification1357 {
7082    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7083        if let Some(ref val) = self.nm {
7084            helpers::validate_length(
7085                val,
7086                "Nm",
7087                Some(1),
7088                Some(140),
7089                &helpers::child_path(path, "Nm"),
7090                config,
7091                collector,
7092            );
7093        }
7094        if let Some(ref val) = self.nm {
7095            helpers::validate_pattern(
7096                val,
7097                "Nm",
7098                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7099                &helpers::child_path(path, "Nm"),
7100                config,
7101                collector,
7102            );
7103        }
7104        if let Some(ref val) = self.pstl_adr
7105            && config.validate_optional_fields
7106        {
7107            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
7108        }
7109        if let Some(ref val) = self.id
7110            && config.validate_optional_fields
7111        {
7112            val.validate(&helpers::child_path(path, "Id"), config, collector);
7113        }
7114        if let Some(ref val) = self.ctry_of_res {
7115            helpers::validate_pattern(
7116                val,
7117                "CtryOfRes",
7118                "[A-Z]{2,2}",
7119                &helpers::child_path(path, "CtryOfRes"),
7120                config,
7121                collector,
7122            );
7123        }
7124        if let Some(ref val) = self.ctct_dtls
7125            && config.validate_optional_fields
7126        {
7127            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
7128        }
7129    }
7130}
7131
7132// PartyIdentification1358: Set of elements used to indicate how to contact the party.
7133#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7134pub struct PartyIdentification1358 {
7135    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7136    pub nm: Option<String>,
7137    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7138    pub pstl_adr: Option<PostalAddress241>,
7139    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7140    pub id: Option<Party38Choice1>,
7141    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7142    pub ctry_of_res: Option<String>,
7143    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7144    pub ctct_dtls: Option<Contact43>,
7145}
7146
7147impl Validate for PartyIdentification1358 {
7148    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7149        if let Some(ref val) = self.nm {
7150            helpers::validate_length(
7151                val,
7152                "Nm",
7153                Some(1),
7154                Some(140),
7155                &helpers::child_path(path, "Nm"),
7156                config,
7157                collector,
7158            );
7159        }
7160        if let Some(ref val) = self.nm {
7161            helpers::validate_pattern(
7162                val,
7163                "Nm",
7164                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7165                &helpers::child_path(path, "Nm"),
7166                config,
7167                collector,
7168            );
7169        }
7170        if let Some(ref val) = self.pstl_adr
7171            && config.validate_optional_fields
7172        {
7173            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
7174        }
7175        if let Some(ref val) = self.id
7176            && config.validate_optional_fields
7177        {
7178            val.validate(&helpers::child_path(path, "Id"), config, collector);
7179        }
7180        if let Some(ref val) = self.ctry_of_res {
7181            helpers::validate_pattern(
7182                val,
7183                "CtryOfRes",
7184                "[A-Z]{2,2}",
7185                &helpers::child_path(path, "CtryOfRes"),
7186                config,
7187                collector,
7188            );
7189        }
7190        if let Some(ref val) = self.ctct_dtls
7191            && config.validate_optional_fields
7192        {
7193            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
7194        }
7195    }
7196}
7197
7198// PartyIdentification1359: Set of elements used to indicate how to contact the party.
7199#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7200pub struct PartyIdentification1359 {
7201    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7202    pub nm: Option<String>,
7203    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7204    pub pstl_adr: Option<PostalAddress241>,
7205    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7206    pub id: Option<Party38Choice4>,
7207    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7208    pub ctry_of_res: Option<String>,
7209    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7210    pub ctct_dtls: Option<Contact43>,
7211}
7212
7213impl Validate for PartyIdentification1359 {
7214    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7215        if let Some(ref val) = self.nm {
7216            helpers::validate_length(
7217                val,
7218                "Nm",
7219                Some(1),
7220                Some(140),
7221                &helpers::child_path(path, "Nm"),
7222                config,
7223                collector,
7224            );
7225        }
7226        if let Some(ref val) = self.nm {
7227            helpers::validate_pattern(
7228                val,
7229                "Nm",
7230                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7231                &helpers::child_path(path, "Nm"),
7232                config,
7233                collector,
7234            );
7235        }
7236        if let Some(ref val) = self.pstl_adr
7237            && config.validate_optional_fields
7238        {
7239            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
7240        }
7241        if let Some(ref val) = self.id
7242            && config.validate_optional_fields
7243        {
7244            val.validate(&helpers::child_path(path, "Id"), config, collector);
7245        }
7246        if let Some(ref val) = self.ctry_of_res {
7247            helpers::validate_pattern(
7248                val,
7249                "CtryOfRes",
7250                "[A-Z]{2,2}",
7251                &helpers::child_path(path, "CtryOfRes"),
7252                config,
7253                collector,
7254            );
7255        }
7256        if let Some(ref val) = self.ctct_dtls
7257            && config.validate_optional_fields
7258        {
7259            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
7260        }
7261    }
7262}
7263
7264// PartyType3Code: Party to whom the card issuer delegates to authorise card payment transactions.
7265#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7266pub enum PartyType3Code {
7267    #[default]
7268    #[serde(rename = "OPOI")]
7269    CodeOPOI,
7270    #[serde(rename = "MERC")]
7271    CodeMERC,
7272    #[serde(rename = "ACCP")]
7273    CodeACCP,
7274    #[serde(rename = "ITAG")]
7275    CodeITAG,
7276    #[serde(rename = "ACQR")]
7277    CodeACQR,
7278    #[serde(rename = "CISS")]
7279    CodeCISS,
7280    #[serde(rename = "DLIS")]
7281    CodeDLIS,
7282}
7283
7284impl Validate for PartyType3Code {
7285    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7286        // Enum validation is typically empty
7287    }
7288}
7289
7290// PartyType4Code: Tax authority.
7291#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7292pub enum PartyType4Code {
7293    #[default]
7294    #[serde(rename = "MERC")]
7295    CodeMERC,
7296    #[serde(rename = "ACCP")]
7297    CodeACCP,
7298    #[serde(rename = "ITAG")]
7299    CodeITAG,
7300    #[serde(rename = "ACQR")]
7301    CodeACQR,
7302    #[serde(rename = "CISS")]
7303    CodeCISS,
7304    #[serde(rename = "TAXH")]
7305    CodeTAXH,
7306}
7307
7308impl Validate for PartyType4Code {
7309    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7310        // Enum validation is typically empty
7311    }
7312}
7313
7314// PaymentCard41: Additional card issuer specific data.
7315#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7316pub struct PaymentCard41 {
7317    #[serde(rename = "PlainCardData", skip_serializing_if = "Option::is_none")]
7318    pub plain_card_data: Option<PlainCardData11>,
7319    #[serde(rename = "CardCtryCd", skip_serializing_if = "Option::is_none")]
7320    pub card_ctry_cd: Option<String>,
7321    #[serde(rename = "CardBrnd", skip_serializing_if = "Option::is_none")]
7322    pub card_brnd: Option<GenericIdentification11>,
7323    #[serde(rename = "AddtlCardData", skip_serializing_if = "Option::is_none")]
7324    pub addtl_card_data: Option<String>,
7325}
7326
7327impl Validate for PaymentCard41 {
7328    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7329        if let Some(ref val) = self.plain_card_data
7330            && config.validate_optional_fields
7331        {
7332            val.validate(
7333                &helpers::child_path(path, "PlainCardData"),
7334                config,
7335                collector,
7336            );
7337        }
7338        if let Some(ref val) = self.card_ctry_cd {
7339            helpers::validate_pattern(
7340                val,
7341                "CardCtryCd",
7342                "[0-9]{3}",
7343                &helpers::child_path(path, "CardCtryCd"),
7344                config,
7345                collector,
7346            );
7347        }
7348        if let Some(ref val) = self.card_brnd
7349            && config.validate_optional_fields
7350        {
7351            val.validate(&helpers::child_path(path, "CardBrnd"), config, collector);
7352        }
7353        if let Some(ref val) = self.addtl_card_data {
7354            helpers::validate_length(
7355                val,
7356                "AddtlCardData",
7357                Some(1),
7358                Some(70),
7359                &helpers::child_path(path, "AddtlCardData"),
7360                config,
7361                collector,
7362            );
7363        }
7364        if let Some(ref val) = self.addtl_card_data {
7365            helpers::validate_pattern(
7366                val,
7367                "AddtlCardData",
7368                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7369                &helpers::child_path(path, "AddtlCardData"),
7370                config,
7371                collector,
7372            );
7373        }
7374    }
7375}
7376
7377// PaymentContext3: Method used to authenticate a cardholder.
7378#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7379pub struct PaymentContext3 {
7380    #[serde(rename = "CardPres", skip_serializing_if = "Option::is_none")]
7381    pub card_pres: Option<bool>,
7382    #[serde(rename = "CrdhldrPres", skip_serializing_if = "Option::is_none")]
7383    pub crdhldr_pres: Option<bool>,
7384    #[serde(rename = "OnLineCntxt", skip_serializing_if = "Option::is_none")]
7385    pub on_line_cntxt: Option<bool>,
7386    #[serde(rename = "AttndncCntxt", skip_serializing_if = "Option::is_none")]
7387    pub attndnc_cntxt: Option<AttendanceContext1Code>,
7388    #[serde(rename = "TxEnvt", skip_serializing_if = "Option::is_none")]
7389    pub tx_envt: Option<TransactionEnvironment1Code>,
7390    #[serde(rename = "TxChanl", skip_serializing_if = "Option::is_none")]
7391    pub tx_chanl: Option<TransactionChannel1Code>,
7392    #[serde(rename = "AttndntMsgCpbl", skip_serializing_if = "Option::is_none")]
7393    pub attndnt_msg_cpbl: Option<bool>,
7394    #[serde(rename = "AttndntLang", skip_serializing_if = "Option::is_none")]
7395    pub attndnt_lang: Option<String>,
7396    #[serde(rename = "CardDataNtryMd")]
7397    pub card_data_ntry_md: CardDataReading1Code,
7398    #[serde(rename = "FllbckInd", skip_serializing_if = "Option::is_none")]
7399    pub fllbck_ind: Option<bool>,
7400    #[serde(rename = "AuthntcnMtd", skip_serializing_if = "Option::is_none")]
7401    pub authntcn_mtd: Option<CardholderAuthentication2>,
7402}
7403
7404impl Validate for PaymentContext3 {
7405    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7406        if let Some(ref val) = self.attndnc_cntxt
7407            && config.validate_optional_fields
7408        {
7409            val.validate(
7410                &helpers::child_path(path, "AttndncCntxt"),
7411                config,
7412                collector,
7413            );
7414        }
7415        if let Some(ref val) = self.tx_envt
7416            && config.validate_optional_fields
7417        {
7418            val.validate(&helpers::child_path(path, "TxEnvt"), config, collector);
7419        }
7420        if let Some(ref val) = self.tx_chanl
7421            && config.validate_optional_fields
7422        {
7423            val.validate(&helpers::child_path(path, "TxChanl"), config, collector);
7424        }
7425        if let Some(ref val) = self.attndnt_lang {
7426            helpers::validate_pattern(
7427                val,
7428                "AttndntLang",
7429                "[a-z]{2,2}",
7430                &helpers::child_path(path, "AttndntLang"),
7431                config,
7432                collector,
7433            );
7434        }
7435        self.card_data_ntry_md.validate(
7436            &helpers::child_path(path, "CardDataNtryMd"),
7437            config,
7438            collector,
7439        );
7440        if let Some(ref val) = self.authntcn_mtd
7441            && config.validate_optional_fields
7442        {
7443            val.validate(&helpers::child_path(path, "AuthntcnMtd"), config, collector);
7444        }
7445    }
7446}
7447
7448// PaymentReturnReason51: Further details on the return reason.
7449#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7450pub struct PaymentReturnReason51 {
7451    #[serde(rename = "OrgnlBkTxCd", skip_serializing_if = "Option::is_none")]
7452    pub orgnl_bk_tx_cd: Option<BankTransactionCodeStructure41>,
7453    #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
7454    pub orgtr: Option<PartyIdentification13510>,
7455    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
7456    pub rsn: Option<ReturnReason5Choice1>,
7457    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
7458    pub addtl_inf: Option<Vec<String>>,
7459}
7460
7461impl Validate for PaymentReturnReason51 {
7462    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7463        if let Some(ref val) = self.orgnl_bk_tx_cd
7464            && config.validate_optional_fields
7465        {
7466            val.validate(&helpers::child_path(path, "OrgnlBkTxCd"), config, collector);
7467        }
7468        if let Some(ref val) = self.orgtr
7469            && config.validate_optional_fields
7470        {
7471            val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
7472        }
7473        if let Some(ref val) = self.rsn
7474            && config.validate_optional_fields
7475        {
7476            val.validate(&helpers::child_path(path, "Rsn"), config, collector);
7477        }
7478        if let Some(ref vec) = self.addtl_inf {
7479            for item in vec {
7480                helpers::validate_length(
7481                    item,
7482                    "AddtlInf",
7483                    Some(1),
7484                    Some(105),
7485                    &helpers::child_path(path, "AddtlInf"),
7486                    config,
7487                    collector,
7488                );
7489            }
7490        }
7491        if let Some(ref vec) = self.addtl_inf {
7492            for item in vec {
7493                helpers::validate_pattern(
7494                    item,
7495                    "AddtlInf",
7496                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7497                    &helpers::child_path(path, "AddtlInf"),
7498                    config,
7499                    collector,
7500                );
7501            }
7502        }
7503    }
7504}
7505
7506// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
7507#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7508pub struct PersonIdentification131 {
7509    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7510    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7511    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7512    pub othr: Option<Vec<GenericPersonIdentification11>>,
7513}
7514
7515impl Validate for PersonIdentification131 {
7516    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7517        if let Some(ref val) = self.dt_and_plc_of_birth
7518            && config.validate_optional_fields
7519        {
7520            val.validate(
7521                &helpers::child_path(path, "DtAndPlcOfBirth"),
7522                config,
7523                collector,
7524            );
7525        }
7526        if let Some(ref vec) = self.othr
7527            && config.validate_optional_fields
7528        {
7529            for item in vec {
7530                item.validate(&helpers::child_path(path, "Othr"), config, collector);
7531            }
7532        }
7533    }
7534}
7535
7536// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
7537#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7538pub struct PersonIdentification132 {
7539    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7540    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7541    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7542    pub othr: Option<Vec<GenericPersonIdentification11>>,
7543}
7544
7545impl Validate for PersonIdentification132 {
7546    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7547        if let Some(ref val) = self.dt_and_plc_of_birth
7548            && config.validate_optional_fields
7549        {
7550            val.validate(
7551                &helpers::child_path(path, "DtAndPlcOfBirth"),
7552                config,
7553                collector,
7554            );
7555        }
7556        if let Some(ref vec) = self.othr
7557            && config.validate_optional_fields
7558        {
7559            for item in vec {
7560                item.validate(&helpers::child_path(path, "Othr"), config, collector);
7561            }
7562        }
7563    }
7564}
7565
7566// PersonIdentification133: Unique identification of a person, as assigned by an institution, using an identification scheme.
7567#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7568pub struct PersonIdentification133 {
7569    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7570    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7571    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7572    pub othr: Option<Vec<GenericPersonIdentification12>>,
7573}
7574
7575impl Validate for PersonIdentification133 {
7576    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7577        if let Some(ref val) = self.dt_and_plc_of_birth
7578            && config.validate_optional_fields
7579        {
7580            val.validate(
7581                &helpers::child_path(path, "DtAndPlcOfBirth"),
7582                config,
7583                collector,
7584            );
7585        }
7586        if let Some(ref vec) = self.othr
7587            && config.validate_optional_fields
7588        {
7589            for item in vec {
7590                item.validate(&helpers::child_path(path, "Othr"), config, collector);
7591            }
7592        }
7593    }
7594}
7595
7596// PersonIdentification134: Unique identification of a person, as assigned by an institution, using an identification scheme.
7597#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7598pub struct PersonIdentification134 {
7599    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7600    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7601    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7602    pub othr: Option<Vec<GenericPersonIdentification13>>,
7603}
7604
7605impl Validate for PersonIdentification134 {
7606    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7607        if let Some(ref val) = self.dt_and_plc_of_birth
7608            && config.validate_optional_fields
7609        {
7610            val.validate(
7611                &helpers::child_path(path, "DtAndPlcOfBirth"),
7612                config,
7613                collector,
7614            );
7615        }
7616        if let Some(ref vec) = self.othr
7617            && config.validate_optional_fields
7618        {
7619            for item in vec {
7620                item.validate(&helpers::child_path(path, "Othr"), config, collector);
7621            }
7622        }
7623    }
7624}
7625
7626// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
7627#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7628pub struct PersonIdentificationSchemeName1Choice1 {
7629    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
7630    pub cd: Option<String>,
7631    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
7632    pub prtry: Option<String>,
7633}
7634
7635impl Validate for PersonIdentificationSchemeName1Choice1 {
7636    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7637        if let Some(ref val) = self.cd {
7638            helpers::validate_length(
7639                val,
7640                "Cd",
7641                Some(1),
7642                Some(4),
7643                &helpers::child_path(path, "Cd"),
7644                config,
7645                collector,
7646            );
7647        }
7648        if let Some(ref val) = self.prtry {
7649            helpers::validate_length(
7650                val,
7651                "Prtry",
7652                Some(1),
7653                Some(35),
7654                &helpers::child_path(path, "Prtry"),
7655                config,
7656                collector,
7657            );
7658        }
7659        if let Some(ref val) = self.prtry {
7660            helpers::validate_pattern(
7661                val,
7662                "Prtry",
7663                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7664                &helpers::child_path(path, "Prtry"),
7665                config,
7666                collector,
7667            );
7668        }
7669    }
7670}
7671
7672// PersonIdentificationSchemeName1Choice2: Name of the identification scheme, in a free text form.
7673#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7674pub struct PersonIdentificationSchemeName1Choice2 {
7675    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
7676    pub cd: Option<String>,
7677    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
7678    pub prtry: Option<String>,
7679}
7680
7681impl Validate for PersonIdentificationSchemeName1Choice2 {
7682    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7683        if let Some(ref val) = self.cd {
7684            helpers::validate_length(
7685                val,
7686                "Cd",
7687                Some(1),
7688                Some(4),
7689                &helpers::child_path(path, "Cd"),
7690                config,
7691                collector,
7692            );
7693        }
7694        if let Some(ref val) = self.prtry {
7695            helpers::validate_length(
7696                val,
7697                "Prtry",
7698                Some(1),
7699                Some(35),
7700                &helpers::child_path(path, "Prtry"),
7701                config,
7702                collector,
7703            );
7704        }
7705        if let Some(ref val) = self.prtry {
7706            helpers::validate_pattern(
7707                val,
7708                "Prtry",
7709                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7710                &helpers::child_path(path, "Prtry"),
7711                config,
7712                collector,
7713            );
7714        }
7715    }
7716}
7717
7718// PlainCardData11: Card security code (CSC) associated with the card performing the transaction.
7719#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7720pub struct PlainCardData11 {
7721    #[serde(rename = "PAN")]
7722    pub pan: String,
7723    #[serde(rename = "CardSeqNb", skip_serializing_if = "Option::is_none")]
7724    pub card_seq_nb: Option<String>,
7725    #[serde(rename = "FctvDt", skip_serializing_if = "Option::is_none")]
7726    pub fctv_dt: Option<String>,
7727    #[serde(rename = "XpryDt")]
7728    pub xpry_dt: String,
7729    #[serde(rename = "SvcCd", skip_serializing_if = "Option::is_none")]
7730    pub svc_cd: Option<String>,
7731    #[serde(rename = "TrckData", skip_serializing_if = "Option::is_none")]
7732    pub trck_data: Option<Vec<TrackData11>>,
7733    #[serde(rename = "CardSctyCd", skip_serializing_if = "Option::is_none")]
7734    pub card_scty_cd: Option<CardSecurityInformation1>,
7735}
7736
7737impl Validate for PlainCardData11 {
7738    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7739        helpers::validate_pattern(
7740            &self.pan,
7741            "PAN",
7742            "[0-9]{8,28}",
7743            &helpers::child_path(path, "PAN"),
7744            config,
7745            collector,
7746        );
7747        if let Some(ref val) = self.card_seq_nb {
7748            helpers::validate_pattern(
7749                val,
7750                "CardSeqNb",
7751                "[0-9]{2,3}",
7752                &helpers::child_path(path, "CardSeqNb"),
7753                config,
7754                collector,
7755            );
7756        }
7757        if let Some(ref val) = self.svc_cd {
7758            helpers::validate_pattern(
7759                val,
7760                "SvcCd",
7761                "[0-9]{3}",
7762                &helpers::child_path(path, "SvcCd"),
7763                config,
7764                collector,
7765            );
7766        }
7767        if let Some(ref vec) = self.trck_data
7768            && config.validate_optional_fields
7769        {
7770            for item in vec {
7771                item.validate(&helpers::child_path(path, "TrckData"), config, collector);
7772            }
7773        }
7774        if let Some(ref val) = self.card_scty_cd
7775            && config.validate_optional_fields
7776        {
7777            val.validate(&helpers::child_path(path, "CardSctyCd"), config, collector);
7778        }
7779    }
7780}
7781
7782// PointOfInteraction11: Data related to a component of the POI performing the transaction.
7783#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7784pub struct PointOfInteraction11 {
7785    #[serde(rename = "Id")]
7786    pub id: GenericIdentification321,
7787    #[serde(rename = "SysNm", skip_serializing_if = "Option::is_none")]
7788    pub sys_nm: Option<String>,
7789    #[serde(rename = "GrpId", skip_serializing_if = "Option::is_none")]
7790    pub grp_id: Option<String>,
7791    #[serde(rename = "Cpblties", skip_serializing_if = "Option::is_none")]
7792    pub cpblties: Option<PointOfInteractionCapabilities1>,
7793    #[serde(rename = "Cmpnt", skip_serializing_if = "Option::is_none")]
7794    pub cmpnt: Option<Vec<PointOfInteractionComponent11>>,
7795}
7796
7797impl Validate for PointOfInteraction11 {
7798    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7799        self.id
7800            .validate(&helpers::child_path(path, "Id"), config, collector);
7801        if let Some(ref val) = self.sys_nm {
7802            helpers::validate_length(
7803                val,
7804                "SysNm",
7805                Some(1),
7806                Some(70),
7807                &helpers::child_path(path, "SysNm"),
7808                config,
7809                collector,
7810            );
7811        }
7812        if let Some(ref val) = self.sys_nm {
7813            helpers::validate_pattern(
7814                val,
7815                "SysNm",
7816                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7817                &helpers::child_path(path, "SysNm"),
7818                config,
7819                collector,
7820            );
7821        }
7822        if let Some(ref val) = self.grp_id {
7823            helpers::validate_length(
7824                val,
7825                "GrpId",
7826                Some(1),
7827                Some(35),
7828                &helpers::child_path(path, "GrpId"),
7829                config,
7830                collector,
7831            );
7832        }
7833        if let Some(ref val) = self.grp_id {
7834            helpers::validate_pattern(
7835                val,
7836                "GrpId",
7837                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7838                &helpers::child_path(path, "GrpId"),
7839                config,
7840                collector,
7841            );
7842        }
7843        if let Some(ref val) = self.cpblties
7844            && config.validate_optional_fields
7845        {
7846            val.validate(&helpers::child_path(path, "Cpblties"), config, collector);
7847        }
7848        if let Some(ref vec) = self.cmpnt
7849            && config.validate_optional_fields
7850        {
7851            for item in vec {
7852                item.validate(&helpers::child_path(path, "Cmpnt"), config, collector);
7853            }
7854        }
7855    }
7856}
7857
7858// PointOfInteractionCapabilities1: Number of columns of the printer component.
7859#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7860pub struct PointOfInteractionCapabilities1 {
7861    #[serde(rename = "CardRdngCpblties", skip_serializing_if = "Option::is_none")]
7862    pub card_rdng_cpblties: Option<Vec<CardDataReading1Code>>,
7863    #[serde(
7864        rename = "CrdhldrVrfctnCpblties",
7865        skip_serializing_if = "Option::is_none"
7866    )]
7867    pub crdhldr_vrfctn_cpblties: Option<Vec<CardholderVerificationCapability1Code>>,
7868    #[serde(rename = "OnLineCpblties", skip_serializing_if = "Option::is_none")]
7869    pub on_line_cpblties: Option<OnLineCapability1Code>,
7870    #[serde(rename = "DispCpblties", skip_serializing_if = "Option::is_none")]
7871    pub disp_cpblties: Option<Vec<DisplayCapabilities1>>,
7872    #[serde(rename = "PrtLineWidth", skip_serializing_if = "Option::is_none")]
7873    pub prt_line_width: Option<String>,
7874}
7875
7876impl Validate for PointOfInteractionCapabilities1 {
7877    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7878        if let Some(ref vec) = self.card_rdng_cpblties
7879            && config.validate_optional_fields
7880        {
7881            for item in vec {
7882                item.validate(
7883                    &helpers::child_path(path, "CardRdngCpblties"),
7884                    config,
7885                    collector,
7886                );
7887            }
7888        }
7889        if let Some(ref vec) = self.crdhldr_vrfctn_cpblties
7890            && config.validate_optional_fields
7891        {
7892            for item in vec {
7893                item.validate(
7894                    &helpers::child_path(path, "CrdhldrVrfctnCpblties"),
7895                    config,
7896                    collector,
7897                );
7898            }
7899        }
7900        if let Some(ref val) = self.on_line_cpblties
7901            && config.validate_optional_fields
7902        {
7903            val.validate(
7904                &helpers::child_path(path, "OnLineCpblties"),
7905                config,
7906                collector,
7907            );
7908        }
7909        if let Some(ref vec) = self.disp_cpblties
7910            && config.validate_optional_fields
7911        {
7912            for item in vec {
7913                item.validate(
7914                    &helpers::child_path(path, "DispCpblties"),
7915                    config,
7916                    collector,
7917                );
7918            }
7919        }
7920        if let Some(ref val) = self.prt_line_width {
7921            helpers::validate_pattern(
7922                val,
7923                "PrtLineWidth",
7924                "[0-9]{1,3}",
7925                &helpers::child_path(path, "PrtLineWidth"),
7926                config,
7927                collector,
7928            );
7929        }
7930    }
7931}
7932
7933// PointOfInteractionComponent11: Unique approval number for a component, delivered by a certification body.
7934// 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).
7935#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7936pub struct PointOfInteractionComponent11 {
7937    #[serde(rename = "POICmpntTp")]
7938    pub poi_cmpnt_tp: POIComponentType1Code,
7939    #[serde(rename = "ManfctrId", skip_serializing_if = "Option::is_none")]
7940    pub manfctr_id: Option<String>,
7941    #[serde(rename = "Mdl", skip_serializing_if = "Option::is_none")]
7942    pub mdl: Option<String>,
7943    #[serde(rename = "VrsnNb", skip_serializing_if = "Option::is_none")]
7944    pub vrsn_nb: Option<String>,
7945    #[serde(rename = "SrlNb", skip_serializing_if = "Option::is_none")]
7946    pub srl_nb: Option<String>,
7947    #[serde(rename = "ApprvlNb", skip_serializing_if = "Option::is_none")]
7948    pub apprvl_nb: Option<Vec<String>>,
7949}
7950
7951impl Validate for PointOfInteractionComponent11 {
7952    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7953        self.poi_cmpnt_tp
7954            .validate(&helpers::child_path(path, "POICmpntTp"), config, collector);
7955        if let Some(ref val) = self.manfctr_id {
7956            helpers::validate_length(
7957                val,
7958                "ManfctrId",
7959                Some(1),
7960                Some(35),
7961                &helpers::child_path(path, "ManfctrId"),
7962                config,
7963                collector,
7964            );
7965        }
7966        if let Some(ref val) = self.manfctr_id {
7967            helpers::validate_pattern(
7968                val,
7969                "ManfctrId",
7970                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7971                &helpers::child_path(path, "ManfctrId"),
7972                config,
7973                collector,
7974            );
7975        }
7976        if let Some(ref val) = self.mdl {
7977            helpers::validate_length(
7978                val,
7979                "Mdl",
7980                Some(1),
7981                Some(35),
7982                &helpers::child_path(path, "Mdl"),
7983                config,
7984                collector,
7985            );
7986        }
7987        if let Some(ref val) = self.mdl {
7988            helpers::validate_pattern(
7989                val,
7990                "Mdl",
7991                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7992                &helpers::child_path(path, "Mdl"),
7993                config,
7994                collector,
7995            );
7996        }
7997        if let Some(ref val) = self.vrsn_nb {
7998            helpers::validate_length(
7999                val,
8000                "VrsnNb",
8001                Some(1),
8002                Some(16),
8003                &helpers::child_path(path, "VrsnNb"),
8004                config,
8005                collector,
8006            );
8007        }
8008        if let Some(ref val) = self.vrsn_nb {
8009            helpers::validate_pattern(
8010                val,
8011                "VrsnNb",
8012                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8013                &helpers::child_path(path, "VrsnNb"),
8014                config,
8015                collector,
8016            );
8017        }
8018        if let Some(ref val) = self.srl_nb {
8019            helpers::validate_length(
8020                val,
8021                "SrlNb",
8022                Some(1),
8023                Some(35),
8024                &helpers::child_path(path, "SrlNb"),
8025                config,
8026                collector,
8027            );
8028        }
8029        if let Some(ref val) = self.srl_nb {
8030            helpers::validate_pattern(
8031                val,
8032                "SrlNb",
8033                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8034                &helpers::child_path(path, "SrlNb"),
8035                config,
8036                collector,
8037            );
8038        }
8039        if let Some(ref vec) = self.apprvl_nb {
8040            for item in vec {
8041                helpers::validate_length(
8042                    item,
8043                    "ApprvlNb",
8044                    Some(1),
8045                    Some(70),
8046                    &helpers::child_path(path, "ApprvlNb"),
8047                    config,
8048                    collector,
8049                );
8050            }
8051        }
8052        if let Some(ref vec) = self.apprvl_nb {
8053            for item in vec {
8054                helpers::validate_pattern(
8055                    item,
8056                    "ApprvlNb",
8057                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8058                    &helpers::child_path(path, "ApprvlNb"),
8059                    config,
8060                    collector,
8061                );
8062            }
8063        }
8064    }
8065}
8066
8067// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
8068#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8069pub struct PostalAddress241 {
8070    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
8071    pub adr_tp: Option<AddressType3Choice1>,
8072    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
8073    pub dept: Option<String>,
8074    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
8075    pub sub_dept: Option<String>,
8076    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
8077    pub strt_nm: Option<String>,
8078    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
8079    pub bldg_nb: Option<String>,
8080    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
8081    pub bldg_nm: Option<String>,
8082    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
8083    pub flr: Option<String>,
8084    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
8085    pub pst_bx: Option<String>,
8086    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
8087    pub room: Option<String>,
8088    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
8089    pub pst_cd: Option<String>,
8090    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
8091    pub twn_nm: Option<String>,
8092    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
8093    pub twn_lctn_nm: Option<String>,
8094    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
8095    pub dstrct_nm: Option<String>,
8096    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
8097    pub ctry_sub_dvsn: Option<String>,
8098    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
8099    pub ctry: Option<String>,
8100    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
8101    pub adr_line: Option<Vec<String>>,
8102}
8103
8104impl Validate for PostalAddress241 {
8105    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8106        if let Some(ref val) = self.adr_tp
8107            && config.validate_optional_fields
8108        {
8109            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
8110        }
8111        if let Some(ref val) = self.dept {
8112            helpers::validate_length(
8113                val,
8114                "Dept",
8115                Some(1),
8116                Some(70),
8117                &helpers::child_path(path, "Dept"),
8118                config,
8119                collector,
8120            );
8121        }
8122        if let Some(ref val) = self.dept {
8123            helpers::validate_pattern(
8124                val,
8125                "Dept",
8126                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8127                &helpers::child_path(path, "Dept"),
8128                config,
8129                collector,
8130            );
8131        }
8132        if let Some(ref val) = self.sub_dept {
8133            helpers::validate_length(
8134                val,
8135                "SubDept",
8136                Some(1),
8137                Some(70),
8138                &helpers::child_path(path, "SubDept"),
8139                config,
8140                collector,
8141            );
8142        }
8143        if let Some(ref val) = self.sub_dept {
8144            helpers::validate_pattern(
8145                val,
8146                "SubDept",
8147                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8148                &helpers::child_path(path, "SubDept"),
8149                config,
8150                collector,
8151            );
8152        }
8153        if let Some(ref val) = self.strt_nm {
8154            helpers::validate_length(
8155                val,
8156                "StrtNm",
8157                Some(1),
8158                Some(70),
8159                &helpers::child_path(path, "StrtNm"),
8160                config,
8161                collector,
8162            );
8163        }
8164        if let Some(ref val) = self.strt_nm {
8165            helpers::validate_pattern(
8166                val,
8167                "StrtNm",
8168                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8169                &helpers::child_path(path, "StrtNm"),
8170                config,
8171                collector,
8172            );
8173        }
8174        if let Some(ref val) = self.bldg_nb {
8175            helpers::validate_length(
8176                val,
8177                "BldgNb",
8178                Some(1),
8179                Some(16),
8180                &helpers::child_path(path, "BldgNb"),
8181                config,
8182                collector,
8183            );
8184        }
8185        if let Some(ref val) = self.bldg_nb {
8186            helpers::validate_pattern(
8187                val,
8188                "BldgNb",
8189                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8190                &helpers::child_path(path, "BldgNb"),
8191                config,
8192                collector,
8193            );
8194        }
8195        if let Some(ref val) = self.bldg_nm {
8196            helpers::validate_length(
8197                val,
8198                "BldgNm",
8199                Some(1),
8200                Some(35),
8201                &helpers::child_path(path, "BldgNm"),
8202                config,
8203                collector,
8204            );
8205        }
8206        if let Some(ref val) = self.bldg_nm {
8207            helpers::validate_pattern(
8208                val,
8209                "BldgNm",
8210                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8211                &helpers::child_path(path, "BldgNm"),
8212                config,
8213                collector,
8214            );
8215        }
8216        if let Some(ref val) = self.flr {
8217            helpers::validate_length(
8218                val,
8219                "Flr",
8220                Some(1),
8221                Some(70),
8222                &helpers::child_path(path, "Flr"),
8223                config,
8224                collector,
8225            );
8226        }
8227        if let Some(ref val) = self.flr {
8228            helpers::validate_pattern(
8229                val,
8230                "Flr",
8231                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8232                &helpers::child_path(path, "Flr"),
8233                config,
8234                collector,
8235            );
8236        }
8237        if let Some(ref val) = self.pst_bx {
8238            helpers::validate_length(
8239                val,
8240                "PstBx",
8241                Some(1),
8242                Some(16),
8243                &helpers::child_path(path, "PstBx"),
8244                config,
8245                collector,
8246            );
8247        }
8248        if let Some(ref val) = self.pst_bx {
8249            helpers::validate_pattern(
8250                val,
8251                "PstBx",
8252                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8253                &helpers::child_path(path, "PstBx"),
8254                config,
8255                collector,
8256            );
8257        }
8258        if let Some(ref val) = self.room {
8259            helpers::validate_length(
8260                val,
8261                "Room",
8262                Some(1),
8263                Some(70),
8264                &helpers::child_path(path, "Room"),
8265                config,
8266                collector,
8267            );
8268        }
8269        if let Some(ref val) = self.room {
8270            helpers::validate_pattern(
8271                val,
8272                "Room",
8273                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8274                &helpers::child_path(path, "Room"),
8275                config,
8276                collector,
8277            );
8278        }
8279        if let Some(ref val) = self.pst_cd {
8280            helpers::validate_length(
8281                val,
8282                "PstCd",
8283                Some(1),
8284                Some(16),
8285                &helpers::child_path(path, "PstCd"),
8286                config,
8287                collector,
8288            );
8289        }
8290        if let Some(ref val) = self.pst_cd {
8291            helpers::validate_pattern(
8292                val,
8293                "PstCd",
8294                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8295                &helpers::child_path(path, "PstCd"),
8296                config,
8297                collector,
8298            );
8299        }
8300        if let Some(ref val) = self.twn_nm {
8301            helpers::validate_length(
8302                val,
8303                "TwnNm",
8304                Some(1),
8305                Some(35),
8306                &helpers::child_path(path, "TwnNm"),
8307                config,
8308                collector,
8309            );
8310        }
8311        if let Some(ref val) = self.twn_nm {
8312            helpers::validate_pattern(
8313                val,
8314                "TwnNm",
8315                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8316                &helpers::child_path(path, "TwnNm"),
8317                config,
8318                collector,
8319            );
8320        }
8321        if let Some(ref val) = self.twn_lctn_nm {
8322            helpers::validate_length(
8323                val,
8324                "TwnLctnNm",
8325                Some(1),
8326                Some(35),
8327                &helpers::child_path(path, "TwnLctnNm"),
8328                config,
8329                collector,
8330            );
8331        }
8332        if let Some(ref val) = self.twn_lctn_nm {
8333            helpers::validate_pattern(
8334                val,
8335                "TwnLctnNm",
8336                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8337                &helpers::child_path(path, "TwnLctnNm"),
8338                config,
8339                collector,
8340            );
8341        }
8342        if let Some(ref val) = self.dstrct_nm {
8343            helpers::validate_length(
8344                val,
8345                "DstrctNm",
8346                Some(1),
8347                Some(35),
8348                &helpers::child_path(path, "DstrctNm"),
8349                config,
8350                collector,
8351            );
8352        }
8353        if let Some(ref val) = self.dstrct_nm {
8354            helpers::validate_pattern(
8355                val,
8356                "DstrctNm",
8357                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8358                &helpers::child_path(path, "DstrctNm"),
8359                config,
8360                collector,
8361            );
8362        }
8363        if let Some(ref val) = self.ctry_sub_dvsn {
8364            helpers::validate_length(
8365                val,
8366                "CtrySubDvsn",
8367                Some(1),
8368                Some(35),
8369                &helpers::child_path(path, "CtrySubDvsn"),
8370                config,
8371                collector,
8372            );
8373        }
8374        if let Some(ref val) = self.ctry_sub_dvsn {
8375            helpers::validate_pattern(
8376                val,
8377                "CtrySubDvsn",
8378                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8379                &helpers::child_path(path, "CtrySubDvsn"),
8380                config,
8381                collector,
8382            );
8383        }
8384        if let Some(ref val) = self.ctry {
8385            helpers::validate_pattern(
8386                val,
8387                "Ctry",
8388                "[A-Z]{2,2}",
8389                &helpers::child_path(path, "Ctry"),
8390                config,
8391                collector,
8392            );
8393        }
8394        if let Some(ref vec) = self.adr_line {
8395            for item in vec {
8396                helpers::validate_length(
8397                    item,
8398                    "AdrLine",
8399                    Some(1),
8400                    Some(70),
8401                    &helpers::child_path(path, "AdrLine"),
8402                    config,
8403                    collector,
8404                );
8405            }
8406        }
8407        if let Some(ref vec) = self.adr_line {
8408            for item in vec {
8409                helpers::validate_pattern(
8410                    item,
8411                    "AdrLine",
8412                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8413                    &helpers::child_path(path, "AdrLine"),
8414                    config,
8415                    collector,
8416                );
8417            }
8418        }
8419    }
8420}
8421
8422// PostalAddress242: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
8423#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8424pub struct PostalAddress242 {
8425    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
8426    pub adr_tp: Option<AddressType3Choice1>,
8427    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
8428    pub dept: Option<String>,
8429    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
8430    pub sub_dept: Option<String>,
8431    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
8432    pub strt_nm: Option<String>,
8433    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
8434    pub bldg_nb: Option<String>,
8435    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
8436    pub bldg_nm: Option<String>,
8437    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
8438    pub flr: Option<String>,
8439    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
8440    pub pst_bx: Option<String>,
8441    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
8442    pub room: Option<String>,
8443    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
8444    pub pst_cd: Option<String>,
8445    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
8446    pub twn_nm: Option<String>,
8447    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
8448    pub twn_lctn_nm: Option<String>,
8449    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
8450    pub dstrct_nm: Option<String>,
8451    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
8452    pub ctry_sub_dvsn: Option<String>,
8453    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
8454    pub ctry: Option<String>,
8455    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
8456    pub adr_line: Option<Vec<String>>,
8457}
8458
8459impl Validate for PostalAddress242 {
8460    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8461        if let Some(ref val) = self.adr_tp
8462            && config.validate_optional_fields
8463        {
8464            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
8465        }
8466        if let Some(ref val) = self.dept {
8467            helpers::validate_length(
8468                val,
8469                "Dept",
8470                Some(1),
8471                Some(70),
8472                &helpers::child_path(path, "Dept"),
8473                config,
8474                collector,
8475            );
8476        }
8477        if let Some(ref val) = self.dept {
8478            helpers::validate_pattern(
8479                val,
8480                "Dept",
8481                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8482                &helpers::child_path(path, "Dept"),
8483                config,
8484                collector,
8485            );
8486        }
8487        if let Some(ref val) = self.sub_dept {
8488            helpers::validate_length(
8489                val,
8490                "SubDept",
8491                Some(1),
8492                Some(70),
8493                &helpers::child_path(path, "SubDept"),
8494                config,
8495                collector,
8496            );
8497        }
8498        if let Some(ref val) = self.sub_dept {
8499            helpers::validate_pattern(
8500                val,
8501                "SubDept",
8502                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8503                &helpers::child_path(path, "SubDept"),
8504                config,
8505                collector,
8506            );
8507        }
8508        if let Some(ref val) = self.strt_nm {
8509            helpers::validate_length(
8510                val,
8511                "StrtNm",
8512                Some(1),
8513                Some(70),
8514                &helpers::child_path(path, "StrtNm"),
8515                config,
8516                collector,
8517            );
8518        }
8519        if let Some(ref val) = self.strt_nm {
8520            helpers::validate_pattern(
8521                val,
8522                "StrtNm",
8523                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8524                &helpers::child_path(path, "StrtNm"),
8525                config,
8526                collector,
8527            );
8528        }
8529        if let Some(ref val) = self.bldg_nb {
8530            helpers::validate_length(
8531                val,
8532                "BldgNb",
8533                Some(1),
8534                Some(35),
8535                &helpers::child_path(path, "BldgNb"),
8536                config,
8537                collector,
8538            );
8539        }
8540        if let Some(ref val) = self.bldg_nb {
8541            helpers::validate_pattern(
8542                val,
8543                "BldgNb",
8544                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8545                &helpers::child_path(path, "BldgNb"),
8546                config,
8547                collector,
8548            );
8549        }
8550        if let Some(ref val) = self.bldg_nm {
8551            helpers::validate_length(
8552                val,
8553                "BldgNm",
8554                Some(1),
8555                Some(35),
8556                &helpers::child_path(path, "BldgNm"),
8557                config,
8558                collector,
8559            );
8560        }
8561        if let Some(ref val) = self.bldg_nm {
8562            helpers::validate_pattern(
8563                val,
8564                "BldgNm",
8565                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8566                &helpers::child_path(path, "BldgNm"),
8567                config,
8568                collector,
8569            );
8570        }
8571        if let Some(ref val) = self.flr {
8572            helpers::validate_length(
8573                val,
8574                "Flr",
8575                Some(1),
8576                Some(70),
8577                &helpers::child_path(path, "Flr"),
8578                config,
8579                collector,
8580            );
8581        }
8582        if let Some(ref val) = self.flr {
8583            helpers::validate_pattern(
8584                val,
8585                "Flr",
8586                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8587                &helpers::child_path(path, "Flr"),
8588                config,
8589                collector,
8590            );
8591        }
8592        if let Some(ref val) = self.pst_bx {
8593            helpers::validate_length(
8594                val,
8595                "PstBx",
8596                Some(1),
8597                Some(16),
8598                &helpers::child_path(path, "PstBx"),
8599                config,
8600                collector,
8601            );
8602        }
8603        if let Some(ref val) = self.pst_bx {
8604            helpers::validate_pattern(
8605                val,
8606                "PstBx",
8607                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8608                &helpers::child_path(path, "PstBx"),
8609                config,
8610                collector,
8611            );
8612        }
8613        if let Some(ref val) = self.room {
8614            helpers::validate_length(
8615                val,
8616                "Room",
8617                Some(1),
8618                Some(70),
8619                &helpers::child_path(path, "Room"),
8620                config,
8621                collector,
8622            );
8623        }
8624        if let Some(ref val) = self.room {
8625            helpers::validate_pattern(
8626                val,
8627                "Room",
8628                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8629                &helpers::child_path(path, "Room"),
8630                config,
8631                collector,
8632            );
8633        }
8634        if let Some(ref val) = self.pst_cd {
8635            helpers::validate_length(
8636                val,
8637                "PstCd",
8638                Some(1),
8639                Some(16),
8640                &helpers::child_path(path, "PstCd"),
8641                config,
8642                collector,
8643            );
8644        }
8645        if let Some(ref val) = self.pst_cd {
8646            helpers::validate_pattern(
8647                val,
8648                "PstCd",
8649                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8650                &helpers::child_path(path, "PstCd"),
8651                config,
8652                collector,
8653            );
8654        }
8655        if let Some(ref val) = self.twn_nm {
8656            helpers::validate_length(
8657                val,
8658                "TwnNm",
8659                Some(1),
8660                Some(35),
8661                &helpers::child_path(path, "TwnNm"),
8662                config,
8663                collector,
8664            );
8665        }
8666        if let Some(ref val) = self.twn_nm {
8667            helpers::validate_pattern(
8668                val,
8669                "TwnNm",
8670                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8671                &helpers::child_path(path, "TwnNm"),
8672                config,
8673                collector,
8674            );
8675        }
8676        if let Some(ref val) = self.twn_lctn_nm {
8677            helpers::validate_length(
8678                val,
8679                "TwnLctnNm",
8680                Some(1),
8681                Some(35),
8682                &helpers::child_path(path, "TwnLctnNm"),
8683                config,
8684                collector,
8685            );
8686        }
8687        if let Some(ref val) = self.twn_lctn_nm {
8688            helpers::validate_pattern(
8689                val,
8690                "TwnLctnNm",
8691                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8692                &helpers::child_path(path, "TwnLctnNm"),
8693                config,
8694                collector,
8695            );
8696        }
8697        if let Some(ref val) = self.dstrct_nm {
8698            helpers::validate_length(
8699                val,
8700                "DstrctNm",
8701                Some(1),
8702                Some(35),
8703                &helpers::child_path(path, "DstrctNm"),
8704                config,
8705                collector,
8706            );
8707        }
8708        if let Some(ref val) = self.dstrct_nm {
8709            helpers::validate_pattern(
8710                val,
8711                "DstrctNm",
8712                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8713                &helpers::child_path(path, "DstrctNm"),
8714                config,
8715                collector,
8716            );
8717        }
8718        if let Some(ref val) = self.ctry_sub_dvsn {
8719            helpers::validate_length(
8720                val,
8721                "CtrySubDvsn",
8722                Some(1),
8723                Some(35),
8724                &helpers::child_path(path, "CtrySubDvsn"),
8725                config,
8726                collector,
8727            );
8728        }
8729        if let Some(ref val) = self.ctry_sub_dvsn {
8730            helpers::validate_pattern(
8731                val,
8732                "CtrySubDvsn",
8733                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8734                &helpers::child_path(path, "CtrySubDvsn"),
8735                config,
8736                collector,
8737            );
8738        }
8739        if let Some(ref val) = self.ctry {
8740            helpers::validate_pattern(
8741                val,
8742                "Ctry",
8743                "[A-Z]{2,2}",
8744                &helpers::child_path(path, "Ctry"),
8745                config,
8746                collector,
8747            );
8748        }
8749        if let Some(ref vec) = self.adr_line {
8750            for item in vec {
8751                helpers::validate_length(
8752                    item,
8753                    "AdrLine",
8754                    Some(1),
8755                    Some(70),
8756                    &helpers::child_path(path, "AdrLine"),
8757                    config,
8758                    collector,
8759                );
8760            }
8761        }
8762        if let Some(ref vec) = self.adr_line {
8763            for item in vec {
8764                helpers::validate_pattern(
8765                    item,
8766                    "AdrLine",
8767                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8768                    &helpers::child_path(path, "AdrLine"),
8769                    config,
8770                    collector,
8771                );
8772            }
8773        }
8774    }
8775}
8776
8777// PostalAddress243: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
8778#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8779pub struct PostalAddress243 {
8780    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
8781    pub dept: Option<String>,
8782    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
8783    pub sub_dept: Option<String>,
8784    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
8785    pub strt_nm: Option<String>,
8786    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
8787    pub bldg_nb: Option<String>,
8788    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
8789    pub bldg_nm: Option<String>,
8790    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
8791    pub flr: Option<String>,
8792    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
8793    pub pst_bx: Option<String>,
8794    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
8795    pub room: Option<String>,
8796    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
8797    pub pst_cd: Option<String>,
8798    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
8799    pub twn_nm: Option<String>,
8800    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
8801    pub twn_lctn_nm: Option<String>,
8802    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
8803    pub dstrct_nm: Option<String>,
8804    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
8805    pub ctry_sub_dvsn: Option<String>,
8806    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
8807    pub ctry: Option<String>,
8808    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
8809    pub adr_line: Option<Vec<String>>,
8810}
8811
8812impl Validate for PostalAddress243 {
8813    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8814        if let Some(ref val) = self.dept {
8815            helpers::validate_length(
8816                val,
8817                "Dept",
8818                Some(1),
8819                Some(70),
8820                &helpers::child_path(path, "Dept"),
8821                config,
8822                collector,
8823            );
8824        }
8825        if let Some(ref val) = self.dept {
8826            helpers::validate_pattern(
8827                val,
8828                "Dept",
8829                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8830                &helpers::child_path(path, "Dept"),
8831                config,
8832                collector,
8833            );
8834        }
8835        if let Some(ref val) = self.sub_dept {
8836            helpers::validate_length(
8837                val,
8838                "SubDept",
8839                Some(1),
8840                Some(70),
8841                &helpers::child_path(path, "SubDept"),
8842                config,
8843                collector,
8844            );
8845        }
8846        if let Some(ref val) = self.sub_dept {
8847            helpers::validate_pattern(
8848                val,
8849                "SubDept",
8850                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8851                &helpers::child_path(path, "SubDept"),
8852                config,
8853                collector,
8854            );
8855        }
8856        if let Some(ref val) = self.strt_nm {
8857            helpers::validate_length(
8858                val,
8859                "StrtNm",
8860                Some(1),
8861                Some(70),
8862                &helpers::child_path(path, "StrtNm"),
8863                config,
8864                collector,
8865            );
8866        }
8867        if let Some(ref val) = self.strt_nm {
8868            helpers::validate_pattern(
8869                val,
8870                "StrtNm",
8871                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8872                &helpers::child_path(path, "StrtNm"),
8873                config,
8874                collector,
8875            );
8876        }
8877        if let Some(ref val) = self.bldg_nb {
8878            helpers::validate_length(
8879                val,
8880                "BldgNb",
8881                Some(1),
8882                Some(16),
8883                &helpers::child_path(path, "BldgNb"),
8884                config,
8885                collector,
8886            );
8887        }
8888        if let Some(ref val) = self.bldg_nb {
8889            helpers::validate_pattern(
8890                val,
8891                "BldgNb",
8892                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8893                &helpers::child_path(path, "BldgNb"),
8894                config,
8895                collector,
8896            );
8897        }
8898        if let Some(ref val) = self.bldg_nm {
8899            helpers::validate_length(
8900                val,
8901                "BldgNm",
8902                Some(1),
8903                Some(35),
8904                &helpers::child_path(path, "BldgNm"),
8905                config,
8906                collector,
8907            );
8908        }
8909        if let Some(ref val) = self.bldg_nm {
8910            helpers::validate_pattern(
8911                val,
8912                "BldgNm",
8913                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8914                &helpers::child_path(path, "BldgNm"),
8915                config,
8916                collector,
8917            );
8918        }
8919        if let Some(ref val) = self.flr {
8920            helpers::validate_length(
8921                val,
8922                "Flr",
8923                Some(1),
8924                Some(70),
8925                &helpers::child_path(path, "Flr"),
8926                config,
8927                collector,
8928            );
8929        }
8930        if let Some(ref val) = self.flr {
8931            helpers::validate_pattern(
8932                val,
8933                "Flr",
8934                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8935                &helpers::child_path(path, "Flr"),
8936                config,
8937                collector,
8938            );
8939        }
8940        if let Some(ref val) = self.pst_bx {
8941            helpers::validate_length(
8942                val,
8943                "PstBx",
8944                Some(1),
8945                Some(16),
8946                &helpers::child_path(path, "PstBx"),
8947                config,
8948                collector,
8949            );
8950        }
8951        if let Some(ref val) = self.pst_bx {
8952            helpers::validate_pattern(
8953                val,
8954                "PstBx",
8955                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8956                &helpers::child_path(path, "PstBx"),
8957                config,
8958                collector,
8959            );
8960        }
8961        if let Some(ref val) = self.room {
8962            helpers::validate_length(
8963                val,
8964                "Room",
8965                Some(1),
8966                Some(70),
8967                &helpers::child_path(path, "Room"),
8968                config,
8969                collector,
8970            );
8971        }
8972        if let Some(ref val) = self.room {
8973            helpers::validate_pattern(
8974                val,
8975                "Room",
8976                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8977                &helpers::child_path(path, "Room"),
8978                config,
8979                collector,
8980            );
8981        }
8982        if let Some(ref val) = self.pst_cd {
8983            helpers::validate_length(
8984                val,
8985                "PstCd",
8986                Some(1),
8987                Some(16),
8988                &helpers::child_path(path, "PstCd"),
8989                config,
8990                collector,
8991            );
8992        }
8993        if let Some(ref val) = self.pst_cd {
8994            helpers::validate_pattern(
8995                val,
8996                "PstCd",
8997                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8998                &helpers::child_path(path, "PstCd"),
8999                config,
9000                collector,
9001            );
9002        }
9003        if let Some(ref val) = self.twn_nm {
9004            helpers::validate_length(
9005                val,
9006                "TwnNm",
9007                Some(1),
9008                Some(35),
9009                &helpers::child_path(path, "TwnNm"),
9010                config,
9011                collector,
9012            );
9013        }
9014        if let Some(ref val) = self.twn_nm {
9015            helpers::validate_pattern(
9016                val,
9017                "TwnNm",
9018                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9019                &helpers::child_path(path, "TwnNm"),
9020                config,
9021                collector,
9022            );
9023        }
9024        if let Some(ref val) = self.twn_lctn_nm {
9025            helpers::validate_length(
9026                val,
9027                "TwnLctnNm",
9028                Some(1),
9029                Some(35),
9030                &helpers::child_path(path, "TwnLctnNm"),
9031                config,
9032                collector,
9033            );
9034        }
9035        if let Some(ref val) = self.twn_lctn_nm {
9036            helpers::validate_pattern(
9037                val,
9038                "TwnLctnNm",
9039                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9040                &helpers::child_path(path, "TwnLctnNm"),
9041                config,
9042                collector,
9043            );
9044        }
9045        if let Some(ref val) = self.dstrct_nm {
9046            helpers::validate_length(
9047                val,
9048                "DstrctNm",
9049                Some(1),
9050                Some(35),
9051                &helpers::child_path(path, "DstrctNm"),
9052                config,
9053                collector,
9054            );
9055        }
9056        if let Some(ref val) = self.dstrct_nm {
9057            helpers::validate_pattern(
9058                val,
9059                "DstrctNm",
9060                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9061                &helpers::child_path(path, "DstrctNm"),
9062                config,
9063                collector,
9064            );
9065        }
9066        if let Some(ref val) = self.ctry_sub_dvsn {
9067            helpers::validate_length(
9068                val,
9069                "CtrySubDvsn",
9070                Some(1),
9071                Some(35),
9072                &helpers::child_path(path, "CtrySubDvsn"),
9073                config,
9074                collector,
9075            );
9076        }
9077        if let Some(ref val) = self.ctry_sub_dvsn {
9078            helpers::validate_pattern(
9079                val,
9080                "CtrySubDvsn",
9081                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9082                &helpers::child_path(path, "CtrySubDvsn"),
9083                config,
9084                collector,
9085            );
9086        }
9087        if let Some(ref val) = self.ctry {
9088            helpers::validate_pattern(
9089                val,
9090                "Ctry",
9091                "[A-Z]{2,2}",
9092                &helpers::child_path(path, "Ctry"),
9093                config,
9094                collector,
9095            );
9096        }
9097        if let Some(ref vec) = self.adr_line {
9098            for item in vec {
9099                helpers::validate_length(
9100                    item,
9101                    "AdrLine",
9102                    Some(1),
9103                    Some(70),
9104                    &helpers::child_path(path, "AdrLine"),
9105                    config,
9106                    collector,
9107                );
9108            }
9109        }
9110        if let Some(ref vec) = self.adr_line {
9111            for item in vec {
9112                helpers::validate_pattern(
9113                    item,
9114                    "AdrLine",
9115                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9116                    &helpers::child_path(path, "AdrLine"),
9117                    config,
9118                    collector,
9119                );
9120            }
9121        }
9122    }
9123}
9124
9125// PostalAddress244: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
9126#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9127pub struct PostalAddress244 {
9128    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
9129    pub adr_tp: Option<AddressType3Choice>,
9130    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
9131    pub dept: Option<String>,
9132    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
9133    pub sub_dept: Option<String>,
9134    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
9135    pub strt_nm: Option<String>,
9136    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
9137    pub bldg_nb: Option<String>,
9138    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
9139    pub bldg_nm: Option<String>,
9140    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
9141    pub flr: Option<String>,
9142    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
9143    pub pst_bx: Option<String>,
9144    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
9145    pub room: Option<String>,
9146    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
9147    pub pst_cd: Option<String>,
9148    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
9149    pub twn_nm: Option<String>,
9150    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
9151    pub twn_lctn_nm: Option<String>,
9152    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
9153    pub dstrct_nm: Option<String>,
9154    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
9155    pub ctry_sub_dvsn: Option<String>,
9156    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
9157    pub ctry: Option<String>,
9158    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
9159    pub adr_line: Option<Vec<String>>,
9160}
9161
9162impl Validate for PostalAddress244 {
9163    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9164        if let Some(ref val) = self.adr_tp
9165            && config.validate_optional_fields
9166        {
9167            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
9168        }
9169        if let Some(ref val) = self.dept {
9170            helpers::validate_length(
9171                val,
9172                "Dept",
9173                Some(1),
9174                Some(70),
9175                &helpers::child_path(path, "Dept"),
9176                config,
9177                collector,
9178            );
9179        }
9180        if let Some(ref val) = self.sub_dept {
9181            helpers::validate_length(
9182                val,
9183                "SubDept",
9184                Some(1),
9185                Some(70),
9186                &helpers::child_path(path, "SubDept"),
9187                config,
9188                collector,
9189            );
9190        }
9191        if let Some(ref val) = self.strt_nm {
9192            helpers::validate_length(
9193                val,
9194                "StrtNm",
9195                Some(1),
9196                Some(70),
9197                &helpers::child_path(path, "StrtNm"),
9198                config,
9199                collector,
9200            );
9201        }
9202        if let Some(ref val) = self.bldg_nb {
9203            helpers::validate_length(
9204                val,
9205                "BldgNb",
9206                Some(1),
9207                Some(16),
9208                &helpers::child_path(path, "BldgNb"),
9209                config,
9210                collector,
9211            );
9212        }
9213        if let Some(ref val) = self.bldg_nm {
9214            helpers::validate_length(
9215                val,
9216                "BldgNm",
9217                Some(1),
9218                Some(35),
9219                &helpers::child_path(path, "BldgNm"),
9220                config,
9221                collector,
9222            );
9223        }
9224        if let Some(ref val) = self.flr {
9225            helpers::validate_length(
9226                val,
9227                "Flr",
9228                Some(1),
9229                Some(70),
9230                &helpers::child_path(path, "Flr"),
9231                config,
9232                collector,
9233            );
9234        }
9235        if let Some(ref val) = self.pst_bx {
9236            helpers::validate_length(
9237                val,
9238                "PstBx",
9239                Some(1),
9240                Some(16),
9241                &helpers::child_path(path, "PstBx"),
9242                config,
9243                collector,
9244            );
9245        }
9246        if let Some(ref val) = self.room {
9247            helpers::validate_length(
9248                val,
9249                "Room",
9250                Some(1),
9251                Some(70),
9252                &helpers::child_path(path, "Room"),
9253                config,
9254                collector,
9255            );
9256        }
9257        if let Some(ref val) = self.pst_cd {
9258            helpers::validate_length(
9259                val,
9260                "PstCd",
9261                Some(1),
9262                Some(16),
9263                &helpers::child_path(path, "PstCd"),
9264                config,
9265                collector,
9266            );
9267        }
9268        if let Some(ref val) = self.twn_nm {
9269            helpers::validate_length(
9270                val,
9271                "TwnNm",
9272                Some(1),
9273                Some(35),
9274                &helpers::child_path(path, "TwnNm"),
9275                config,
9276                collector,
9277            );
9278        }
9279        if let Some(ref val) = self.twn_lctn_nm {
9280            helpers::validate_length(
9281                val,
9282                "TwnLctnNm",
9283                Some(1),
9284                Some(35),
9285                &helpers::child_path(path, "TwnLctnNm"),
9286                config,
9287                collector,
9288            );
9289        }
9290        if let Some(ref val) = self.dstrct_nm {
9291            helpers::validate_length(
9292                val,
9293                "DstrctNm",
9294                Some(1),
9295                Some(35),
9296                &helpers::child_path(path, "DstrctNm"),
9297                config,
9298                collector,
9299            );
9300        }
9301        if let Some(ref val) = self.ctry_sub_dvsn {
9302            helpers::validate_length(
9303                val,
9304                "CtrySubDvsn",
9305                Some(1),
9306                Some(35),
9307                &helpers::child_path(path, "CtrySubDvsn"),
9308                config,
9309                collector,
9310            );
9311        }
9312        if let Some(ref val) = self.ctry {
9313            helpers::validate_pattern(
9314                val,
9315                "Ctry",
9316                "[A-Z]{2,2}",
9317                &helpers::child_path(path, "Ctry"),
9318                config,
9319                collector,
9320            );
9321        }
9322        if let Some(ref vec) = self.adr_line {
9323            for item in vec {
9324                helpers::validate_length(
9325                    item,
9326                    "AdrLine",
9327                    Some(1),
9328                    Some(70),
9329                    &helpers::child_path(path, "AdrLine"),
9330                    config,
9331                    collector,
9332                );
9333            }
9334        }
9335        if let Some(ref vec) = self.adr_line {
9336            for item in vec {
9337                helpers::validate_pattern(
9338                    item,
9339                    "AdrLine",
9340                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9341                    &helpers::child_path(path, "AdrLine"),
9342                    config,
9343                    collector,
9344                );
9345            }
9346        }
9347    }
9348}
9349
9350// PreferredContactMethod1Code: Preferred method used to reach the contact is per mobile or cell phone.
9351#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9352pub enum PreferredContactMethod1Code {
9353    #[default]
9354    #[serde(rename = "LETT")]
9355    CodeLETT,
9356    #[serde(rename = "MAIL")]
9357    CodeMAIL,
9358    #[serde(rename = "PHON")]
9359    CodePHON,
9360    #[serde(rename = "FAXX")]
9361    CodeFAXX,
9362    #[serde(rename = "CELL")]
9363    CodeCELL,
9364}
9365
9366impl Validate for PreferredContactMethod1Code {
9367    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
9368        // Enum validation is typically empty
9369    }
9370}
9371
9372// Price7: Value of the price, for example, as a currency and value.
9373#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9374pub struct Price7 {
9375    #[serde(rename = "Tp")]
9376    pub tp: YieldedOrValueType1Choice,
9377    #[serde(rename = "Val")]
9378    pub val: PriceRateOrAmount3Choice,
9379}
9380
9381impl Validate for Price7 {
9382    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9383        self.tp
9384            .validate(&helpers::child_path(path, "Tp"), config, collector);
9385        self.val
9386            .validate(&helpers::child_path(path, "Val"), config, collector);
9387    }
9388}
9389
9390// PriceRateOrAmount3Choice: Price expressed as a currency and value.
9391#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9392pub struct PriceRateOrAmount3Choice {
9393    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9394    pub rate: Option<f64>,
9395    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
9396    pub amt: Option<ActiveOrHistoricCurrencyAnd13DecimalAmount>,
9397}
9398
9399impl Validate for PriceRateOrAmount3Choice {
9400    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9401        if let Some(ref val) = self.amt
9402            && config.validate_optional_fields
9403        {
9404            val.validate(&helpers::child_path(path, "Amt"), config, collector);
9405        }
9406    }
9407}
9408
9409// PriceValueType1Code: Price is the face amount.
9410#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9411pub enum PriceValueType1Code {
9412    #[default]
9413    #[serde(rename = "DISC")]
9414    CodeDISC,
9415    #[serde(rename = "PREM")]
9416    CodePREM,
9417    #[serde(rename = "PARV")]
9418    CodePARV,
9419}
9420
9421impl Validate for PriceValueType1Code {
9422    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
9423        // Enum validation is typically empty
9424    }
9425}
9426
9427// Product21: Additional information related to the product.
9428#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9429pub struct Product21 {
9430    #[serde(rename = "PdctCd")]
9431    pub pdct_cd: String,
9432    #[serde(rename = "UnitOfMeasr", skip_serializing_if = "Option::is_none")]
9433    pub unit_of_measr: Option<UnitOfMeasure1Code>,
9434    #[serde(rename = "PdctQty", skip_serializing_if = "Option::is_none")]
9435    pub pdct_qty: Option<f64>,
9436    #[serde(rename = "UnitPric", skip_serializing_if = "Option::is_none")]
9437    pub unit_pric: Option<f64>,
9438    #[serde(rename = "PdctAmt", skip_serializing_if = "Option::is_none")]
9439    pub pdct_amt: Option<f64>,
9440    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
9441    pub tax_tp: Option<String>,
9442    #[serde(rename = "AddtlPdctInf", skip_serializing_if = "Option::is_none")]
9443    pub addtl_pdct_inf: Option<String>,
9444}
9445
9446impl Validate for Product21 {
9447    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9448        helpers::validate_length(
9449            &self.pdct_cd,
9450            "PdctCd",
9451            Some(1),
9452            Some(70),
9453            &helpers::child_path(path, "PdctCd"),
9454            config,
9455            collector,
9456        );
9457        helpers::validate_pattern(
9458            &self.pdct_cd,
9459            "PdctCd",
9460            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9461            &helpers::child_path(path, "PdctCd"),
9462            config,
9463            collector,
9464        );
9465        if let Some(ref val) = self.unit_of_measr
9466            && config.validate_optional_fields
9467        {
9468            val.validate(&helpers::child_path(path, "UnitOfMeasr"), config, collector);
9469        }
9470        if let Some(ref val) = self.tax_tp {
9471            helpers::validate_length(
9472                val,
9473                "TaxTp",
9474                Some(1),
9475                Some(35),
9476                &helpers::child_path(path, "TaxTp"),
9477                config,
9478                collector,
9479            );
9480        }
9481        if let Some(ref val) = self.tax_tp {
9482            helpers::validate_pattern(
9483                val,
9484                "TaxTp",
9485                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9486                &helpers::child_path(path, "TaxTp"),
9487                config,
9488                collector,
9489            );
9490        }
9491        if let Some(ref val) = self.addtl_pdct_inf {
9492            helpers::validate_length(
9493                val,
9494                "AddtlPdctInf",
9495                Some(1),
9496                Some(35),
9497                &helpers::child_path(path, "AddtlPdctInf"),
9498                config,
9499                collector,
9500            );
9501        }
9502        if let Some(ref val) = self.addtl_pdct_inf {
9503            helpers::validate_pattern(
9504                val,
9505                "AddtlPdctInf",
9506                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9507                &helpers::child_path(path, "AddtlPdctInf"),
9508                config,
9509                collector,
9510            );
9511        }
9512    }
9513}
9514
9515// ProprietaryAgent41: Organisation established primarily to provide financial services.
9516#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9517pub struct ProprietaryAgent41 {
9518    #[serde(rename = "Tp")]
9519    pub tp: String,
9520    #[serde(rename = "Agt")]
9521    pub agt: BranchAndFinancialInstitutionIdentification65,
9522}
9523
9524impl Validate for ProprietaryAgent41 {
9525    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9526        helpers::validate_length(
9527            &self.tp,
9528            "Tp",
9529            Some(1),
9530            Some(35),
9531            &helpers::child_path(path, "Tp"),
9532            config,
9533            collector,
9534        );
9535        helpers::validate_pattern(
9536            &self.tp,
9537            "Tp",
9538            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9539            &helpers::child_path(path, "Tp"),
9540            config,
9541            collector,
9542        );
9543        self.agt
9544            .validate(&helpers::child_path(path, "Agt"), config, collector);
9545    }
9546}
9547
9548// ProprietaryBankTransactionCodeStructure11: Identification of the issuer of the proprietary bank transaction code.
9549#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9550pub struct ProprietaryBankTransactionCodeStructure11 {
9551    #[serde(rename = "Cd")]
9552    pub cd: String,
9553    #[serde(rename = "Issr")]
9554    pub issr: String,
9555}
9556
9557impl Validate for ProprietaryBankTransactionCodeStructure11 {
9558    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9559        helpers::validate_length(
9560            &self.cd,
9561            "Cd",
9562            Some(1),
9563            Some(35),
9564            &helpers::child_path(path, "Cd"),
9565            config,
9566            collector,
9567        );
9568        helpers::validate_pattern(
9569            &self.cd,
9570            "Cd",
9571            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9572            &helpers::child_path(path, "Cd"),
9573            config,
9574            collector,
9575        );
9576        helpers::validate_length(
9577            &self.issr,
9578            "Issr",
9579            Some(1),
9580            Some(35),
9581            &helpers::child_path(path, "Issr"),
9582            config,
9583            collector,
9584        );
9585        helpers::validate_pattern(
9586            &self.issr,
9587            "Issr",
9588            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9589            &helpers::child_path(path, "Issr"),
9590            config,
9591            collector,
9592        );
9593    }
9594}
9595
9596// ProprietaryDate31: Date in ISO format.
9597#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9598pub struct ProprietaryDate31 {
9599    #[serde(rename = "Tp")]
9600    pub tp: String,
9601    #[serde(rename = "Dt")]
9602    pub dt: DateAndDateTime2Choice1,
9603}
9604
9605impl Validate for ProprietaryDate31 {
9606    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9607        helpers::validate_length(
9608            &self.tp,
9609            "Tp",
9610            Some(1),
9611            Some(35),
9612            &helpers::child_path(path, "Tp"),
9613            config,
9614            collector,
9615        );
9616        helpers::validate_pattern(
9617            &self.tp,
9618            "Tp",
9619            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9620            &helpers::child_path(path, "Tp"),
9621            config,
9622            collector,
9623        );
9624        self.dt
9625            .validate(&helpers::child_path(path, "Dt"), config, collector);
9626    }
9627}
9628
9629// ProprietaryParty51: Proprietary party.
9630#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9631pub struct ProprietaryParty51 {
9632    #[serde(rename = "Tp")]
9633    pub tp: String,
9634    #[serde(rename = "Pty")]
9635    pub pty: Party40Choice5,
9636}
9637
9638impl Validate for ProprietaryParty51 {
9639    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9640        helpers::validate_length(
9641            &self.tp,
9642            "Tp",
9643            Some(1),
9644            Some(35),
9645            &helpers::child_path(path, "Tp"),
9646            config,
9647            collector,
9648        );
9649        helpers::validate_pattern(
9650            &self.tp,
9651            "Tp",
9652            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9653            &helpers::child_path(path, "Tp"),
9654            config,
9655            collector,
9656        );
9657        self.pty
9658            .validate(&helpers::child_path(path, "Pty"), config, collector);
9659    }
9660}
9661
9662// ProprietaryPrice21: Proprietary price specification related to the underlying transaction.
9663#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9664pub struct ProprietaryPrice21 {
9665    #[serde(rename = "Tp")]
9666    pub tp: String,
9667    #[serde(rename = "Pric")]
9668    pub pric: ActiveOrHistoricCurrencyAndAmount,
9669}
9670
9671impl Validate for ProprietaryPrice21 {
9672    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9673        helpers::validate_length(
9674            &self.tp,
9675            "Tp",
9676            Some(1),
9677            Some(35),
9678            &helpers::child_path(path, "Tp"),
9679            config,
9680            collector,
9681        );
9682        helpers::validate_pattern(
9683            &self.tp,
9684            "Tp",
9685            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9686            &helpers::child_path(path, "Tp"),
9687            config,
9688            collector,
9689        );
9690        self.pric
9691            .validate(&helpers::child_path(path, "Pric"), config, collector);
9692    }
9693}
9694
9695// ProprietaryQuantity11: Provides the proprietary quantity in free format.
9696#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9697pub struct ProprietaryQuantity11 {
9698    #[serde(rename = "Tp")]
9699    pub tp: String,
9700    #[serde(rename = "Qty")]
9701    pub qty: String,
9702}
9703
9704impl Validate for ProprietaryQuantity11 {
9705    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9706        helpers::validate_length(
9707            &self.tp,
9708            "Tp",
9709            Some(1),
9710            Some(35),
9711            &helpers::child_path(path, "Tp"),
9712            config,
9713            collector,
9714        );
9715        helpers::validate_pattern(
9716            &self.tp,
9717            "Tp",
9718            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9719            &helpers::child_path(path, "Tp"),
9720            config,
9721            collector,
9722        );
9723        helpers::validate_length(
9724            &self.qty,
9725            "Qty",
9726            Some(1),
9727            Some(35),
9728            &helpers::child_path(path, "Qty"),
9729            config,
9730            collector,
9731        );
9732        helpers::validate_pattern(
9733            &self.qty,
9734            "Qty",
9735            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9736            &helpers::child_path(path, "Qty"),
9737            config,
9738            collector,
9739        );
9740    }
9741}
9742
9743// ProprietaryReference11: Proprietary reference specification related to the underlying transaction.
9744#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9745pub struct ProprietaryReference11 {
9746    #[serde(rename = "Tp")]
9747    pub tp: String,
9748    #[serde(rename = "Ref")]
9749    pub ref_attr: String,
9750}
9751
9752impl Validate for ProprietaryReference11 {
9753    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9754        helpers::validate_length(
9755            &self.tp,
9756            "Tp",
9757            Some(1),
9758            Some(35),
9759            &helpers::child_path(path, "Tp"),
9760            config,
9761            collector,
9762        );
9763        helpers::validate_pattern(
9764            &self.tp,
9765            "Tp",
9766            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9767            &helpers::child_path(path, "Tp"),
9768            config,
9769            collector,
9770        );
9771        helpers::validate_length(
9772            &self.ref_attr,
9773            "Ref",
9774            Some(1),
9775            Some(35),
9776            &helpers::child_path(path, "Ref"),
9777            config,
9778            collector,
9779        );
9780        helpers::validate_pattern(
9781            &self.ref_attr,
9782            "Ref",
9783            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9784            &helpers::child_path(path, "Ref"),
9785            config,
9786            collector,
9787        );
9788    }
9789}
9790
9791// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
9792#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9793pub struct ProxyAccountIdentification11 {
9794    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9795    pub tp: Option<ProxyAccountType1Choice1>,
9796    #[serde(rename = "Id")]
9797    pub id: String,
9798}
9799
9800impl Validate for ProxyAccountIdentification11 {
9801    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9802        if let Some(ref val) = self.tp
9803            && config.validate_optional_fields
9804        {
9805            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9806        }
9807        helpers::validate_length(
9808            &self.id,
9809            "Id",
9810            Some(1),
9811            Some(320),
9812            &helpers::child_path(path, "Id"),
9813            config,
9814            collector,
9815        );
9816        helpers::validate_pattern(
9817            &self.id,
9818            "Id",
9819            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9820            &helpers::child_path(path, "Id"),
9821            config,
9822            collector,
9823        );
9824    }
9825}
9826
9827// ProxyAccountIdentification12: Identification used to indicate the account identification under another specified name.
9828#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9829pub struct ProxyAccountIdentification12 {
9830    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9831    pub tp: Option<ProxyAccountType1Choice1>,
9832    #[serde(rename = "Id")]
9833    pub id: String,
9834}
9835
9836impl Validate for ProxyAccountIdentification12 {
9837    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9838        if let Some(ref val) = self.tp
9839            && config.validate_optional_fields
9840        {
9841            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9842        }
9843        helpers::validate_length(
9844            &self.id,
9845            "Id",
9846            Some(1),
9847            Some(2048),
9848            &helpers::child_path(path, "Id"),
9849            config,
9850            collector,
9851        );
9852    }
9853}
9854
9855// ProxyAccountIdentification13: Identification used to indicate the account identification under another specified name.
9856#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9857pub struct ProxyAccountIdentification13 {
9858    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9859    pub tp: Option<ProxyAccountType1Choice>,
9860    #[serde(rename = "Id")]
9861    pub id: String,
9862}
9863
9864impl Validate for ProxyAccountIdentification13 {
9865    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9866        if let Some(ref val) = self.tp
9867            && config.validate_optional_fields
9868        {
9869            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9870        }
9871        helpers::validate_length(
9872            &self.id,
9873            "Id",
9874            Some(1),
9875            Some(320),
9876            &helpers::child_path(path, "Id"),
9877            config,
9878            collector,
9879        );
9880        helpers::validate_pattern(
9881            &self.id,
9882            "Id",
9883            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9884            &helpers::child_path(path, "Id"),
9885            config,
9886            collector,
9887        );
9888    }
9889}
9890
9891// ProxyAccountType1Choice: Name of the identification scheme, in a free text form.
9892#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9893pub struct ProxyAccountType1Choice {
9894    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9895    pub cd: Option<String>,
9896    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9897    pub prtry: Option<String>,
9898}
9899
9900impl Validate for ProxyAccountType1Choice {
9901    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9902        if let Some(ref val) = self.cd {
9903            helpers::validate_length(
9904                val,
9905                "Cd",
9906                Some(1),
9907                Some(4),
9908                &helpers::child_path(path, "Cd"),
9909                config,
9910                collector,
9911            );
9912        }
9913        if let Some(ref val) = self.prtry {
9914            helpers::validate_length(
9915                val,
9916                "Prtry",
9917                Some(1),
9918                Some(35),
9919                &helpers::child_path(path, "Prtry"),
9920                config,
9921                collector,
9922            );
9923        }
9924    }
9925}
9926
9927// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
9928#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9929pub struct ProxyAccountType1Choice1 {
9930    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9931    pub cd: Option<String>,
9932    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9933    pub prtry: Option<String>,
9934}
9935
9936impl Validate for ProxyAccountType1Choice1 {
9937    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9938        if let Some(ref val) = self.cd {
9939            helpers::validate_length(
9940                val,
9941                "Cd",
9942                Some(1),
9943                Some(4),
9944                &helpers::child_path(path, "Cd"),
9945                config,
9946                collector,
9947            );
9948        }
9949        if let Some(ref val) = self.prtry {
9950            helpers::validate_length(
9951                val,
9952                "Prtry",
9953                Some(1),
9954                Some(35),
9955                &helpers::child_path(path, "Prtry"),
9956                config,
9957                collector,
9958            );
9959        }
9960        if let Some(ref val) = self.prtry {
9961            helpers::validate_pattern(
9962                val,
9963                "Prtry",
9964                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9965                &helpers::child_path(path, "Prtry"),
9966                config,
9967                collector,
9968            );
9969        }
9970    }
9971}
9972
9973// Purpose2Choice1: Purpose, in a proprietary form.
9974#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9975pub struct Purpose2Choice1 {
9976    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9977    pub cd: Option<String>,
9978    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9979    pub prtry: Option<String>,
9980}
9981
9982impl Validate for Purpose2Choice1 {
9983    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9984        if let Some(ref val) = self.cd {
9985            helpers::validate_length(
9986                val,
9987                "Cd",
9988                Some(1),
9989                Some(4),
9990                &helpers::child_path(path, "Cd"),
9991                config,
9992                collector,
9993            );
9994        }
9995        if let Some(ref val) = self.prtry {
9996            helpers::validate_length(
9997                val,
9998                "Prtry",
9999                Some(1),
10000                Some(35),
10001                &helpers::child_path(path, "Prtry"),
10002                config,
10003                collector,
10004            );
10005        }
10006        if let Some(ref val) = self.prtry {
10007            helpers::validate_pattern(
10008                val,
10009                "Prtry",
10010                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10011                &helpers::child_path(path, "Prtry"),
10012                config,
10013                collector,
10014            );
10015        }
10016    }
10017}
10018
10019// Rate41: An amount range where the interest rate is applicable.
10020#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10021pub struct Rate41 {
10022    #[serde(rename = "Tp")]
10023    pub tp: RateType4Choice1,
10024    #[serde(rename = "VldtyRg", skip_serializing_if = "Option::is_none")]
10025    pub vldty_rg: Option<ActiveOrHistoricCurrencyAndAmountRange2>,
10026}
10027
10028impl Validate for Rate41 {
10029    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10030        self.tp
10031            .validate(&helpers::child_path(path, "Tp"), config, collector);
10032        if let Some(ref val) = self.vldty_rg
10033            && config.validate_optional_fields
10034        {
10035            val.validate(&helpers::child_path(path, "VldtyRg"), config, collector);
10036        }
10037    }
10038}
10039
10040// RateType4Choice1: Rate type expressed, in an other form.
10041#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10042pub struct RateType4Choice1 {
10043    #[serde(rename = "Pctg", skip_serializing_if = "Option::is_none")]
10044    pub pctg: Option<f64>,
10045    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
10046    pub othr: Option<String>,
10047}
10048
10049impl Validate for RateType4Choice1 {
10050    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10051        if let Some(ref val) = self.othr {
10052            helpers::validate_length(
10053                val,
10054                "Othr",
10055                Some(1),
10056                Some(35),
10057                &helpers::child_path(path, "Othr"),
10058                config,
10059                collector,
10060            );
10061        }
10062        if let Some(ref val) = self.othr {
10063            helpers::validate_pattern(
10064                val,
10065                "Othr",
10066                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10067                &helpers::child_path(path, "Othr"),
10068                config,
10069                collector,
10070            );
10071        }
10072    }
10073}
10074
10075// ReferredDocumentInformation71: Set of elements used to provide the content of the referred document line.
10076#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10077pub struct ReferredDocumentInformation71 {
10078    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10079    pub tp: Option<ReferredDocumentType41>,
10080    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
10081    pub nb: Option<String>,
10082    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
10083    pub rltd_dt: Option<String>,
10084    #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
10085    pub line_dtls: Option<Vec<DocumentLineInformation11>>,
10086}
10087
10088impl Validate for ReferredDocumentInformation71 {
10089    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10090        if let Some(ref val) = self.tp
10091            && config.validate_optional_fields
10092        {
10093            val.validate(&helpers::child_path(path, "Tp"), config, collector);
10094        }
10095        if let Some(ref val) = self.nb {
10096            helpers::validate_length(
10097                val,
10098                "Nb",
10099                Some(1),
10100                Some(35),
10101                &helpers::child_path(path, "Nb"),
10102                config,
10103                collector,
10104            );
10105        }
10106        if let Some(ref val) = self.nb {
10107            helpers::validate_pattern(
10108                val,
10109                "Nb",
10110                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10111                &helpers::child_path(path, "Nb"),
10112                config,
10113                collector,
10114            );
10115        }
10116        if let Some(ref vec) = self.line_dtls
10117            && config.validate_optional_fields
10118        {
10119            for item in vec {
10120                item.validate(&helpers::child_path(path, "LineDtls"), config, collector);
10121            }
10122        }
10123    }
10124}
10125
10126// ReferredDocumentType3Choice1: Proprietary identification of the type of the remittance document.
10127#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10128pub struct ReferredDocumentType3Choice1 {
10129    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10130    pub cd: Option<DocumentType6Code>,
10131    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10132    pub prtry: Option<String>,
10133}
10134
10135impl Validate for ReferredDocumentType3Choice1 {
10136    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10137        if let Some(ref val) = self.cd
10138            && config.validate_optional_fields
10139        {
10140            val.validate(&helpers::child_path(path, "Cd"), config, collector);
10141        }
10142        if let Some(ref val) = self.prtry {
10143            helpers::validate_length(
10144                val,
10145                "Prtry",
10146                Some(1),
10147                Some(35),
10148                &helpers::child_path(path, "Prtry"),
10149                config,
10150                collector,
10151            );
10152        }
10153        if let Some(ref val) = self.prtry {
10154            helpers::validate_pattern(
10155                val,
10156                "Prtry",
10157                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10158                &helpers::child_path(path, "Prtry"),
10159                config,
10160                collector,
10161            );
10162        }
10163    }
10164}
10165
10166// ReferredDocumentType41: Identification of the issuer of the reference document type.
10167#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10168pub struct ReferredDocumentType41 {
10169    #[serde(rename = "CdOrPrtry")]
10170    pub cd_or_prtry: ReferredDocumentType3Choice1,
10171    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
10172    pub issr: Option<String>,
10173}
10174
10175impl Validate for ReferredDocumentType41 {
10176    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10177        self.cd_or_prtry
10178            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
10179        if let Some(ref val) = self.issr {
10180            helpers::validate_length(
10181                val,
10182                "Issr",
10183                Some(1),
10184                Some(35),
10185                &helpers::child_path(path, "Issr"),
10186                config,
10187                collector,
10188            );
10189        }
10190        if let Some(ref val) = self.issr {
10191            helpers::validate_pattern(
10192                val,
10193                "Issr",
10194                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10195                &helpers::child_path(path, "Issr"),
10196                config,
10197                collector,
10198            );
10199        }
10200    }
10201}
10202
10203// RemittanceAmount21: Amount of money remitted for the referred document.
10204#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10205pub struct RemittanceAmount21 {
10206    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
10207    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10208    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
10209    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType12>>,
10210    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
10211    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10212    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10213    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
10214    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
10215    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
10216    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
10217    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10218}
10219
10220impl Validate for RemittanceAmount21 {
10221    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10222        if let Some(ref val) = self.due_pybl_amt
10223            && config.validate_optional_fields
10224        {
10225            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
10226        }
10227        if let Some(ref vec) = self.dscnt_apld_amt
10228            && config.validate_optional_fields
10229        {
10230            for item in vec {
10231                item.validate(
10232                    &helpers::child_path(path, "DscntApldAmt"),
10233                    config,
10234                    collector,
10235                );
10236            }
10237        }
10238        if let Some(ref val) = self.cdt_note_amt
10239            && config.validate_optional_fields
10240        {
10241            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
10242        }
10243        if let Some(ref vec) = self.tax_amt
10244            && config.validate_optional_fields
10245        {
10246            for item in vec {
10247                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
10248            }
10249        }
10250        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
10251            && config.validate_optional_fields
10252        {
10253            for item in vec {
10254                item.validate(
10255                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
10256                    config,
10257                    collector,
10258                );
10259            }
10260        }
10261        if let Some(ref val) = self.rmtd_amt
10262            && config.validate_optional_fields
10263        {
10264            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
10265        }
10266    }
10267}
10268
10269// RemittanceAmount31: Amount of money remitted.
10270#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10271pub struct RemittanceAmount31 {
10272    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
10273    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10274    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
10275    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
10276    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
10277    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10278    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10279    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
10280    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
10281    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
10282    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
10283    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10284}
10285
10286impl Validate for RemittanceAmount31 {
10287    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10288        if let Some(ref val) = self.due_pybl_amt
10289            && config.validate_optional_fields
10290        {
10291            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
10292        }
10293        if let Some(ref vec) = self.dscnt_apld_amt
10294            && config.validate_optional_fields
10295        {
10296            for item in vec {
10297                item.validate(
10298                    &helpers::child_path(path, "DscntApldAmt"),
10299                    config,
10300                    collector,
10301                );
10302            }
10303        }
10304        if let Some(ref val) = self.cdt_note_amt
10305            && config.validate_optional_fields
10306        {
10307            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
10308        }
10309        if let Some(ref vec) = self.tax_amt
10310            && config.validate_optional_fields
10311        {
10312            for item in vec {
10313                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
10314            }
10315        }
10316        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
10317            && config.validate_optional_fields
10318        {
10319            for item in vec {
10320                item.validate(
10321                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
10322                    config,
10323                    collector,
10324                );
10325            }
10326        }
10327        if let Some(ref val) = self.rmtd_amt
10328            && config.validate_optional_fields
10329        {
10330            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
10331        }
10332    }
10333}
10334
10335// 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.
10336#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10337pub struct RemittanceInformation161 {
10338    #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
10339    pub ustrd: Option<String>,
10340    #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
10341    pub strd: Option<Vec<StructuredRemittanceInformation161>>,
10342}
10343
10344impl Validate for RemittanceInformation161 {
10345    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10346        if let Some(ref val) = self.ustrd {
10347            helpers::validate_length(
10348                val,
10349                "Ustrd",
10350                Some(1),
10351                Some(140),
10352                &helpers::child_path(path, "Ustrd"),
10353                config,
10354                collector,
10355            );
10356        }
10357        if let Some(ref val) = self.ustrd {
10358            helpers::validate_pattern(
10359                val,
10360                "Ustrd",
10361                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10362                &helpers::child_path(path, "Ustrd"),
10363                config,
10364                collector,
10365            );
10366        }
10367        if let Some(ref vec) = self.strd
10368            && config.validate_optional_fields
10369        {
10370            for item in vec {
10371                item.validate(&helpers::child_path(path, "Strd"), config, collector);
10372            }
10373        }
10374    }
10375}
10376
10377// RemittanceLocation71: Set of elements used to provide information on the location and/or delivery of the remittance information.
10378#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10379pub struct RemittanceLocation71 {
10380    #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
10381    pub rmt_id: Option<String>,
10382    #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
10383    pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
10384}
10385
10386impl Validate for RemittanceLocation71 {
10387    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10388        if let Some(ref val) = self.rmt_id {
10389            helpers::validate_length(
10390                val,
10391                "RmtId",
10392                Some(1),
10393                Some(35),
10394                &helpers::child_path(path, "RmtId"),
10395                config,
10396                collector,
10397            );
10398        }
10399        if let Some(ref val) = self.rmt_id {
10400            helpers::validate_pattern(
10401                val,
10402                "RmtId",
10403                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10404                &helpers::child_path(path, "RmtId"),
10405                config,
10406                collector,
10407            );
10408        }
10409        if let Some(ref vec) = self.rmt_lctn_dtls
10410            && config.validate_optional_fields
10411        {
10412            for item in vec {
10413                item.validate(&helpers::child_path(path, "RmtLctnDtls"), config, collector);
10414            }
10415        }
10416    }
10417}
10418
10419// RemittanceLocationData11: Postal address to which an agent is to send the remittance information.
10420#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10421pub struct RemittanceLocationData11 {
10422    #[serde(rename = "Mtd")]
10423    pub mtd: RemittanceLocationMethod2Code,
10424    #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
10425    pub elctrnc_adr: Option<String>,
10426    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
10427    pub pstl_adr: Option<NameAndAddress161>,
10428}
10429
10430impl Validate for RemittanceLocationData11 {
10431    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10432        self.mtd
10433            .validate(&helpers::child_path(path, "Mtd"), config, collector);
10434        if let Some(ref val) = self.elctrnc_adr {
10435            helpers::validate_length(
10436                val,
10437                "ElctrncAdr",
10438                Some(1),
10439                Some(2048),
10440                &helpers::child_path(path, "ElctrncAdr"),
10441                config,
10442                collector,
10443            );
10444        }
10445        if let Some(ref val) = self.elctrnc_adr {
10446            helpers::validate_pattern(
10447                val,
10448                "ElctrncAdr",
10449                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10450                &helpers::child_path(path, "ElctrncAdr"),
10451                config,
10452                collector,
10453            );
10454        }
10455        if let Some(ref val) = self.pstl_adr
10456            && config.validate_optional_fields
10457        {
10458            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
10459        }
10460    }
10461}
10462
10463// RemittanceLocationMethod2Code: Remittance advice information must be sent through by phone as a short message service (SMS).
10464#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10465pub enum RemittanceLocationMethod2Code {
10466    #[default]
10467    #[serde(rename = "FAXI")]
10468    CodeFAXI,
10469    #[serde(rename = "EDIC")]
10470    CodeEDIC,
10471    #[serde(rename = "URID")]
10472    CodeURID,
10473    #[serde(rename = "EMAL")]
10474    CodeEMAL,
10475    #[serde(rename = "POST")]
10476    CodePOST,
10477    #[serde(rename = "SMSM")]
10478    CodeSMSM,
10479}
10480
10481impl Validate for RemittanceLocationMethod2Code {
10482    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
10483        // Enum validation is typically empty
10484    }
10485}
10486
10487// ReportEntry101: Further details of the entry.
10488#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10489pub struct ReportEntry101 {
10490    #[serde(rename = "NtryRef")]
10491    pub ntry_ref: String,
10492    #[serde(rename = "Amt")]
10493    pub amt: ActiveOrHistoricCurrencyAndAmount,
10494    #[serde(rename = "CdtDbtInd")]
10495    pub cdt_dbt_ind: CreditDebitCode,
10496    #[serde(rename = "RvslInd", skip_serializing_if = "Option::is_none")]
10497    pub rvsl_ind: Option<bool>,
10498    #[serde(rename = "Sts")]
10499    pub sts: EntryStatus1Choice1,
10500    #[serde(rename = "BookgDt", skip_serializing_if = "Option::is_none")]
10501    pub bookg_dt: Option<DateAndDateTime2Choice2>,
10502    #[serde(rename = "ValDt", skip_serializing_if = "Option::is_none")]
10503    pub val_dt: Option<DateAndDateTime2Choice1>,
10504    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
10505    pub acct_svcr_ref: Option<String>,
10506    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
10507    pub avlbty: Option<Vec<CashAvailability1>>,
10508    #[serde(rename = "BkTxCd")]
10509    pub bk_tx_cd: BankTransactionCodeStructure41,
10510    #[serde(rename = "ComssnWvrInd", skip_serializing_if = "Option::is_none")]
10511    pub comssn_wvr_ind: Option<bool>,
10512    #[serde(rename = "AddtlInfInd", skip_serializing_if = "Option::is_none")]
10513    pub addtl_inf_ind: Option<MessageIdentification21>,
10514    #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
10515    pub amt_dtls: Option<AmountAndCurrencyExchange31>,
10516    #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
10517    pub chrgs: Option<Charges61>,
10518    #[serde(rename = "TechInptChanl", skip_serializing_if = "Option::is_none")]
10519    pub tech_inpt_chanl: Option<TechnicalInputChannel1Choice1>,
10520    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
10521    pub intrst: Option<TransactionInterest41>,
10522    #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
10523    pub card_tx: Option<CardEntry41>,
10524    #[serde(rename = "NtryDtls", skip_serializing_if = "Option::is_none")]
10525    pub ntry_dtls: Option<Vec<EntryDetails91>>,
10526    #[serde(rename = "AddtlNtryInf", skip_serializing_if = "Option::is_none")]
10527    pub addtl_ntry_inf: Option<String>,
10528}
10529
10530impl Validate for ReportEntry101 {
10531    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10532        helpers::validate_length(
10533            &self.ntry_ref,
10534            "NtryRef",
10535            Some(1),
10536            Some(16),
10537            &helpers::child_path(path, "NtryRef"),
10538            config,
10539            collector,
10540        );
10541        helpers::validate_pattern(
10542            &self.ntry_ref,
10543            "NtryRef",
10544            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]+|[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]+/)*[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]",
10545            &helpers::child_path(path, "NtryRef"),
10546            config,
10547            collector,
10548        );
10549        self.amt
10550            .validate(&helpers::child_path(path, "Amt"), config, collector);
10551        self.cdt_dbt_ind
10552            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
10553        self.sts
10554            .validate(&helpers::child_path(path, "Sts"), config, collector);
10555        if let Some(ref val) = self.bookg_dt
10556            && config.validate_optional_fields
10557        {
10558            val.validate(&helpers::child_path(path, "BookgDt"), config, collector);
10559        }
10560        if let Some(ref val) = self.val_dt
10561            && config.validate_optional_fields
10562        {
10563            val.validate(&helpers::child_path(path, "ValDt"), config, collector);
10564        }
10565        if let Some(ref val) = self.acct_svcr_ref {
10566            helpers::validate_length(
10567                val,
10568                "AcctSvcrRef",
10569                Some(1),
10570                Some(35),
10571                &helpers::child_path(path, "AcctSvcrRef"),
10572                config,
10573                collector,
10574            );
10575        }
10576        if let Some(ref vec) = self.avlbty
10577            && config.validate_optional_fields
10578        {
10579            for item in vec {
10580                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
10581            }
10582        }
10583        self.bk_tx_cd
10584            .validate(&helpers::child_path(path, "BkTxCd"), config, collector);
10585        if let Some(ref val) = self.addtl_inf_ind
10586            && config.validate_optional_fields
10587        {
10588            val.validate(&helpers::child_path(path, "AddtlInfInd"), config, collector);
10589        }
10590        if let Some(ref val) = self.amt_dtls
10591            && config.validate_optional_fields
10592        {
10593            val.validate(&helpers::child_path(path, "AmtDtls"), config, collector);
10594        }
10595        if let Some(ref val) = self.chrgs
10596            && config.validate_optional_fields
10597        {
10598            val.validate(&helpers::child_path(path, "Chrgs"), config, collector);
10599        }
10600        if let Some(ref val) = self.tech_inpt_chanl
10601            && config.validate_optional_fields
10602        {
10603            val.validate(
10604                &helpers::child_path(path, "TechInptChanl"),
10605                config,
10606                collector,
10607            );
10608        }
10609        if let Some(ref val) = self.intrst
10610            && config.validate_optional_fields
10611        {
10612            val.validate(&helpers::child_path(path, "Intrst"), config, collector);
10613        }
10614        if let Some(ref val) = self.card_tx
10615            && config.validate_optional_fields
10616        {
10617            val.validate(&helpers::child_path(path, "CardTx"), config, collector);
10618        }
10619        if let Some(ref vec) = self.ntry_dtls
10620            && config.validate_optional_fields
10621        {
10622            for item in vec {
10623                item.validate(&helpers::child_path(path, "NtryDtls"), config, collector);
10624            }
10625        }
10626        if let Some(ref val) = self.addtl_ntry_inf {
10627            helpers::validate_length(
10628                val,
10629                "AddtlNtryInf",
10630                Some(1),
10631                Some(500),
10632                &helpers::child_path(path, "AddtlNtryInf"),
10633                config,
10634                collector,
10635            );
10636        }
10637        if let Some(ref val) = self.addtl_ntry_inf {
10638            helpers::validate_pattern(
10639                val,
10640                "AddtlNtryInf",
10641                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10642                &helpers::child_path(path, "AddtlNtryInf"),
10643                config,
10644                collector,
10645            );
10646        }
10647    }
10648}
10649
10650// ReportingSource1Choice1: Reporting source, in a proprietary form.
10651#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10652pub struct ReportingSource1Choice1 {
10653    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10654    pub cd: Option<String>,
10655    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10656    pub prtry: Option<String>,
10657}
10658
10659impl Validate for ReportingSource1Choice1 {
10660    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10661        if let Some(ref val) = self.cd {
10662            helpers::validate_length(
10663                val,
10664                "Cd",
10665                Some(1),
10666                Some(4),
10667                &helpers::child_path(path, "Cd"),
10668                config,
10669                collector,
10670            );
10671        }
10672        if let Some(ref val) = self.prtry {
10673            helpers::validate_length(
10674                val,
10675                "Prtry",
10676                Some(1),
10677                Some(35),
10678                &helpers::child_path(path, "Prtry"),
10679                config,
10680                collector,
10681            );
10682        }
10683        if let Some(ref val) = self.prtry {
10684            helpers::validate_pattern(
10685                val,
10686                "Prtry",
10687                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10688                &helpers::child_path(path, "Prtry"),
10689                config,
10690                collector,
10691            );
10692        }
10693    }
10694}
10695
10696// ReturnReason5Choice1: Reason for the return, in a proprietary form.
10697#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10698pub struct ReturnReason5Choice1 {
10699    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10700    pub cd: Option<String>,
10701    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10702    pub prtry: Option<String>,
10703}
10704
10705impl Validate for ReturnReason5Choice1 {
10706    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10707        if let Some(ref val) = self.cd {
10708            helpers::validate_length(
10709                val,
10710                "Cd",
10711                Some(1),
10712                Some(4),
10713                &helpers::child_path(path, "Cd"),
10714                config,
10715                collector,
10716            );
10717        }
10718        if let Some(ref val) = self.prtry {
10719            helpers::validate_length(
10720                val,
10721                "Prtry",
10722                Some(1),
10723                Some(35),
10724                &helpers::child_path(path, "Prtry"),
10725                config,
10726                collector,
10727            );
10728        }
10729        if let Some(ref val) = self.prtry {
10730            helpers::validate_pattern(
10731                val,
10732                "Prtry",
10733                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10734                &helpers::child_path(path, "Prtry"),
10735                config,
10736                collector,
10737            );
10738        }
10739    }
10740}
10741
10742// SecuritiesAccount191: Description of the account.
10743#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10744pub struct SecuritiesAccount191 {
10745    #[serde(rename = "Id")]
10746    pub id: String,
10747    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10748    pub tp: Option<GenericIdentification302>,
10749    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
10750    pub nm: Option<String>,
10751}
10752
10753impl Validate for SecuritiesAccount191 {
10754    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10755        helpers::validate_length(
10756            &self.id,
10757            "Id",
10758            Some(1),
10759            Some(35),
10760            &helpers::child_path(path, "Id"),
10761            config,
10762            collector,
10763        );
10764        helpers::validate_pattern(
10765            &self.id,
10766            "Id",
10767            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10768            &helpers::child_path(path, "Id"),
10769            config,
10770            collector,
10771        );
10772        if let Some(ref val) = self.tp
10773            && config.validate_optional_fields
10774        {
10775            val.validate(&helpers::child_path(path, "Tp"), config, collector);
10776        }
10777        if let Some(ref val) = self.nm {
10778            helpers::validate_length(
10779                val,
10780                "Nm",
10781                Some(1),
10782                Some(70),
10783                &helpers::child_path(path, "Nm"),
10784                config,
10785                collector,
10786            );
10787        }
10788        if let Some(ref val) = self.nm {
10789            helpers::validate_pattern(
10790                val,
10791                "Nm",
10792                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10793                &helpers::child_path(path, "Nm"),
10794                config,
10795                collector,
10796            );
10797        }
10798    }
10799}
10800
10801// SecurityIdentification191: Textual description of a security instrument.
10802#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10803pub struct SecurityIdentification191 {
10804    #[serde(rename = "ISIN", skip_serializing_if = "Option::is_none")]
10805    pub isin: Option<String>,
10806    #[serde(rename = "OthrId", skip_serializing_if = "Option::is_none")]
10807    pub othr_id: Option<Vec<OtherIdentification11>>,
10808    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
10809    pub desc: Option<String>,
10810}
10811
10812impl Validate for SecurityIdentification191 {
10813    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10814        if let Some(ref val) = self.isin {
10815            helpers::validate_pattern(
10816                val,
10817                "ISIN",
10818                "[A-Z]{2,2}[A-Z0-9]{9,9}[0-9]{1,1}",
10819                &helpers::child_path(path, "ISIN"),
10820                config,
10821                collector,
10822            );
10823        }
10824        if let Some(ref vec) = self.othr_id
10825            && config.validate_optional_fields
10826        {
10827            for item in vec {
10828                item.validate(&helpers::child_path(path, "OthrId"), config, collector);
10829            }
10830        }
10831        if let Some(ref val) = self.desc {
10832            helpers::validate_length(
10833                val,
10834                "Desc",
10835                Some(1),
10836                Some(140),
10837                &helpers::child_path(path, "Desc"),
10838                config,
10839                collector,
10840            );
10841        }
10842        if let Some(ref val) = self.desc {
10843            helpers::validate_pattern(
10844                val,
10845                "Desc",
10846                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10847                &helpers::child_path(path, "Desc"),
10848                config,
10849                collector,
10850            );
10851        }
10852    }
10853}
10854
10855// SequenceRange1Choice1: Specified sequence to be excluded.
10856#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10857pub struct SequenceRange1Choice1 {
10858    #[serde(rename = "FrSeq", skip_serializing_if = "Option::is_none")]
10859    pub fr_seq: Option<String>,
10860    #[serde(rename = "ToSeq", skip_serializing_if = "Option::is_none")]
10861    pub to_seq: Option<String>,
10862    #[serde(rename = "FrToSeq", skip_serializing_if = "Option::is_none")]
10863    pub fr_to_seq: Option<Vec<SequenceRange11>>,
10864    #[serde(rename = "EQSeq", skip_serializing_if = "Option::is_none")]
10865    pub eq_seq: Option<Vec<String>>,
10866    #[serde(rename = "NEQSeq", skip_serializing_if = "Option::is_none")]
10867    pub neq_seq: Option<Vec<String>>,
10868}
10869
10870impl Validate for SequenceRange1Choice1 {
10871    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10872        if let Some(ref val) = self.fr_seq {
10873            helpers::validate_length(
10874                val,
10875                "FrSeq",
10876                Some(1),
10877                Some(35),
10878                &helpers::child_path(path, "FrSeq"),
10879                config,
10880                collector,
10881            );
10882        }
10883        if let Some(ref val) = self.fr_seq {
10884            helpers::validate_pattern(
10885                val,
10886                "FrSeq",
10887                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10888                &helpers::child_path(path, "FrSeq"),
10889                config,
10890                collector,
10891            );
10892        }
10893        if let Some(ref val) = self.to_seq {
10894            helpers::validate_length(
10895                val,
10896                "ToSeq",
10897                Some(1),
10898                Some(35),
10899                &helpers::child_path(path, "ToSeq"),
10900                config,
10901                collector,
10902            );
10903        }
10904        if let Some(ref val) = self.to_seq {
10905            helpers::validate_pattern(
10906                val,
10907                "ToSeq",
10908                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10909                &helpers::child_path(path, "ToSeq"),
10910                config,
10911                collector,
10912            );
10913        }
10914        if let Some(ref vec) = self.fr_to_seq
10915            && config.validate_optional_fields
10916        {
10917            for item in vec {
10918                item.validate(&helpers::child_path(path, "FrToSeq"), config, collector);
10919            }
10920        }
10921        if let Some(ref vec) = self.eq_seq {
10922            for item in vec {
10923                helpers::validate_length(
10924                    item,
10925                    "EQSeq",
10926                    Some(1),
10927                    Some(35),
10928                    &helpers::child_path(path, "EQSeq"),
10929                    config,
10930                    collector,
10931                );
10932            }
10933        }
10934        if let Some(ref vec) = self.eq_seq {
10935            for item in vec {
10936                helpers::validate_pattern(
10937                    item,
10938                    "EQSeq",
10939                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10940                    &helpers::child_path(path, "EQSeq"),
10941                    config,
10942                    collector,
10943                );
10944            }
10945        }
10946        if let Some(ref vec) = self.neq_seq {
10947            for item in vec {
10948                helpers::validate_length(
10949                    item,
10950                    "NEQSeq",
10951                    Some(1),
10952                    Some(35),
10953                    &helpers::child_path(path, "NEQSeq"),
10954                    config,
10955                    collector,
10956                );
10957            }
10958        }
10959        if let Some(ref vec) = self.neq_seq {
10960            for item in vec {
10961                helpers::validate_pattern(
10962                    item,
10963                    "NEQSeq",
10964                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10965                    &helpers::child_path(path, "NEQSeq"),
10966                    config,
10967                    collector,
10968                );
10969            }
10970        }
10971    }
10972}
10973
10974// SequenceRange11: End sequence of the range.
10975#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10976pub struct SequenceRange11 {
10977    #[serde(rename = "FrSeq")]
10978    pub fr_seq: String,
10979    #[serde(rename = "ToSeq")]
10980    pub to_seq: String,
10981}
10982
10983impl Validate for SequenceRange11 {
10984    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10985        helpers::validate_length(
10986            &self.fr_seq,
10987            "FrSeq",
10988            Some(1),
10989            Some(35),
10990            &helpers::child_path(path, "FrSeq"),
10991            config,
10992            collector,
10993        );
10994        helpers::validate_pattern(
10995            &self.fr_seq,
10996            "FrSeq",
10997            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10998            &helpers::child_path(path, "FrSeq"),
10999            config,
11000            collector,
11001        );
11002        helpers::validate_length(
11003            &self.to_seq,
11004            "ToSeq",
11005            Some(1),
11006            Some(35),
11007            &helpers::child_path(path, "ToSeq"),
11008            config,
11009            collector,
11010        );
11011        helpers::validate_pattern(
11012            &self.to_seq,
11013            "ToSeq",
11014            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11015            &helpers::child_path(path, "ToSeq"),
11016            config,
11017            collector,
11018        );
11019    }
11020}
11021
11022// StructuredRemittanceInformation161: Additional information, in free text form, to complement the structured remittance information.
11023#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11024pub struct StructuredRemittanceInformation161 {
11025    #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
11026    pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
11027    #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
11028    pub rfrd_doc_amt: Option<RemittanceAmount21>,
11029    #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
11030    pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
11031    #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
11032    pub invcr: Option<PartyIdentification1358>,
11033    #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
11034    pub invcee: Option<PartyIdentification1358>,
11035    #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
11036    pub tax_rmt: Option<TaxInformation71>,
11037    #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
11038    pub grnshmt_rmt: Option<Garnishment31>,
11039    #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
11040    pub addtl_rmt_inf: Option<Vec<String>>,
11041}
11042
11043impl Validate for StructuredRemittanceInformation161 {
11044    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11045        if let Some(ref vec) = self.rfrd_doc_inf
11046            && config.validate_optional_fields
11047        {
11048            for item in vec {
11049                item.validate(&helpers::child_path(path, "RfrdDocInf"), config, collector);
11050            }
11051        }
11052        if let Some(ref val) = self.rfrd_doc_amt
11053            && config.validate_optional_fields
11054        {
11055            val.validate(&helpers::child_path(path, "RfrdDocAmt"), config, collector);
11056        }
11057        if let Some(ref val) = self.cdtr_ref_inf
11058            && config.validate_optional_fields
11059        {
11060            val.validate(&helpers::child_path(path, "CdtrRefInf"), config, collector);
11061        }
11062        if let Some(ref val) = self.invcr
11063            && config.validate_optional_fields
11064        {
11065            val.validate(&helpers::child_path(path, "Invcr"), config, collector);
11066        }
11067        if let Some(ref val) = self.invcee
11068            && config.validate_optional_fields
11069        {
11070            val.validate(&helpers::child_path(path, "Invcee"), config, collector);
11071        }
11072        if let Some(ref val) = self.tax_rmt
11073            && config.validate_optional_fields
11074        {
11075            val.validate(&helpers::child_path(path, "TaxRmt"), config, collector);
11076        }
11077        if let Some(ref val) = self.grnshmt_rmt
11078            && config.validate_optional_fields
11079        {
11080            val.validate(&helpers::child_path(path, "GrnshmtRmt"), config, collector);
11081        }
11082        if let Some(ref vec) = self.addtl_rmt_inf {
11083            for item in vec {
11084                helpers::validate_length(
11085                    item,
11086                    "AddtlRmtInf",
11087                    Some(1),
11088                    Some(140),
11089                    &helpers::child_path(path, "AddtlRmtInf"),
11090                    config,
11091                    collector,
11092                );
11093            }
11094        }
11095        if let Some(ref vec) = self.addtl_rmt_inf {
11096            for item in vec {
11097                helpers::validate_pattern(
11098                    item,
11099                    "AddtlRmtInf",
11100                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11101                    &helpers::child_path(path, "AddtlRmtInf"),
11102                    config,
11103                    collector,
11104                );
11105            }
11106        }
11107    }
11108}
11109
11110// TaxAmount2: Set of elements used to provide details on the tax period and amount.
11111#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11112pub struct TaxAmount2 {
11113    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
11114    pub rate: Option<f64>,
11115    #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11116    pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11117    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
11118    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11119    #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
11120    pub dtls: Option<Vec<TaxRecordDetails2>>,
11121}
11122
11123impl Validate for TaxAmount2 {
11124    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11125        if let Some(ref val) = self.taxbl_base_amt
11126            && config.validate_optional_fields
11127        {
11128            val.validate(
11129                &helpers::child_path(path, "TaxblBaseAmt"),
11130                config,
11131                collector,
11132            );
11133        }
11134        if let Some(ref val) = self.ttl_amt
11135            && config.validate_optional_fields
11136        {
11137            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
11138        }
11139        if let Some(ref vec) = self.dtls
11140            && config.validate_optional_fields
11141        {
11142            for item in vec {
11143                item.validate(&helpers::child_path(path, "Dtls"), config, collector);
11144            }
11145        }
11146    }
11147}
11148
11149// TaxAmountAndType11: Amount of money, which has been typed.
11150#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11151pub struct TaxAmountAndType11 {
11152    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11153    pub tp: Option<TaxAmountType1Choice1>,
11154    #[serde(rename = "Amt")]
11155    pub amt: ActiveOrHistoricCurrencyAndAmount,
11156}
11157
11158impl Validate for TaxAmountAndType11 {
11159    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11160        if let Some(ref val) = self.tp
11161            && config.validate_optional_fields
11162        {
11163            val.validate(&helpers::child_path(path, "Tp"), config, collector);
11164        }
11165        self.amt
11166            .validate(&helpers::child_path(path, "Amt"), config, collector);
11167    }
11168}
11169
11170// TaxAmountType1Choice1: Specifies the amount type, in a free-text form.
11171#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11172pub struct TaxAmountType1Choice1 {
11173    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
11174    pub cd: Option<String>,
11175    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11176    pub prtry: Option<String>,
11177}
11178
11179impl Validate for TaxAmountType1Choice1 {
11180    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11181        if let Some(ref val) = self.cd {
11182            helpers::validate_length(
11183                val,
11184                "Cd",
11185                Some(1),
11186                Some(4),
11187                &helpers::child_path(path, "Cd"),
11188                config,
11189                collector,
11190            );
11191        }
11192        if let Some(ref val) = self.prtry {
11193            helpers::validate_length(
11194                val,
11195                "Prtry",
11196                Some(1),
11197                Some(35),
11198                &helpers::child_path(path, "Prtry"),
11199                config,
11200                collector,
11201            );
11202        }
11203        if let Some(ref val) = self.prtry {
11204            helpers::validate_pattern(
11205                val,
11206                "Prtry",
11207                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11208                &helpers::child_path(path, "Prtry"),
11209                config,
11210                collector,
11211            );
11212        }
11213    }
11214}
11215
11216// TaxAuthorisation11: Name of the debtor or the debtor's authorised representative.
11217#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11218pub struct TaxAuthorisation11 {
11219    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
11220    pub titl: Option<String>,
11221    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
11222    pub nm: Option<String>,
11223}
11224
11225impl Validate for TaxAuthorisation11 {
11226    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11227        if let Some(ref val) = self.titl {
11228            helpers::validate_length(
11229                val,
11230                "Titl",
11231                Some(1),
11232                Some(35),
11233                &helpers::child_path(path, "Titl"),
11234                config,
11235                collector,
11236            );
11237        }
11238        if let Some(ref val) = self.titl {
11239            helpers::validate_pattern(
11240                val,
11241                "Titl",
11242                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11243                &helpers::child_path(path, "Titl"),
11244                config,
11245                collector,
11246            );
11247        }
11248        if let Some(ref val) = self.nm {
11249            helpers::validate_length(
11250                val,
11251                "Nm",
11252                Some(1),
11253                Some(140),
11254                &helpers::child_path(path, "Nm"),
11255                config,
11256                collector,
11257            );
11258        }
11259        if let Some(ref val) = self.nm {
11260            helpers::validate_pattern(
11261                val,
11262                "Nm",
11263                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11264                &helpers::child_path(path, "Nm"),
11265                config,
11266                collector,
11267            );
11268        }
11269    }
11270}
11271
11272// TaxAuthorisation12: Name of the debtor or the debtor's authorised representative.
11273#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11274pub struct TaxAuthorisation12 {
11275    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
11276    pub titl: Option<String>,
11277    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
11278    pub nm: Option<String>,
11279}
11280
11281impl Validate for TaxAuthorisation12 {
11282    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11283        if let Some(ref val) = self.titl {
11284            helpers::validate_length(
11285                val,
11286                "Titl",
11287                Some(1),
11288                Some(35),
11289                &helpers::child_path(path, "Titl"),
11290                config,
11291                collector,
11292            );
11293        }
11294        if let Some(ref val) = self.titl {
11295            helpers::validate_pattern(
11296                val,
11297                "Titl",
11298                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11299                &helpers::child_path(path, "Titl"),
11300                config,
11301                collector,
11302            );
11303        }
11304        if let Some(ref val) = self.nm {
11305            helpers::validate_length(
11306                val,
11307                "Nm",
11308                Some(1),
11309                Some(140),
11310                &helpers::child_path(path, "Nm"),
11311                config,
11312                collector,
11313            );
11314        }
11315        if let Some(ref val) = self.nm {
11316            helpers::validate_pattern(
11317                val,
11318                "Nm",
11319                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11320                &helpers::child_path(path, "Nm"),
11321                config,
11322                collector,
11323            );
11324        }
11325    }
11326}
11327
11328// TaxCharges21: Amount of money resulting from the calculation of the tax.
11329#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11330pub struct TaxCharges21 {
11331    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
11332    pub id: Option<String>,
11333    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
11334    pub rate: Option<f64>,
11335    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
11336    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11337}
11338
11339impl Validate for TaxCharges21 {
11340    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11341        if let Some(ref val) = self.id {
11342            helpers::validate_length(
11343                val,
11344                "Id",
11345                Some(1),
11346                Some(35),
11347                &helpers::child_path(path, "Id"),
11348                config,
11349                collector,
11350            );
11351        }
11352        if let Some(ref val) = self.id {
11353            helpers::validate_pattern(
11354                val,
11355                "Id",
11356                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11357                &helpers::child_path(path, "Id"),
11358                config,
11359                collector,
11360            );
11361        }
11362        if let Some(ref val) = self.amt
11363            && config.validate_optional_fields
11364        {
11365            val.validate(&helpers::child_path(path, "Amt"), config, collector);
11366        }
11367    }
11368}
11369
11370// TaxInformation71: Record of tax details.
11371#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11372pub struct TaxInformation71 {
11373    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11374    pub cdtr: Option<TaxParty11>,
11375    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11376    pub dbtr: Option<TaxParty21>,
11377    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
11378    pub ultmt_dbtr: Option<TaxParty21>,
11379    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
11380    pub admstn_zone: Option<String>,
11381    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
11382    pub ref_nb: Option<String>,
11383    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
11384    pub mtd: Option<String>,
11385    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11386    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11387    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
11388    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11389    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
11390    pub dt: Option<String>,
11391    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
11392    pub seq_nb: Option<f64>,
11393    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11394    pub rcrd: Option<Vec<TaxRecord21>>,
11395}
11396
11397impl Validate for TaxInformation71 {
11398    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11399        if let Some(ref val) = self.cdtr
11400            && config.validate_optional_fields
11401        {
11402            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
11403        }
11404        if let Some(ref val) = self.dbtr
11405            && config.validate_optional_fields
11406        {
11407            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
11408        }
11409        if let Some(ref val) = self.ultmt_dbtr
11410            && config.validate_optional_fields
11411        {
11412            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
11413        }
11414        if let Some(ref val) = self.admstn_zone {
11415            helpers::validate_length(
11416                val,
11417                "AdmstnZone",
11418                Some(1),
11419                Some(35),
11420                &helpers::child_path(path, "AdmstnZone"),
11421                config,
11422                collector,
11423            );
11424        }
11425        if let Some(ref val) = self.admstn_zone {
11426            helpers::validate_pattern(
11427                val,
11428                "AdmstnZone",
11429                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11430                &helpers::child_path(path, "AdmstnZone"),
11431                config,
11432                collector,
11433            );
11434        }
11435        if let Some(ref val) = self.ref_nb {
11436            helpers::validate_length(
11437                val,
11438                "RefNb",
11439                Some(1),
11440                Some(140),
11441                &helpers::child_path(path, "RefNb"),
11442                config,
11443                collector,
11444            );
11445        }
11446        if let Some(ref val) = self.ref_nb {
11447            helpers::validate_pattern(
11448                val,
11449                "RefNb",
11450                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11451                &helpers::child_path(path, "RefNb"),
11452                config,
11453                collector,
11454            );
11455        }
11456        if let Some(ref val) = self.mtd {
11457            helpers::validate_length(
11458                val,
11459                "Mtd",
11460                Some(1),
11461                Some(35),
11462                &helpers::child_path(path, "Mtd"),
11463                config,
11464                collector,
11465            );
11466        }
11467        if let Some(ref val) = self.mtd {
11468            helpers::validate_pattern(
11469                val,
11470                "Mtd",
11471                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11472                &helpers::child_path(path, "Mtd"),
11473                config,
11474                collector,
11475            );
11476        }
11477        if let Some(ref val) = self.ttl_taxbl_base_amt
11478            && config.validate_optional_fields
11479        {
11480            val.validate(
11481                &helpers::child_path(path, "TtlTaxblBaseAmt"),
11482                config,
11483                collector,
11484            );
11485        }
11486        if let Some(ref val) = self.ttl_tax_amt
11487            && config.validate_optional_fields
11488        {
11489            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
11490        }
11491        if let Some(ref vec) = self.rcrd
11492            && config.validate_optional_fields
11493        {
11494            for item in vec {
11495                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
11496            }
11497        }
11498    }
11499}
11500
11501// TaxInformation81: Record of tax details.
11502#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11503pub struct TaxInformation81 {
11504    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11505    pub cdtr: Option<TaxParty12>,
11506    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11507    pub dbtr: Option<TaxParty22>,
11508    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
11509    pub admstn_zone: Option<String>,
11510    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
11511    pub ref_nb: Option<String>,
11512    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
11513    pub mtd: Option<String>,
11514    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11515    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11516    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
11517    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11518    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
11519    pub dt: Option<String>,
11520    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
11521    pub seq_nb: Option<f64>,
11522    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11523    pub rcrd: Option<Vec<TaxRecord22>>,
11524}
11525
11526impl Validate for TaxInformation81 {
11527    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11528        if let Some(ref val) = self.cdtr
11529            && config.validate_optional_fields
11530        {
11531            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
11532        }
11533        if let Some(ref val) = self.dbtr
11534            && config.validate_optional_fields
11535        {
11536            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
11537        }
11538        if let Some(ref val) = self.admstn_zone {
11539            helpers::validate_length(
11540                val,
11541                "AdmstnZone",
11542                Some(1),
11543                Some(35),
11544                &helpers::child_path(path, "AdmstnZone"),
11545                config,
11546                collector,
11547            );
11548        }
11549        if let Some(ref val) = self.admstn_zone {
11550            helpers::validate_pattern(
11551                val,
11552                "AdmstnZone",
11553                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11554                &helpers::child_path(path, "AdmstnZone"),
11555                config,
11556                collector,
11557            );
11558        }
11559        if let Some(ref val) = self.ref_nb {
11560            helpers::validate_length(
11561                val,
11562                "RefNb",
11563                Some(1),
11564                Some(140),
11565                &helpers::child_path(path, "RefNb"),
11566                config,
11567                collector,
11568            );
11569        }
11570        if let Some(ref val) = self.ref_nb {
11571            helpers::validate_pattern(
11572                val,
11573                "RefNb",
11574                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11575                &helpers::child_path(path, "RefNb"),
11576                config,
11577                collector,
11578            );
11579        }
11580        if let Some(ref val) = self.mtd {
11581            helpers::validate_length(
11582                val,
11583                "Mtd",
11584                Some(1),
11585                Some(35),
11586                &helpers::child_path(path, "Mtd"),
11587                config,
11588                collector,
11589            );
11590        }
11591        if let Some(ref val) = self.mtd {
11592            helpers::validate_pattern(
11593                val,
11594                "Mtd",
11595                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11596                &helpers::child_path(path, "Mtd"),
11597                config,
11598                collector,
11599            );
11600        }
11601        if let Some(ref val) = self.ttl_taxbl_base_amt
11602            && config.validate_optional_fields
11603        {
11604            val.validate(
11605                &helpers::child_path(path, "TtlTaxblBaseAmt"),
11606                config,
11607                collector,
11608            );
11609        }
11610        if let Some(ref val) = self.ttl_tax_amt
11611            && config.validate_optional_fields
11612        {
11613            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
11614        }
11615        if let Some(ref vec) = self.rcrd
11616            && config.validate_optional_fields
11617        {
11618            for item in vec {
11619                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
11620            }
11621        }
11622    }
11623}
11624
11625// TaxParty11: Type of tax payer.
11626#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11627pub struct TaxParty11 {
11628    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11629    pub tax_id: Option<String>,
11630    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11631    pub regn_id: Option<String>,
11632    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11633    pub tax_tp: Option<String>,
11634}
11635
11636impl Validate for TaxParty11 {
11637    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11638        if let Some(ref val) = self.tax_id {
11639            helpers::validate_length(
11640                val,
11641                "TaxId",
11642                Some(1),
11643                Some(35),
11644                &helpers::child_path(path, "TaxId"),
11645                config,
11646                collector,
11647            );
11648        }
11649        if let Some(ref val) = self.tax_id {
11650            helpers::validate_pattern(
11651                val,
11652                "TaxId",
11653                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11654                &helpers::child_path(path, "TaxId"),
11655                config,
11656                collector,
11657            );
11658        }
11659        if let Some(ref val) = self.regn_id {
11660            helpers::validate_length(
11661                val,
11662                "RegnId",
11663                Some(1),
11664                Some(35),
11665                &helpers::child_path(path, "RegnId"),
11666                config,
11667                collector,
11668            );
11669        }
11670        if let Some(ref val) = self.regn_id {
11671            helpers::validate_pattern(
11672                val,
11673                "RegnId",
11674                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11675                &helpers::child_path(path, "RegnId"),
11676                config,
11677                collector,
11678            );
11679        }
11680        if let Some(ref val) = self.tax_tp {
11681            helpers::validate_length(
11682                val,
11683                "TaxTp",
11684                Some(1),
11685                Some(35),
11686                &helpers::child_path(path, "TaxTp"),
11687                config,
11688                collector,
11689            );
11690        }
11691        if let Some(ref val) = self.tax_tp {
11692            helpers::validate_pattern(
11693                val,
11694                "TaxTp",
11695                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11696                &helpers::child_path(path, "TaxTp"),
11697                config,
11698                collector,
11699            );
11700        }
11701    }
11702}
11703
11704// TaxParty12: Type of tax payer.
11705#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11706pub struct TaxParty12 {
11707    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11708    pub tax_id: Option<String>,
11709    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11710    pub regn_id: Option<String>,
11711    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11712    pub tax_tp: Option<String>,
11713}
11714
11715impl Validate for TaxParty12 {
11716    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11717        if let Some(ref val) = self.tax_id {
11718            helpers::validate_length(
11719                val,
11720                "TaxId",
11721                Some(1),
11722                Some(35),
11723                &helpers::child_path(path, "TaxId"),
11724                config,
11725                collector,
11726            );
11727        }
11728        if let Some(ref val) = self.tax_id {
11729            helpers::validate_pattern(
11730                val,
11731                "TaxId",
11732                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11733                &helpers::child_path(path, "TaxId"),
11734                config,
11735                collector,
11736            );
11737        }
11738        if let Some(ref val) = self.regn_id {
11739            helpers::validate_length(
11740                val,
11741                "RegnId",
11742                Some(1),
11743                Some(35),
11744                &helpers::child_path(path, "RegnId"),
11745                config,
11746                collector,
11747            );
11748        }
11749        if let Some(ref val) = self.regn_id {
11750            helpers::validate_pattern(
11751                val,
11752                "RegnId",
11753                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11754                &helpers::child_path(path, "RegnId"),
11755                config,
11756                collector,
11757            );
11758        }
11759        if let Some(ref val) = self.tax_tp {
11760            helpers::validate_length(
11761                val,
11762                "TaxTp",
11763                Some(1),
11764                Some(35),
11765                &helpers::child_path(path, "TaxTp"),
11766                config,
11767                collector,
11768            );
11769        }
11770        if let Some(ref val) = self.tax_tp {
11771            helpers::validate_pattern(
11772                val,
11773                "TaxTp",
11774                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11775                &helpers::child_path(path, "TaxTp"),
11776                config,
11777                collector,
11778            );
11779        }
11780    }
11781}
11782
11783// TaxParty21: Details of the authorised tax paying party.
11784#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11785pub struct TaxParty21 {
11786    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11787    pub tax_id: Option<String>,
11788    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11789    pub regn_id: Option<String>,
11790    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11791    pub tax_tp: Option<String>,
11792    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
11793    pub authstn: Option<TaxAuthorisation11>,
11794}
11795
11796impl Validate for TaxParty21 {
11797    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11798        if let Some(ref val) = self.tax_id {
11799            helpers::validate_length(
11800                val,
11801                "TaxId",
11802                Some(1),
11803                Some(35),
11804                &helpers::child_path(path, "TaxId"),
11805                config,
11806                collector,
11807            );
11808        }
11809        if let Some(ref val) = self.tax_id {
11810            helpers::validate_pattern(
11811                val,
11812                "TaxId",
11813                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11814                &helpers::child_path(path, "TaxId"),
11815                config,
11816                collector,
11817            );
11818        }
11819        if let Some(ref val) = self.regn_id {
11820            helpers::validate_length(
11821                val,
11822                "RegnId",
11823                Some(1),
11824                Some(35),
11825                &helpers::child_path(path, "RegnId"),
11826                config,
11827                collector,
11828            );
11829        }
11830        if let Some(ref val) = self.regn_id {
11831            helpers::validate_pattern(
11832                val,
11833                "RegnId",
11834                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11835                &helpers::child_path(path, "RegnId"),
11836                config,
11837                collector,
11838            );
11839        }
11840        if let Some(ref val) = self.tax_tp {
11841            helpers::validate_length(
11842                val,
11843                "TaxTp",
11844                Some(1),
11845                Some(35),
11846                &helpers::child_path(path, "TaxTp"),
11847                config,
11848                collector,
11849            );
11850        }
11851        if let Some(ref val) = self.tax_tp {
11852            helpers::validate_pattern(
11853                val,
11854                "TaxTp",
11855                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11856                &helpers::child_path(path, "TaxTp"),
11857                config,
11858                collector,
11859            );
11860        }
11861        if let Some(ref val) = self.authstn
11862            && config.validate_optional_fields
11863        {
11864            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
11865        }
11866    }
11867}
11868
11869// TaxParty22: Details of the authorised tax paying party.
11870#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11871pub struct TaxParty22 {
11872    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11873    pub tax_id: Option<String>,
11874    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11875    pub regn_id: Option<String>,
11876    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11877    pub tax_tp: Option<String>,
11878    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
11879    pub authstn: Option<TaxAuthorisation12>,
11880}
11881
11882impl Validate for TaxParty22 {
11883    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11884        if let Some(ref val) = self.tax_id {
11885            helpers::validate_length(
11886                val,
11887                "TaxId",
11888                Some(1),
11889                Some(35),
11890                &helpers::child_path(path, "TaxId"),
11891                config,
11892                collector,
11893            );
11894        }
11895        if let Some(ref val) = self.tax_id {
11896            helpers::validate_pattern(
11897                val,
11898                "TaxId",
11899                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11900                &helpers::child_path(path, "TaxId"),
11901                config,
11902                collector,
11903            );
11904        }
11905        if let Some(ref val) = self.regn_id {
11906            helpers::validate_length(
11907                val,
11908                "RegnId",
11909                Some(1),
11910                Some(35),
11911                &helpers::child_path(path, "RegnId"),
11912                config,
11913                collector,
11914            );
11915        }
11916        if let Some(ref val) = self.regn_id {
11917            helpers::validate_pattern(
11918                val,
11919                "RegnId",
11920                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11921                &helpers::child_path(path, "RegnId"),
11922                config,
11923                collector,
11924            );
11925        }
11926        if let Some(ref val) = self.tax_tp {
11927            helpers::validate_length(
11928                val,
11929                "TaxTp",
11930                Some(1),
11931                Some(35),
11932                &helpers::child_path(path, "TaxTp"),
11933                config,
11934                collector,
11935            );
11936        }
11937        if let Some(ref val) = self.tax_tp {
11938            helpers::validate_pattern(
11939                val,
11940                "TaxTp",
11941                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11942                &helpers::child_path(path, "TaxTp"),
11943                config,
11944                collector,
11945            );
11946        }
11947        if let Some(ref val) = self.authstn
11948            && config.validate_optional_fields
11949        {
11950            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
11951        }
11952    }
11953}
11954
11955// TaxPeriod2: Range of time between a start date and an end date for which the tax report is provided.
11956#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11957pub struct TaxPeriod2 {
11958    #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
11959    pub yr: Option<String>,
11960    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11961    pub tp: Option<TaxRecordPeriod1Code>,
11962    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
11963    pub fr_to_dt: Option<DatePeriod2>,
11964}
11965
11966impl Validate for TaxPeriod2 {
11967    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11968        if let Some(ref val) = self.tp
11969            && config.validate_optional_fields
11970        {
11971            val.validate(&helpers::child_path(path, "Tp"), config, collector);
11972        }
11973        if let Some(ref val) = self.fr_to_dt
11974            && config.validate_optional_fields
11975        {
11976            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
11977        }
11978    }
11979}
11980
11981// TaxRecord21: Further details of the tax record.
11982#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11983pub struct TaxRecord21 {
11984    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11985    pub tp: Option<String>,
11986    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
11987    pub ctgy: Option<String>,
11988    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
11989    pub ctgy_dtls: Option<String>,
11990    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
11991    pub dbtr_sts: Option<String>,
11992    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
11993    pub cert_id: Option<String>,
11994    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
11995    pub frms_cd: Option<String>,
11996    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
11997    pub prd: Option<TaxPeriod2>,
11998    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
11999    pub tax_amt: Option<TaxAmount2>,
12000    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
12001    pub addtl_inf: Option<String>,
12002}
12003
12004impl Validate for TaxRecord21 {
12005    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12006        if let Some(ref val) = self.tp {
12007            helpers::validate_length(
12008                val,
12009                "Tp",
12010                Some(1),
12011                Some(35),
12012                &helpers::child_path(path, "Tp"),
12013                config,
12014                collector,
12015            );
12016        }
12017        if let Some(ref val) = self.tp {
12018            helpers::validate_pattern(
12019                val,
12020                "Tp",
12021                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12022                &helpers::child_path(path, "Tp"),
12023                config,
12024                collector,
12025            );
12026        }
12027        if let Some(ref val) = self.ctgy {
12028            helpers::validate_length(
12029                val,
12030                "Ctgy",
12031                Some(1),
12032                Some(35),
12033                &helpers::child_path(path, "Ctgy"),
12034                config,
12035                collector,
12036            );
12037        }
12038        if let Some(ref val) = self.ctgy {
12039            helpers::validate_pattern(
12040                val,
12041                "Ctgy",
12042                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12043                &helpers::child_path(path, "Ctgy"),
12044                config,
12045                collector,
12046            );
12047        }
12048        if let Some(ref val) = self.ctgy_dtls {
12049            helpers::validate_length(
12050                val,
12051                "CtgyDtls",
12052                Some(1),
12053                Some(35),
12054                &helpers::child_path(path, "CtgyDtls"),
12055                config,
12056                collector,
12057            );
12058        }
12059        if let Some(ref val) = self.ctgy_dtls {
12060            helpers::validate_pattern(
12061                val,
12062                "CtgyDtls",
12063                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12064                &helpers::child_path(path, "CtgyDtls"),
12065                config,
12066                collector,
12067            );
12068        }
12069        if let Some(ref val) = self.dbtr_sts {
12070            helpers::validate_length(
12071                val,
12072                "DbtrSts",
12073                Some(1),
12074                Some(35),
12075                &helpers::child_path(path, "DbtrSts"),
12076                config,
12077                collector,
12078            );
12079        }
12080        if let Some(ref val) = self.dbtr_sts {
12081            helpers::validate_pattern(
12082                val,
12083                "DbtrSts",
12084                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12085                &helpers::child_path(path, "DbtrSts"),
12086                config,
12087                collector,
12088            );
12089        }
12090        if let Some(ref val) = self.cert_id {
12091            helpers::validate_length(
12092                val,
12093                "CertId",
12094                Some(1),
12095                Some(35),
12096                &helpers::child_path(path, "CertId"),
12097                config,
12098                collector,
12099            );
12100        }
12101        if let Some(ref val) = self.cert_id {
12102            helpers::validate_pattern(
12103                val,
12104                "CertId",
12105                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12106                &helpers::child_path(path, "CertId"),
12107                config,
12108                collector,
12109            );
12110        }
12111        if let Some(ref val) = self.frms_cd {
12112            helpers::validate_length(
12113                val,
12114                "FrmsCd",
12115                Some(1),
12116                Some(35),
12117                &helpers::child_path(path, "FrmsCd"),
12118                config,
12119                collector,
12120            );
12121        }
12122        if let Some(ref val) = self.frms_cd {
12123            helpers::validate_pattern(
12124                val,
12125                "FrmsCd",
12126                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12127                &helpers::child_path(path, "FrmsCd"),
12128                config,
12129                collector,
12130            );
12131        }
12132        if let Some(ref val) = self.prd
12133            && config.validate_optional_fields
12134        {
12135            val.validate(&helpers::child_path(path, "Prd"), config, collector);
12136        }
12137        if let Some(ref val) = self.tax_amt
12138            && config.validate_optional_fields
12139        {
12140            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
12141        }
12142        if let Some(ref val) = self.addtl_inf {
12143            helpers::validate_length(
12144                val,
12145                "AddtlInf",
12146                Some(1),
12147                Some(140),
12148                &helpers::child_path(path, "AddtlInf"),
12149                config,
12150                collector,
12151            );
12152        }
12153        if let Some(ref val) = self.addtl_inf {
12154            helpers::validate_pattern(
12155                val,
12156                "AddtlInf",
12157                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12158                &helpers::child_path(path, "AddtlInf"),
12159                config,
12160                collector,
12161            );
12162        }
12163    }
12164}
12165
12166// TaxRecord22: Further details of the tax record.
12167#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12168pub struct TaxRecord22 {
12169    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
12170    pub tp: Option<String>,
12171    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
12172    pub ctgy: Option<String>,
12173    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
12174    pub ctgy_dtls: Option<String>,
12175    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
12176    pub dbtr_sts: Option<String>,
12177    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
12178    pub cert_id: Option<String>,
12179    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
12180    pub frms_cd: Option<String>,
12181    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
12182    pub prd: Option<TaxPeriod2>,
12183    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
12184    pub tax_amt: Option<TaxAmount2>,
12185    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
12186    pub addtl_inf: Option<String>,
12187}
12188
12189impl Validate for TaxRecord22 {
12190    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12191        if let Some(ref val) = self.tp {
12192            helpers::validate_length(
12193                val,
12194                "Tp",
12195                Some(1),
12196                Some(35),
12197                &helpers::child_path(path, "Tp"),
12198                config,
12199                collector,
12200            );
12201        }
12202        if let Some(ref val) = self.tp {
12203            helpers::validate_pattern(
12204                val,
12205                "Tp",
12206                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12207                &helpers::child_path(path, "Tp"),
12208                config,
12209                collector,
12210            );
12211        }
12212        if let Some(ref val) = self.ctgy {
12213            helpers::validate_length(
12214                val,
12215                "Ctgy",
12216                Some(1),
12217                Some(35),
12218                &helpers::child_path(path, "Ctgy"),
12219                config,
12220                collector,
12221            );
12222        }
12223        if let Some(ref val) = self.ctgy {
12224            helpers::validate_pattern(
12225                val,
12226                "Ctgy",
12227                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12228                &helpers::child_path(path, "Ctgy"),
12229                config,
12230                collector,
12231            );
12232        }
12233        if let Some(ref val) = self.ctgy_dtls {
12234            helpers::validate_length(
12235                val,
12236                "CtgyDtls",
12237                Some(1),
12238                Some(35),
12239                &helpers::child_path(path, "CtgyDtls"),
12240                config,
12241                collector,
12242            );
12243        }
12244        if let Some(ref val) = self.ctgy_dtls {
12245            helpers::validate_pattern(
12246                val,
12247                "CtgyDtls",
12248                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12249                &helpers::child_path(path, "CtgyDtls"),
12250                config,
12251                collector,
12252            );
12253        }
12254        if let Some(ref val) = self.dbtr_sts {
12255            helpers::validate_length(
12256                val,
12257                "DbtrSts",
12258                Some(1),
12259                Some(35),
12260                &helpers::child_path(path, "DbtrSts"),
12261                config,
12262                collector,
12263            );
12264        }
12265        if let Some(ref val) = self.dbtr_sts {
12266            helpers::validate_pattern(
12267                val,
12268                "DbtrSts",
12269                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12270                &helpers::child_path(path, "DbtrSts"),
12271                config,
12272                collector,
12273            );
12274        }
12275        if let Some(ref val) = self.cert_id {
12276            helpers::validate_length(
12277                val,
12278                "CertId",
12279                Some(1),
12280                Some(35),
12281                &helpers::child_path(path, "CertId"),
12282                config,
12283                collector,
12284            );
12285        }
12286        if let Some(ref val) = self.cert_id {
12287            helpers::validate_pattern(
12288                val,
12289                "CertId",
12290                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12291                &helpers::child_path(path, "CertId"),
12292                config,
12293                collector,
12294            );
12295        }
12296        if let Some(ref val) = self.frms_cd {
12297            helpers::validate_length(
12298                val,
12299                "FrmsCd",
12300                Some(1),
12301                Some(35),
12302                &helpers::child_path(path, "FrmsCd"),
12303                config,
12304                collector,
12305            );
12306        }
12307        if let Some(ref val) = self.frms_cd {
12308            helpers::validate_pattern(
12309                val,
12310                "FrmsCd",
12311                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12312                &helpers::child_path(path, "FrmsCd"),
12313                config,
12314                collector,
12315            );
12316        }
12317        if let Some(ref val) = self.prd
12318            && config.validate_optional_fields
12319        {
12320            val.validate(&helpers::child_path(path, "Prd"), config, collector);
12321        }
12322        if let Some(ref val) = self.tax_amt
12323            && config.validate_optional_fields
12324        {
12325            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
12326        }
12327        if let Some(ref val) = self.addtl_inf {
12328            helpers::validate_length(
12329                val,
12330                "AddtlInf",
12331                Some(1),
12332                Some(140),
12333                &helpers::child_path(path, "AddtlInf"),
12334                config,
12335                collector,
12336            );
12337        }
12338        if let Some(ref val) = self.addtl_inf {
12339            helpers::validate_pattern(
12340                val,
12341                "AddtlInf",
12342                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12343                &helpers::child_path(path, "AddtlInf"),
12344                config,
12345                collector,
12346            );
12347        }
12348    }
12349}
12350
12351// TaxRecordDetails2: Underlying tax amount related to the specified period.
12352#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12353pub struct TaxRecordDetails2 {
12354    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
12355    pub prd: Option<TaxPeriod2>,
12356    #[serde(rename = "Amt")]
12357    pub amt: ActiveOrHistoricCurrencyAndAmount,
12358}
12359
12360impl Validate for TaxRecordDetails2 {
12361    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12362        if let Some(ref val) = self.prd
12363            && config.validate_optional_fields
12364        {
12365            val.validate(&helpers::child_path(path, "Prd"), config, collector);
12366        }
12367        self.amt
12368            .validate(&helpers::child_path(path, "Amt"), config, collector);
12369    }
12370}
12371
12372// TaxRecordPeriod1Code: Tax is related to the second half of the period.
12373#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12374pub enum TaxRecordPeriod1Code {
12375    #[default]
12376    #[serde(rename = "MM01")]
12377    CodeMM01,
12378    #[serde(rename = "MM02")]
12379    CodeMM02,
12380    #[serde(rename = "MM03")]
12381    CodeMM03,
12382    #[serde(rename = "MM04")]
12383    CodeMM04,
12384    #[serde(rename = "MM05")]
12385    CodeMM05,
12386    #[serde(rename = "MM06")]
12387    CodeMM06,
12388    #[serde(rename = "MM07")]
12389    CodeMM07,
12390    #[serde(rename = "MM08")]
12391    CodeMM08,
12392    #[serde(rename = "MM09")]
12393    CodeMM09,
12394    #[serde(rename = "MM10")]
12395    CodeMM10,
12396    #[serde(rename = "MM11")]
12397    CodeMM11,
12398    #[serde(rename = "MM12")]
12399    CodeMM12,
12400    #[serde(rename = "QTR1")]
12401    CodeQTR1,
12402    #[serde(rename = "QTR2")]
12403    CodeQTR2,
12404    #[serde(rename = "QTR3")]
12405    CodeQTR3,
12406    #[serde(rename = "QTR4")]
12407    CodeQTR4,
12408    #[serde(rename = "HLF1")]
12409    CodeHLF1,
12410    #[serde(rename = "HLF2")]
12411    CodeHLF2,
12412}
12413
12414impl Validate for TaxRecordPeriod1Code {
12415    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
12416        // Enum validation is typically empty
12417    }
12418}
12419
12420// TechnicalInputChannel1Choice1: Technical channel used to input the instruction, in a proprietary form.
12421#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12422pub struct TechnicalInputChannel1Choice1 {
12423    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
12424    pub cd: Option<String>,
12425    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12426    pub prtry: Option<String>,
12427}
12428
12429impl Validate for TechnicalInputChannel1Choice1 {
12430    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12431        if let Some(ref val) = self.cd {
12432            helpers::validate_length(
12433                val,
12434                "Cd",
12435                Some(1),
12436                Some(4),
12437                &helpers::child_path(path, "Cd"),
12438                config,
12439                collector,
12440            );
12441        }
12442        if let Some(ref val) = self.prtry {
12443            helpers::validate_length(
12444                val,
12445                "Prtry",
12446                Some(1),
12447                Some(35),
12448                &helpers::child_path(path, "Prtry"),
12449                config,
12450                collector,
12451            );
12452        }
12453        if let Some(ref val) = self.prtry {
12454            helpers::validate_pattern(
12455                val,
12456                "Prtry",
12457                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12458                &helpers::child_path(path, "Prtry"),
12459                config,
12460                collector,
12461            );
12462        }
12463    }
12464}
12465
12466// TotalTransactions61: Specifies the total number and sum of entries per bank transaction code.
12467#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12468pub struct TotalTransactions61 {
12469    #[serde(rename = "TtlNtries", skip_serializing_if = "Option::is_none")]
12470    pub ttl_ntries: Option<NumberAndSumOfTransactions4>,
12471    #[serde(rename = "TtlCdtNtries", skip_serializing_if = "Option::is_none")]
12472    pub ttl_cdt_ntries: Option<NumberAndSumOfTransactions1>,
12473    #[serde(rename = "TtlDbtNtries", skip_serializing_if = "Option::is_none")]
12474    pub ttl_dbt_ntries: Option<NumberAndSumOfTransactions1>,
12475    #[serde(rename = "TtlNtriesPerBkTxCd", skip_serializing_if = "Option::is_none")]
12476    pub ttl_ntries_per_bk_tx_cd: Option<Vec<TotalsPerBankTransactionCode51>>,
12477}
12478
12479impl Validate for TotalTransactions61 {
12480    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12481        if let Some(ref val) = self.ttl_ntries
12482            && config.validate_optional_fields
12483        {
12484            val.validate(&helpers::child_path(path, "TtlNtries"), config, collector);
12485        }
12486        if let Some(ref val) = self.ttl_cdt_ntries
12487            && config.validate_optional_fields
12488        {
12489            val.validate(
12490                &helpers::child_path(path, "TtlCdtNtries"),
12491                config,
12492                collector,
12493            );
12494        }
12495        if let Some(ref val) = self.ttl_dbt_ntries
12496            && config.validate_optional_fields
12497        {
12498            val.validate(
12499                &helpers::child_path(path, "TtlDbtNtries"),
12500                config,
12501                collector,
12502            );
12503        }
12504        if let Some(ref vec) = self.ttl_ntries_per_bk_tx_cd
12505            && config.validate_optional_fields
12506        {
12507            for item in vec {
12508                item.validate(
12509                    &helpers::child_path(path, "TtlNtriesPerBkTxCd"),
12510                    config,
12511                    collector,
12512                );
12513            }
12514        }
12515    }
12516}
12517
12518// TotalsPerBankTransactionCode51: Indicates the date (and time) of the transaction summary.
12519#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12520pub struct TotalsPerBankTransactionCode51 {
12521    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
12522    pub nb_of_ntries: Option<String>,
12523    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
12524    pub sum: Option<f64>,
12525    #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
12526    pub ttl_net_ntry: Option<AmountAndDirection35>,
12527    #[serde(rename = "CdtNtries", skip_serializing_if = "Option::is_none")]
12528    pub cdt_ntries: Option<NumberAndSumOfTransactions1>,
12529    #[serde(rename = "DbtNtries", skip_serializing_if = "Option::is_none")]
12530    pub dbt_ntries: Option<NumberAndSumOfTransactions1>,
12531    #[serde(rename = "FcstInd", skip_serializing_if = "Option::is_none")]
12532    pub fcst_ind: Option<bool>,
12533    #[serde(rename = "BkTxCd")]
12534    pub bk_tx_cd: BankTransactionCodeStructure41,
12535    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
12536    pub avlbty: Option<Vec<CashAvailability1>>,
12537    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
12538    pub dt: Option<DateAndDateTime2Choice1>,
12539}
12540
12541impl Validate for TotalsPerBankTransactionCode51 {
12542    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12543        if let Some(ref val) = self.nb_of_ntries {
12544            helpers::validate_pattern(
12545                val,
12546                "NbOfNtries",
12547                "[0-9]{1,15}",
12548                &helpers::child_path(path, "NbOfNtries"),
12549                config,
12550                collector,
12551            );
12552        }
12553        if let Some(ref val) = self.ttl_net_ntry
12554            && config.validate_optional_fields
12555        {
12556            val.validate(&helpers::child_path(path, "TtlNetNtry"), config, collector);
12557        }
12558        if let Some(ref val) = self.cdt_ntries
12559            && config.validate_optional_fields
12560        {
12561            val.validate(&helpers::child_path(path, "CdtNtries"), config, collector);
12562        }
12563        if let Some(ref val) = self.dbt_ntries
12564            && config.validate_optional_fields
12565        {
12566            val.validate(&helpers::child_path(path, "DbtNtries"), config, collector);
12567        }
12568        self.bk_tx_cd
12569            .validate(&helpers::child_path(path, "BkTxCd"), config, collector);
12570        if let Some(ref vec) = self.avlbty
12571            && config.validate_optional_fields
12572        {
12573            for item in vec {
12574                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
12575            }
12576        }
12577        if let Some(ref val) = self.dt
12578            && config.validate_optional_fields
12579        {
12580            val.validate(&helpers::child_path(path, "Dt"), config, collector);
12581        }
12582    }
12583}
12584
12585// TrackData11: Card track content or equivalent.
12586#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12587pub struct TrackData11 {
12588    #[serde(rename = "TrckNb", skip_serializing_if = "Option::is_none")]
12589    pub trck_nb: Option<String>,
12590    #[serde(rename = "TrckVal")]
12591    pub trck_val: String,
12592}
12593
12594impl Validate for TrackData11 {
12595    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12596        if let Some(ref val) = self.trck_nb {
12597            helpers::validate_pattern(
12598                val,
12599                "TrckNb",
12600                "[0-9]",
12601                &helpers::child_path(path, "TrckNb"),
12602                config,
12603                collector,
12604            );
12605        }
12606        helpers::validate_length(
12607            &self.trck_val,
12608            "TrckVal",
12609            Some(1),
12610            Some(140),
12611            &helpers::child_path(path, "TrckVal"),
12612            config,
12613            collector,
12614        );
12615        helpers::validate_pattern(
12616            &self.trck_val,
12617            "TrckVal",
12618            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12619            &helpers::child_path(path, "TrckVal"),
12620            config,
12621            collector,
12622        );
12623    }
12624}
12625
12626// TransactionAgents51: Proprietary agent related to the underlying transaction.
12627#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12628pub struct TransactionAgents51 {
12629    #[serde(rename = "InstgAgt", skip_serializing_if = "Option::is_none")]
12630    pub instg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12631    #[serde(rename = "InstdAgt", skip_serializing_if = "Option::is_none")]
12632    pub instd_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12633    #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
12634    pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification67>,
12635    #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
12636    pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12637    #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
12638    pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification65>,
12639    #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
12640    pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification65>,
12641    #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
12642    pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification65>,
12643    #[serde(rename = "RcvgAgt", skip_serializing_if = "Option::is_none")]
12644    pub rcvg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12645    #[serde(rename = "DlvrgAgt", skip_serializing_if = "Option::is_none")]
12646    pub dlvrg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12647    #[serde(rename = "IssgAgt", skip_serializing_if = "Option::is_none")]
12648    pub issg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12649    #[serde(rename = "SttlmPlc", skip_serializing_if = "Option::is_none")]
12650    pub sttlm_plc: Option<BranchAndFinancialInstitutionIdentification65>,
12651    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12652    pub prtry: Option<Vec<ProprietaryAgent41>>,
12653}
12654
12655impl Validate for TransactionAgents51 {
12656    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12657        if let Some(ref val) = self.instg_agt
12658            && config.validate_optional_fields
12659        {
12660            val.validate(&helpers::child_path(path, "InstgAgt"), config, collector);
12661        }
12662        if let Some(ref val) = self.instd_agt
12663            && config.validate_optional_fields
12664        {
12665            val.validate(&helpers::child_path(path, "InstdAgt"), config, collector);
12666        }
12667        if let Some(ref val) = self.dbtr_agt
12668            && config.validate_optional_fields
12669        {
12670            val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
12671        }
12672        if let Some(ref val) = self.cdtr_agt
12673            && config.validate_optional_fields
12674        {
12675            val.validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
12676        }
12677        if let Some(ref val) = self.intrmy_agt1
12678            && config.validate_optional_fields
12679        {
12680            val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
12681        }
12682        if let Some(ref val) = self.intrmy_agt2
12683            && config.validate_optional_fields
12684        {
12685            val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
12686        }
12687        if let Some(ref val) = self.intrmy_agt3
12688            && config.validate_optional_fields
12689        {
12690            val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
12691        }
12692        if let Some(ref val) = self.rcvg_agt
12693            && config.validate_optional_fields
12694        {
12695            val.validate(&helpers::child_path(path, "RcvgAgt"), config, collector);
12696        }
12697        if let Some(ref val) = self.dlvrg_agt
12698            && config.validate_optional_fields
12699        {
12700            val.validate(&helpers::child_path(path, "DlvrgAgt"), config, collector);
12701        }
12702        if let Some(ref val) = self.issg_agt
12703            && config.validate_optional_fields
12704        {
12705            val.validate(&helpers::child_path(path, "IssgAgt"), config, collector);
12706        }
12707        if let Some(ref val) = self.sttlm_plc
12708            && config.validate_optional_fields
12709        {
12710            val.validate(&helpers::child_path(path, "SttlmPlc"), config, collector);
12711        }
12712        if let Some(ref vec) = self.prtry
12713            && config.validate_optional_fields
12714        {
12715            for item in vec {
12716                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
12717            }
12718        }
12719    }
12720}
12721
12722// TransactionChannel1Code: Payment on television.
12723#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12724pub enum TransactionChannel1Code {
12725    #[default]
12726    #[serde(rename = "MAIL")]
12727    CodeMAIL,
12728    #[serde(rename = "TLPH")]
12729    CodeTLPH,
12730    #[serde(rename = "ECOM")]
12731    CodeECOM,
12732    #[serde(rename = "TVPY")]
12733    CodeTVPY,
12734}
12735
12736impl Validate for TransactionChannel1Code {
12737    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
12738        // Enum validation is typically empty
12739    }
12740}
12741
12742// TransactionDates31: Proprietary date related to the underlying transaction.
12743#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12744pub struct TransactionDates31 {
12745    #[serde(rename = "AccptncDtTm", skip_serializing_if = "Option::is_none")]
12746    pub accptnc_dt_tm: Option<String>,
12747    #[serde(
12748        rename = "TradActvtyCtrctlSttlmDt",
12749        skip_serializing_if = "Option::is_none"
12750    )]
12751    pub trad_actvty_ctrctl_sttlm_dt: Option<String>,
12752    #[serde(rename = "TradDt", skip_serializing_if = "Option::is_none")]
12753    pub trad_dt: Option<String>,
12754    #[serde(rename = "IntrBkSttlmDt", skip_serializing_if = "Option::is_none")]
12755    pub intr_bk_sttlm_dt: Option<String>,
12756    #[serde(rename = "StartDt", skip_serializing_if = "Option::is_none")]
12757    pub start_dt: Option<String>,
12758    #[serde(rename = "EndDt", skip_serializing_if = "Option::is_none")]
12759    pub end_dt: Option<String>,
12760    #[serde(rename = "TxDtTm", skip_serializing_if = "Option::is_none")]
12761    pub tx_dt_tm: Option<String>,
12762    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12763    pub prtry: Option<Vec<ProprietaryDate31>>,
12764}
12765
12766impl Validate for TransactionDates31 {
12767    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12768        if let Some(ref val) = self.accptnc_dt_tm {
12769            helpers::validate_pattern(
12770                val,
12771                "AccptncDtTm",
12772                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
12773                &helpers::child_path(path, "AccptncDtTm"),
12774                config,
12775                collector,
12776            );
12777        }
12778        if let Some(ref val) = self.tx_dt_tm {
12779            helpers::validate_pattern(
12780                val,
12781                "TxDtTm",
12782                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
12783                &helpers::child_path(path, "TxDtTm"),
12784                config,
12785                collector,
12786            );
12787        }
12788        if let Some(ref vec) = self.prtry
12789            && config.validate_optional_fields
12790        {
12791            for item in vec {
12792                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
12793            }
12794        }
12795    }
12796}
12797
12798// TransactionEnvironment1Code: Public environment.
12799#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12800pub enum TransactionEnvironment1Code {
12801    #[default]
12802    #[serde(rename = "MERC")]
12803    CodeMERC,
12804    #[serde(rename = "PRIV")]
12805    CodePRIV,
12806    #[serde(rename = "PUBL")]
12807    CodePUBL,
12808}
12809
12810impl Validate for TransactionEnvironment1Code {
12811    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
12812        // Enum validation is typically empty
12813    }
12814}
12815
12816// TransactionIdentifier11: Identification of the transaction that has to be unique for a time period.
12817#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12818pub struct TransactionIdentifier11 {
12819    #[serde(rename = "TxDtTm")]
12820    pub tx_dt_tm: String,
12821    #[serde(rename = "TxRef")]
12822    pub tx_ref: String,
12823}
12824
12825impl Validate for TransactionIdentifier11 {
12826    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12827        helpers::validate_pattern(
12828            &self.tx_dt_tm,
12829            "TxDtTm",
12830            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
12831            &helpers::child_path(path, "TxDtTm"),
12832            config,
12833            collector,
12834        );
12835        helpers::validate_length(
12836            &self.tx_ref,
12837            "TxRef",
12838            Some(1),
12839            Some(35),
12840            &helpers::child_path(path, "TxRef"),
12841            config,
12842            collector,
12843        );
12844        helpers::validate_pattern(
12845            &self.tx_ref,
12846            "TxRef",
12847            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12848            &helpers::child_path(path, "TxRef"),
12849            config,
12850            collector,
12851        );
12852    }
12853}
12854
12855// TransactionInterest41: Individual interest record.
12856#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12857pub struct TransactionInterest41 {
12858    #[serde(rename = "TtlIntrstAndTaxAmt", skip_serializing_if = "Option::is_none")]
12859    pub ttl_intrst_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
12860    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
12861    pub rcrd: Option<Vec<InterestRecord21>>,
12862}
12863
12864impl Validate for TransactionInterest41 {
12865    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12866        if let Some(ref val) = self.ttl_intrst_and_tax_amt
12867            && config.validate_optional_fields
12868        {
12869            val.validate(
12870                &helpers::child_path(path, "TtlIntrstAndTaxAmt"),
12871                config,
12872                collector,
12873            );
12874        }
12875        if let Some(ref vec) = self.rcrd
12876            && config.validate_optional_fields
12877        {
12878            for item in vec {
12879                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
12880            }
12881        }
12882    }
12883}
12884
12885// TransactionParties61: Proprietary party related to the underlying transaction.
12886#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12887pub struct TransactionParties61 {
12888    #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
12889    pub initg_pty: Option<Party40Choice1>,
12890    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
12891    pub dbtr: Option<Party40Choice2>,
12892    #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
12893    pub dbtr_acct: Option<CashAccount383>,
12894    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
12895    pub ultmt_dbtr: Option<Party40Choice3>,
12896    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
12897    pub cdtr: Option<Party40Choice4>,
12898    #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
12899    pub cdtr_acct: Option<CashAccount384>,
12900    #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
12901    pub ultmt_cdtr: Option<Party40Choice4>,
12902    #[serde(rename = "TradgPty", skip_serializing_if = "Option::is_none")]
12903    pub tradg_pty: Option<Party40Choice4>,
12904    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12905    pub prtry: Option<Vec<ProprietaryParty51>>,
12906}
12907
12908impl Validate for TransactionParties61 {
12909    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12910        if let Some(ref val) = self.initg_pty
12911            && config.validate_optional_fields
12912        {
12913            val.validate(&helpers::child_path(path, "InitgPty"), config, collector);
12914        }
12915        if let Some(ref val) = self.dbtr
12916            && config.validate_optional_fields
12917        {
12918            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
12919        }
12920        if let Some(ref val) = self.dbtr_acct
12921            && config.validate_optional_fields
12922        {
12923            val.validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
12924        }
12925        if let Some(ref val) = self.ultmt_dbtr
12926            && config.validate_optional_fields
12927        {
12928            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
12929        }
12930        if let Some(ref val) = self.cdtr
12931            && config.validate_optional_fields
12932        {
12933            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
12934        }
12935        if let Some(ref val) = self.cdtr_acct
12936            && config.validate_optional_fields
12937        {
12938            val.validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
12939        }
12940        if let Some(ref val) = self.ultmt_cdtr
12941            && config.validate_optional_fields
12942        {
12943            val.validate(&helpers::child_path(path, "UltmtCdtr"), config, collector);
12944        }
12945        if let Some(ref val) = self.tradg_pty
12946            && config.validate_optional_fields
12947        {
12948            val.validate(&helpers::child_path(path, "TradgPty"), config, collector);
12949        }
12950        if let Some(ref vec) = self.prtry
12951            && config.validate_optional_fields
12952        {
12953            for item in vec {
12954                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
12955            }
12956        }
12957    }
12958}
12959
12960// TransactionPrice4Choice1: Proprietary price specification related to the underlying transaction.
12961#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12962pub struct TransactionPrice4Choice1 {
12963    #[serde(rename = "DealPric", skip_serializing_if = "Option::is_none")]
12964    pub deal_pric: Option<Price7>,
12965    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12966    pub prtry: Option<Vec<ProprietaryPrice21>>,
12967}
12968
12969impl Validate for TransactionPrice4Choice1 {
12970    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12971        if let Some(ref val) = self.deal_pric
12972            && config.validate_optional_fields
12973        {
12974            val.validate(&helpers::child_path(path, "DealPric"), config, collector);
12975        }
12976        if let Some(ref vec) = self.prtry
12977            && config.validate_optional_fields
12978        {
12979            for item in vec {
12980                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
12981            }
12982        }
12983    }
12984}
12985
12986// TransactionQuantities3Choice1: Proprietary quantities specification defined in the underlying transaction.
12987#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12988pub struct TransactionQuantities3Choice1 {
12989    #[serde(rename = "Qty", skip_serializing_if = "Option::is_none")]
12990    pub qty: Option<FinancialInstrumentQuantity1Choice>,
12991    #[serde(rename = "OrgnlAndCurFaceAmt", skip_serializing_if = "Option::is_none")]
12992    pub orgnl_and_cur_face_amt: Option<OriginalAndCurrentQuantities1>,
12993    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12994    pub prtry: Option<ProprietaryQuantity11>,
12995}
12996
12997impl Validate for TransactionQuantities3Choice1 {
12998    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12999        if let Some(ref val) = self.qty
13000            && config.validate_optional_fields
13001        {
13002            val.validate(&helpers::child_path(path, "Qty"), config, collector);
13003        }
13004        if let Some(ref val) = self.orgnl_and_cur_face_amt
13005            && config.validate_optional_fields
13006        {
13007            val.validate(
13008                &helpers::child_path(path, "OrgnlAndCurFaceAmt"),
13009                config,
13010                collector,
13011            );
13012        }
13013        if let Some(ref val) = self.prtry
13014            && config.validate_optional_fields
13015        {
13016            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
13017        }
13018    }
13019}
13020
13021// TransactionReferences61: Proprietary reference related to the underlying transaction.
13022#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13023pub struct TransactionReferences61 {
13024    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
13025    pub msg_id: Option<String>,
13026    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
13027    pub acct_svcr_ref: Option<String>,
13028    #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
13029    pub pmt_inf_id: Option<String>,
13030    #[serde(rename = "InstrId")]
13031    pub instr_id: String,
13032    #[serde(rename = "EndToEndId", skip_serializing_if = "Option::is_none")]
13033    pub end_to_end_id: Option<String>,
13034    #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
13035    pub uetr: Option<String>,
13036    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
13037    pub tx_id: Option<String>,
13038    #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
13039    pub mndt_id: Option<String>,
13040    #[serde(rename = "ChqNb", skip_serializing_if = "Option::is_none")]
13041    pub chq_nb: Option<String>,
13042    #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
13043    pub clr_sys_ref: Option<String>,
13044    #[serde(rename = "AcctOwnrTxId", skip_serializing_if = "Option::is_none")]
13045    pub acct_ownr_tx_id: Option<String>,
13046    #[serde(rename = "AcctSvcrTxId", skip_serializing_if = "Option::is_none")]
13047    pub acct_svcr_tx_id: Option<String>,
13048    #[serde(rename = "MktInfrstrctrTxId", skip_serializing_if = "Option::is_none")]
13049    pub mkt_infrstrctr_tx_id: Option<String>,
13050    #[serde(rename = "PrcgId", skip_serializing_if = "Option::is_none")]
13051    pub prcg_id: Option<String>,
13052    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
13053    pub prtry: Option<Vec<ProprietaryReference11>>,
13054}
13055
13056impl Validate for TransactionReferences61 {
13057    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
13058        if let Some(ref val) = self.msg_id {
13059            helpers::validate_length(
13060                val,
13061                "MsgId",
13062                Some(1),
13063                Some(35),
13064                &helpers::child_path(path, "MsgId"),
13065                config,
13066                collector,
13067            );
13068        }
13069        if let Some(ref val) = self.msg_id {
13070            helpers::validate_pattern(
13071                val,
13072                "MsgId",
13073                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13074                &helpers::child_path(path, "MsgId"),
13075                config,
13076                collector,
13077            );
13078        }
13079        if let Some(ref val) = self.acct_svcr_ref {
13080            helpers::validate_length(
13081                val,
13082                "AcctSvcrRef",
13083                Some(1),
13084                Some(35),
13085                &helpers::child_path(path, "AcctSvcrRef"),
13086                config,
13087                collector,
13088            );
13089        }
13090        if let Some(ref val) = self.acct_svcr_ref {
13091            helpers::validate_pattern(
13092                val,
13093                "AcctSvcrRef",
13094                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13095                &helpers::child_path(path, "AcctSvcrRef"),
13096                config,
13097                collector,
13098            );
13099        }
13100        if let Some(ref val) = self.pmt_inf_id {
13101            helpers::validate_length(
13102                val,
13103                "PmtInfId",
13104                Some(1),
13105                Some(35),
13106                &helpers::child_path(path, "PmtInfId"),
13107                config,
13108                collector,
13109            );
13110        }
13111        if let Some(ref val) = self.pmt_inf_id {
13112            helpers::validate_pattern(
13113                val,
13114                "PmtInfId",
13115                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13116                &helpers::child_path(path, "PmtInfId"),
13117                config,
13118                collector,
13119            );
13120        }
13121        helpers::validate_length(
13122            &self.instr_id,
13123            "InstrId",
13124            Some(1),
13125            Some(35),
13126            &helpers::child_path(path, "InstrId"),
13127            config,
13128            collector,
13129        );
13130        helpers::validate_pattern(
13131            &self.instr_id,
13132            "InstrId",
13133            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13134            &helpers::child_path(path, "InstrId"),
13135            config,
13136            collector,
13137        );
13138        if let Some(ref val) = self.end_to_end_id {
13139            helpers::validate_length(
13140                val,
13141                "EndToEndId",
13142                Some(1),
13143                Some(35),
13144                &helpers::child_path(path, "EndToEndId"),
13145                config,
13146                collector,
13147            );
13148        }
13149        if let Some(ref val) = self.end_to_end_id {
13150            helpers::validate_pattern(
13151                val,
13152                "EndToEndId",
13153                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13154                &helpers::child_path(path, "EndToEndId"),
13155                config,
13156                collector,
13157            );
13158        }
13159        if let Some(ref val) = self.uetr {
13160            helpers::validate_pattern(
13161                val,
13162                "UETR",
13163                "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
13164                &helpers::child_path(path, "UETR"),
13165                config,
13166                collector,
13167            );
13168        }
13169        if let Some(ref val) = self.tx_id {
13170            helpers::validate_length(
13171                val,
13172                "TxId",
13173                Some(1),
13174                Some(35),
13175                &helpers::child_path(path, "TxId"),
13176                config,
13177                collector,
13178            );
13179        }
13180        if let Some(ref val) = self.tx_id {
13181            helpers::validate_pattern(
13182                val,
13183                "TxId",
13184                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13185                &helpers::child_path(path, "TxId"),
13186                config,
13187                collector,
13188            );
13189        }
13190        if let Some(ref val) = self.mndt_id {
13191            helpers::validate_length(
13192                val,
13193                "MndtId",
13194                Some(1),
13195                Some(35),
13196                &helpers::child_path(path, "MndtId"),
13197                config,
13198                collector,
13199            );
13200        }
13201        if let Some(ref val) = self.mndt_id {
13202            helpers::validate_pattern(
13203                val,
13204                "MndtId",
13205                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13206                &helpers::child_path(path, "MndtId"),
13207                config,
13208                collector,
13209            );
13210        }
13211        if let Some(ref val) = self.chq_nb {
13212            helpers::validate_length(
13213                val,
13214                "ChqNb",
13215                Some(1),
13216                Some(35),
13217                &helpers::child_path(path, "ChqNb"),
13218                config,
13219                collector,
13220            );
13221        }
13222        if let Some(ref val) = self.chq_nb {
13223            helpers::validate_pattern(
13224                val,
13225                "ChqNb",
13226                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13227                &helpers::child_path(path, "ChqNb"),
13228                config,
13229                collector,
13230            );
13231        }
13232        if let Some(ref val) = self.clr_sys_ref {
13233            helpers::validate_length(
13234                val,
13235                "ClrSysRef",
13236                Some(1),
13237                Some(35),
13238                &helpers::child_path(path, "ClrSysRef"),
13239                config,
13240                collector,
13241            );
13242        }
13243        if let Some(ref val) = self.clr_sys_ref {
13244            helpers::validate_pattern(
13245                val,
13246                "ClrSysRef",
13247                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13248                &helpers::child_path(path, "ClrSysRef"),
13249                config,
13250                collector,
13251            );
13252        }
13253        if let Some(ref val) = self.acct_ownr_tx_id {
13254            helpers::validate_length(
13255                val,
13256                "AcctOwnrTxId",
13257                Some(1),
13258                Some(35),
13259                &helpers::child_path(path, "AcctOwnrTxId"),
13260                config,
13261                collector,
13262            );
13263        }
13264        if let Some(ref val) = self.acct_ownr_tx_id {
13265            helpers::validate_pattern(
13266                val,
13267                "AcctOwnrTxId",
13268                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13269                &helpers::child_path(path, "AcctOwnrTxId"),
13270                config,
13271                collector,
13272            );
13273        }
13274        if let Some(ref val) = self.acct_svcr_tx_id {
13275            helpers::validate_length(
13276                val,
13277                "AcctSvcrTxId",
13278                Some(1),
13279                Some(35),
13280                &helpers::child_path(path, "AcctSvcrTxId"),
13281                config,
13282                collector,
13283            );
13284        }
13285        if let Some(ref val) = self.acct_svcr_tx_id {
13286            helpers::validate_pattern(
13287                val,
13288                "AcctSvcrTxId",
13289                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13290                &helpers::child_path(path, "AcctSvcrTxId"),
13291                config,
13292                collector,
13293            );
13294        }
13295        if let Some(ref val) = self.mkt_infrstrctr_tx_id {
13296            helpers::validate_length(
13297                val,
13298                "MktInfrstrctrTxId",
13299                Some(1),
13300                Some(35),
13301                &helpers::child_path(path, "MktInfrstrctrTxId"),
13302                config,
13303                collector,
13304            );
13305        }
13306        if let Some(ref val) = self.mkt_infrstrctr_tx_id {
13307            helpers::validate_pattern(
13308                val,
13309                "MktInfrstrctrTxId",
13310                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13311                &helpers::child_path(path, "MktInfrstrctrTxId"),
13312                config,
13313                collector,
13314            );
13315        }
13316        if let Some(ref val) = self.prcg_id {
13317            helpers::validate_length(
13318                val,
13319                "PrcgId",
13320                Some(1),
13321                Some(35),
13322                &helpers::child_path(path, "PrcgId"),
13323                config,
13324                collector,
13325            );
13326        }
13327        if let Some(ref val) = self.prcg_id {
13328            helpers::validate_pattern(
13329                val,
13330                "PrcgId",
13331                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13332                &helpers::child_path(path, "PrcgId"),
13333                config,
13334                collector,
13335            );
13336        }
13337        if let Some(ref vec) = self.prtry
13338            && config.validate_optional_fields
13339        {
13340            for item in vec {
13341                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
13342            }
13343        }
13344    }
13345}
13346
13347// UnitOfMeasure1Code: Unit of measure equal to 4, 840 square yards.
13348#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13349pub enum UnitOfMeasure1Code {
13350    #[default]
13351    #[serde(rename = "PIEC")]
13352    CodePIEC,
13353    #[serde(rename = "TONS")]
13354    CodeTONS,
13355    #[serde(rename = "FOOT")]
13356    CodeFOOT,
13357    #[serde(rename = "GBGA")]
13358    CodeGBGA,
13359    #[serde(rename = "USGA")]
13360    CodeUSGA,
13361    #[serde(rename = "GRAM")]
13362    CodeGRAM,
13363    #[serde(rename = "INCH")]
13364    CodeINCH,
13365    #[serde(rename = "KILO")]
13366    CodeKILO,
13367    #[serde(rename = "PUND")]
13368    CodePUND,
13369    #[serde(rename = "METR")]
13370    CodeMETR,
13371    #[serde(rename = "CMET")]
13372    CodeCMET,
13373    #[serde(rename = "MMET")]
13374    CodeMMET,
13375    #[serde(rename = "LITR")]
13376    CodeLITR,
13377    #[serde(rename = "CELI")]
13378    CodeCELI,
13379    #[serde(rename = "MILI")]
13380    CodeMILI,
13381    #[serde(rename = "GBOU")]
13382    CodeGBOU,
13383    #[serde(rename = "USOU")]
13384    CodeUSOU,
13385    #[serde(rename = "GBQA")]
13386    CodeGBQA,
13387    #[serde(rename = "USQA")]
13388    CodeUSQA,
13389    #[serde(rename = "GBPI")]
13390    CodeGBPI,
13391    #[serde(rename = "USPI")]
13392    CodeUSPI,
13393    #[serde(rename = "MILE")]
13394    CodeMILE,
13395    #[serde(rename = "KMET")]
13396    CodeKMET,
13397    #[serde(rename = "YARD")]
13398    CodeYARD,
13399    #[serde(rename = "SQKI")]
13400    CodeSQKI,
13401    #[serde(rename = "HECT")]
13402    CodeHECT,
13403    #[serde(rename = "ARES")]
13404    CodeARES,
13405    #[serde(rename = "SMET")]
13406    CodeSMET,
13407    #[serde(rename = "SCMT")]
13408    CodeSCMT,
13409    #[serde(rename = "SMIL")]
13410    CodeSMIL,
13411    #[serde(rename = "SQMI")]
13412    CodeSQMI,
13413    #[serde(rename = "SQYA")]
13414    CodeSQYA,
13415    #[serde(rename = "SQFO")]
13416    CodeSQFO,
13417    #[serde(rename = "SQIN")]
13418    CodeSQIN,
13419    #[serde(rename = "ACRE")]
13420    CodeACRE,
13421}
13422
13423impl Validate for UnitOfMeasure1Code {
13424    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
13425        // Enum validation is typically empty
13426    }
13427}
13428
13429// UserInterface2Code: Cardholder display or interface.
13430#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13431pub enum UserInterface2Code {
13432    #[default]
13433    #[serde(rename = "MDSP")]
13434    CodeMDSP,
13435    #[serde(rename = "CDSP")]
13436    CodeCDSP,
13437}
13438
13439impl Validate for UserInterface2Code {
13440    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
13441        // Enum validation is typically empty
13442    }
13443}
13444
13445// YieldedOrValueType1Choice: Type of value in which the price is expressed.
13446#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13447pub struct YieldedOrValueType1Choice {
13448    #[serde(rename = "Yldd", skip_serializing_if = "Option::is_none")]
13449    pub yldd: Option<bool>,
13450    #[serde(rename = "ValTp", skip_serializing_if = "Option::is_none")]
13451    pub val_tp: Option<PriceValueType1Code>,
13452}
13453
13454impl Validate for YieldedOrValueType1Choice {
13455    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
13456        if let Some(ref val) = self.val_tp
13457            && config.validate_optional_fields
13458        {
13459            val.validate(&helpers::child_path(path, "ValTp"), config, collector);
13460        }
13461    }
13462}