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<Box<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
1409// Usage: The sequential number is increased incrementally for each transaction.
1410#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1411pub struct CardIndividualTransaction21 {
1412    #[serde(rename = "ICCRltdData", skip_serializing_if = "Option::is_none")]
1413    pub icc_rltd_data: Option<String>,
1414    #[serde(rename = "PmtCntxt", skip_serializing_if = "Option::is_none")]
1415    pub pmt_cntxt: Option<PaymentContext3>,
1416    #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1417    pub addtl_svc: Option<CardPaymentServiceType2Code>,
1418    #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1419    pub tx_ctgy: Option<String>,
1420    #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1421    pub sale_rcncltn_id: Option<String>,
1422    #[serde(rename = "SaleRefNb", skip_serializing_if = "Option::is_none")]
1423    pub sale_ref_nb: Option<String>,
1424    #[serde(rename = "RePresntmntRsn", skip_serializing_if = "Option::is_none")]
1425    pub re_presntmnt_rsn: Option<String>,
1426    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
1427    pub seq_nb: Option<String>,
1428    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
1429    pub tx_id: Option<TransactionIdentifier11>,
1430    #[serde(rename = "Pdct", skip_serializing_if = "Option::is_none")]
1431    pub pdct: Option<Product21>,
1432    #[serde(rename = "VldtnDt", skip_serializing_if = "Option::is_none")]
1433    pub vldtn_dt: Option<String>,
1434    #[serde(rename = "VldtnSeqNb", skip_serializing_if = "Option::is_none")]
1435    pub vldtn_seq_nb: Option<String>,
1436}
1437
1438impl Validate for CardIndividualTransaction21 {
1439    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1440        if let Some(ref val) = self.icc_rltd_data {
1441            helpers::validate_length(
1442                val,
1443                "ICCRltdData",
1444                Some(1),
1445                Some(1025),
1446                &helpers::child_path(path, "ICCRltdData"),
1447                config,
1448                collector,
1449            );
1450        }
1451        if let Some(ref val) = self.icc_rltd_data {
1452            helpers::validate_pattern(
1453                val,
1454                "ICCRltdData",
1455                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1456                &helpers::child_path(path, "ICCRltdData"),
1457                config,
1458                collector,
1459            );
1460        }
1461        if let Some(ref val) = self.pmt_cntxt
1462            && config.validate_optional_fields
1463        {
1464            val.validate(&helpers::child_path(path, "PmtCntxt"), config, collector);
1465        }
1466        if let Some(ref val) = self.addtl_svc
1467            && config.validate_optional_fields
1468        {
1469            val.validate(&helpers::child_path(path, "AddtlSvc"), config, collector);
1470        }
1471        if let Some(ref val) = self.tx_ctgy {
1472            helpers::validate_length(
1473                val,
1474                "TxCtgy",
1475                Some(1),
1476                Some(4),
1477                &helpers::child_path(path, "TxCtgy"),
1478                config,
1479                collector,
1480            );
1481        }
1482        if let Some(ref val) = self.sale_rcncltn_id {
1483            helpers::validate_length(
1484                val,
1485                "SaleRcncltnId",
1486                Some(1),
1487                Some(35),
1488                &helpers::child_path(path, "SaleRcncltnId"),
1489                config,
1490                collector,
1491            );
1492        }
1493        if let Some(ref val) = self.sale_rcncltn_id {
1494            helpers::validate_pattern(
1495                val,
1496                "SaleRcncltnId",
1497                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1498                &helpers::child_path(path, "SaleRcncltnId"),
1499                config,
1500                collector,
1501            );
1502        }
1503        if let Some(ref val) = self.sale_ref_nb {
1504            helpers::validate_length(
1505                val,
1506                "SaleRefNb",
1507                Some(1),
1508                Some(35),
1509                &helpers::child_path(path, "SaleRefNb"),
1510                config,
1511                collector,
1512            );
1513        }
1514        if let Some(ref val) = self.sale_ref_nb {
1515            helpers::validate_pattern(
1516                val,
1517                "SaleRefNb",
1518                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1519                &helpers::child_path(path, "SaleRefNb"),
1520                config,
1521                collector,
1522            );
1523        }
1524        if let Some(ref val) = self.re_presntmnt_rsn {
1525            helpers::validate_length(
1526                val,
1527                "RePresntmntRsn",
1528                Some(1),
1529                Some(4),
1530                &helpers::child_path(path, "RePresntmntRsn"),
1531                config,
1532                collector,
1533            );
1534        }
1535        if let Some(ref val) = self.seq_nb {
1536            helpers::validate_length(
1537                val,
1538                "SeqNb",
1539                Some(1),
1540                Some(35),
1541                &helpers::child_path(path, "SeqNb"),
1542                config,
1543                collector,
1544            );
1545        }
1546        if let Some(ref val) = self.seq_nb {
1547            helpers::validate_pattern(
1548                val,
1549                "SeqNb",
1550                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1551                &helpers::child_path(path, "SeqNb"),
1552                config,
1553                collector,
1554            );
1555        }
1556        if let Some(ref val) = self.tx_id
1557            && config.validate_optional_fields
1558        {
1559            val.validate(&helpers::child_path(path, "TxId"), config, collector);
1560        }
1561        if let Some(ref val) = self.pdct
1562            && config.validate_optional_fields
1563        {
1564            val.validate(&helpers::child_path(path, "Pdct"), config, collector);
1565        }
1566        if let Some(ref val) = self.vldtn_seq_nb {
1567            helpers::validate_length(
1568                val,
1569                "VldtnSeqNb",
1570                Some(1),
1571                Some(35),
1572                &helpers::child_path(path, "VldtnSeqNb"),
1573                config,
1574                collector,
1575            );
1576        }
1577        if let Some(ref val) = self.vldtn_seq_nb {
1578            helpers::validate_pattern(
1579                val,
1580                "VldtnSeqNb",
1581                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1582                &helpers::child_path(path, "VldtnSeqNb"),
1583                config,
1584                collector,
1585            );
1586        }
1587    }
1588}
1589
1590// CardPaymentServiceType2Code: Voice authorisation.
1591#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1592pub enum CardPaymentServiceType2Code {
1593    #[default]
1594    #[serde(rename = "AGGR")]
1595    CodeAGGR,
1596    #[serde(rename = "DCCV")]
1597    CodeDCCV,
1598    #[serde(rename = "GRTT")]
1599    CodeGRTT,
1600    #[serde(rename = "INSP")]
1601    CodeINSP,
1602    #[serde(rename = "LOYT")]
1603    CodeLOYT,
1604    #[serde(rename = "NRES")]
1605    CodeNRES,
1606    #[serde(rename = "PUCO")]
1607    CodePUCO,
1608    #[serde(rename = "RECP")]
1609    CodeRECP,
1610    #[serde(rename = "SOAF")]
1611    CodeSOAF,
1612    #[serde(rename = "UNAF")]
1613    CodeUNAF,
1614    #[serde(rename = "VCAU")]
1615    CodeVCAU,
1616}
1617
1618impl Validate for CardPaymentServiceType2Code {
1619    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1620        // Enum validation is typically empty
1621    }
1622}
1623
1624// CardSecurityInformation1: Card security code (CSC).
1625#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1626pub struct CardSecurityInformation1 {
1627    #[serde(rename = "CSCMgmt")]
1628    pub csc_mgmt: CSCManagement1Code,
1629    #[serde(rename = "CSCVal", skip_serializing_if = "Option::is_none")]
1630    pub csc_val: Option<String>,
1631}
1632
1633impl Validate for CardSecurityInformation1 {
1634    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1635        self.csc_mgmt
1636            .validate(&helpers::child_path(path, "CSCMgmt"), config, collector);
1637        if let Some(ref val) = self.csc_val {
1638            helpers::validate_pattern(
1639                val,
1640                "CSCVal",
1641                "[0-9]{3,4}",
1642                &helpers::child_path(path, "CSCVal"),
1643                config,
1644                collector,
1645            );
1646        }
1647    }
1648}
1649
1650// CardSequenceNumberRange11: CardSequenceNumberRange1: LastTransactionSequenceNumberMessage element to be finalised once feedback from Card SEG has been received.
1651#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1652pub struct CardSequenceNumberRange11 {
1653    #[serde(rename = "FrstTx", skip_serializing_if = "Option::is_none")]
1654    pub frst_tx: Option<String>,
1655    #[serde(rename = "LastTx", skip_serializing_if = "Option::is_none")]
1656    pub last_tx: Option<String>,
1657}
1658
1659impl Validate for CardSequenceNumberRange11 {
1660    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1661        if let Some(ref val) = self.frst_tx {
1662            helpers::validate_length(
1663                val,
1664                "FrstTx",
1665                Some(1),
1666                Some(35),
1667                &helpers::child_path(path, "FrstTx"),
1668                config,
1669                collector,
1670            );
1671        }
1672        if let Some(ref val) = self.frst_tx {
1673            helpers::validate_pattern(
1674                val,
1675                "FrstTx",
1676                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1677                &helpers::child_path(path, "FrstTx"),
1678                config,
1679                collector,
1680            );
1681        }
1682        if let Some(ref val) = self.last_tx {
1683            helpers::validate_length(
1684                val,
1685                "LastTx",
1686                Some(1),
1687                Some(35),
1688                &helpers::child_path(path, "LastTx"),
1689                config,
1690                collector,
1691            );
1692        }
1693        if let Some(ref val) = self.last_tx {
1694            helpers::validate_pattern(
1695                val,
1696                "LastTx",
1697                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1698                &helpers::child_path(path, "LastTx"),
1699                config,
1700                collector,
1701            );
1702        }
1703    }
1704}
1705
1706// CardTransaction171: Prepaid account for the transfer or loading of an amount of money.
1707#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1708pub struct CardTransaction171 {
1709    #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1710    pub card: Option<PaymentCard41>,
1711    #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1712    pub poi: Option<PointOfInteraction11>,
1713    #[serde(rename = "Tx", skip_serializing_if = "Option::is_none")]
1714    pub tx: Option<CardTransaction3Choice1>,
1715    #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1716    pub pre_pd_acct: Option<CashAccount384>,
1717}
1718
1719impl Validate for CardTransaction171 {
1720    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1721        if let Some(ref val) = self.card
1722            && config.validate_optional_fields
1723        {
1724            val.validate(&helpers::child_path(path, "Card"), config, collector);
1725        }
1726        if let Some(ref val) = self.poi
1727            && config.validate_optional_fields
1728        {
1729            val.validate(&helpers::child_path(path, "POI"), config, collector);
1730        }
1731        if let Some(ref val) = self.tx
1732            && config.validate_optional_fields
1733        {
1734            val.validate(&helpers::child_path(path, "Tx"), config, collector);
1735        }
1736        if let Some(ref val) = self.pre_pd_acct
1737            && config.validate_optional_fields
1738        {
1739            val.validate(&helpers::child_path(path, "PrePdAcct"), config, collector);
1740        }
1741    }
1742}
1743
1744// CardTransaction3Choice1: Card transaction details for the individual transaction, as recorded at the POI (point of interaction).
1745#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1746pub struct CardTransaction3Choice1 {
1747    #[serde(rename = "Aggtd", skip_serializing_if = "Option::is_none")]
1748    pub aggtd: Option<CardAggregated21>,
1749    #[serde(rename = "Indv", skip_serializing_if = "Option::is_none")]
1750    pub indv: Option<CardIndividualTransaction21>,
1751}
1752
1753impl Validate for CardTransaction3Choice1 {
1754    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1755        if let Some(ref val) = self.aggtd
1756            && config.validate_optional_fields
1757        {
1758            val.validate(&helpers::child_path(path, "Aggtd"), config, collector);
1759        }
1760        if let Some(ref val) = self.indv
1761            && config.validate_optional_fields
1762        {
1763            val.validate(&helpers::child_path(path, "Indv"), config, collector);
1764        }
1765    }
1766}
1767
1768// CardholderAuthentication2: Entity or object in charge of verifying the cardholder authenticity.
1769#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1770pub struct CardholderAuthentication2 {
1771    #[serde(rename = "AuthntcnMtd")]
1772    pub authntcn_mtd: AuthenticationMethod1Code,
1773    #[serde(rename = "AuthntcnNtty")]
1774    pub authntcn_ntty: AuthenticationEntity1Code,
1775}
1776
1777impl Validate for CardholderAuthentication2 {
1778    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1779        self.authntcn_mtd
1780            .validate(&helpers::child_path(path, "AuthntcnMtd"), config, collector);
1781        self.authntcn_ntty.validate(
1782            &helpers::child_path(path, "AuthntcnNtty"),
1783            config,
1784            collector,
1785        );
1786    }
1787}
1788
1789// CardholderVerificationCapability1Code: Three domain secure (three domain secure authentication of the cardholder).
1790#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1791pub enum CardholderVerificationCapability1Code {
1792    #[default]
1793    #[serde(rename = "MNSG")]
1794    CodeMNSG,
1795    #[serde(rename = "NPIN")]
1796    CodeNPIN,
1797    #[serde(rename = "FCPN")]
1798    CodeFCPN,
1799    #[serde(rename = "FEPN")]
1800    CodeFEPN,
1801    #[serde(rename = "FDSG")]
1802    CodeFDSG,
1803    #[serde(rename = "FBIO")]
1804    CodeFBIO,
1805    #[serde(rename = "MNVR")]
1806    CodeMNVR,
1807    #[serde(rename = "FBIG")]
1808    CodeFBIG,
1809    #[serde(rename = "APKI")]
1810    CodeAPKI,
1811    #[serde(rename = "PKIS")]
1812    CodePKIS,
1813    #[serde(rename = "CHDT")]
1814    CodeCHDT,
1815    #[serde(rename = "SCEC")]
1816    CodeSCEC,
1817}
1818
1819impl Validate for CardholderVerificationCapability1Code {
1820    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1821        // Enum validation is typically empty
1822    }
1823}
1824
1825// CashAccount381: Specifies an alternate assumed name for the identification of the account.
1826#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1827pub struct CashAccount381 {
1828    #[serde(rename = "Id")]
1829    pub id: AccountIdentification4Choice1,
1830    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1831    pub tp: Option<CashAccountType2Choice1>,
1832    #[serde(rename = "Ccy")]
1833    pub ccy: String,
1834    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1835    pub nm: Option<String>,
1836    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1837    pub prxy: Option<ProxyAccountIdentification11>,
1838}
1839
1840impl Validate for CashAccount381 {
1841    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1842        self.id
1843            .validate(&helpers::child_path(path, "Id"), config, collector);
1844        if let Some(ref val) = self.tp
1845            && config.validate_optional_fields
1846        {
1847            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1848        }
1849        helpers::validate_pattern(
1850            &self.ccy,
1851            "Ccy",
1852            "[A-Z]{3,3}",
1853            &helpers::child_path(path, "Ccy"),
1854            config,
1855            collector,
1856        );
1857        if let Some(ref val) = self.nm {
1858            helpers::validate_length(
1859                val,
1860                "Nm",
1861                Some(1),
1862                Some(70),
1863                &helpers::child_path(path, "Nm"),
1864                config,
1865                collector,
1866            );
1867        }
1868        if let Some(ref val) = self.nm {
1869            helpers::validate_pattern(
1870                val,
1871                "Nm",
1872                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1873                &helpers::child_path(path, "Nm"),
1874                config,
1875                collector,
1876            );
1877        }
1878        if let Some(ref val) = self.prxy
1879            && config.validate_optional_fields
1880        {
1881            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
1882        }
1883    }
1884}
1885
1886// CashAccount382: Specifies an alternate assumed name for the identification of the account.
1887#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1888pub struct CashAccount382 {
1889    #[serde(rename = "Id")]
1890    pub id: AccountIdentification4Choice1,
1891    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1892    pub tp: Option<CashAccountType2Choice1>,
1893    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1894    pub ccy: Option<String>,
1895    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1896    pub nm: Option<String>,
1897    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1898    pub prxy: Option<ProxyAccountIdentification12>,
1899}
1900
1901impl Validate for CashAccount382 {
1902    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1903        self.id
1904            .validate(&helpers::child_path(path, "Id"), config, collector);
1905        if let Some(ref val) = self.tp
1906            && config.validate_optional_fields
1907        {
1908            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1909        }
1910        if let Some(ref val) = self.ccy {
1911            helpers::validate_pattern(
1912                val,
1913                "Ccy",
1914                "[A-Z]{3,3}",
1915                &helpers::child_path(path, "Ccy"),
1916                config,
1917                collector,
1918            );
1919        }
1920        if let Some(ref val) = self.nm {
1921            helpers::validate_length(
1922                val,
1923                "Nm",
1924                Some(1),
1925                Some(70),
1926                &helpers::child_path(path, "Nm"),
1927                config,
1928                collector,
1929            );
1930        }
1931        if let Some(ref val) = self.nm {
1932            helpers::validate_pattern(
1933                val,
1934                "Nm",
1935                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1936                &helpers::child_path(path, "Nm"),
1937                config,
1938                collector,
1939            );
1940        }
1941        if let Some(ref val) = self.prxy
1942            && config.validate_optional_fields
1943        {
1944            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
1945        }
1946    }
1947}
1948
1949// CashAccount383: Specifies an alternate assumed name for the identification of the account.
1950#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1951pub struct CashAccount383 {
1952    #[serde(rename = "Id")]
1953    pub id: AccountIdentification4Choice1,
1954    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1955    pub tp: Option<CashAccountType2Choice1>,
1956    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1957    pub ccy: Option<String>,
1958    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1959    pub nm: Option<String>,
1960    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1961    pub prxy: Option<ProxyAccountIdentification13>,
1962}
1963
1964impl Validate for CashAccount383 {
1965    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1966        self.id
1967            .validate(&helpers::child_path(path, "Id"), config, collector);
1968        if let Some(ref val) = self.tp
1969            && config.validate_optional_fields
1970        {
1971            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1972        }
1973        if let Some(ref val) = self.ccy {
1974            helpers::validate_pattern(
1975                val,
1976                "Ccy",
1977                "[A-Z]{3,3}",
1978                &helpers::child_path(path, "Ccy"),
1979                config,
1980                collector,
1981            );
1982        }
1983        if let Some(ref val) = self.nm {
1984            helpers::validate_length(
1985                val,
1986                "Nm",
1987                Some(1),
1988                Some(70),
1989                &helpers::child_path(path, "Nm"),
1990                config,
1991                collector,
1992            );
1993        }
1994        if let Some(ref val) = self.nm {
1995            helpers::validate_pattern(
1996                val,
1997                "Nm",
1998                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1999                &helpers::child_path(path, "Nm"),
2000                config,
2001                collector,
2002            );
2003        }
2004        if let Some(ref val) = self.prxy
2005            && config.validate_optional_fields
2006        {
2007            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2008        }
2009    }
2010}
2011
2012// CashAccount384: Specifies an alternate assumed name for the identification of the account.
2013#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2014pub struct CashAccount384 {
2015    #[serde(rename = "Id")]
2016    pub id: AccountIdentification4Choice1,
2017    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2018    pub tp: Option<CashAccountType2Choice1>,
2019    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
2020    pub ccy: Option<String>,
2021    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2022    pub nm: Option<String>,
2023    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
2024    pub prxy: Option<ProxyAccountIdentification11>,
2025}
2026
2027impl Validate for CashAccount384 {
2028    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2029        self.id
2030            .validate(&helpers::child_path(path, "Id"), config, collector);
2031        if let Some(ref val) = self.tp
2032            && config.validate_optional_fields
2033        {
2034            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2035        }
2036        if let Some(ref val) = self.ccy {
2037            helpers::validate_pattern(
2038                val,
2039                "Ccy",
2040                "[A-Z]{3,3}",
2041                &helpers::child_path(path, "Ccy"),
2042                config,
2043                collector,
2044            );
2045        }
2046        if let Some(ref val) = self.nm {
2047            helpers::validate_length(
2048                val,
2049                "Nm",
2050                Some(1),
2051                Some(70),
2052                &helpers::child_path(path, "Nm"),
2053                config,
2054                collector,
2055            );
2056        }
2057        if let Some(ref val) = self.nm {
2058            helpers::validate_pattern(
2059                val,
2060                "Nm",
2061                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2062                &helpers::child_path(path, "Nm"),
2063                config,
2064                collector,
2065            );
2066        }
2067        if let Some(ref val) = self.prxy
2068            && config.validate_optional_fields
2069        {
2070            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2071        }
2072    }
2073}
2074
2075// 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.
2076#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2077pub struct CashAccount391 {
2078    #[serde(rename = "Id")]
2079    pub id: AccountIdentification4Choice1,
2080    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2081    pub tp: Option<CashAccountType2Choice1>,
2082    #[serde(rename = "Ccy")]
2083    pub ccy: String,
2084    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2085    pub nm: Option<String>,
2086    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
2087    pub prxy: Option<ProxyAccountIdentification11>,
2088    #[serde(rename = "Ownr", skip_serializing_if = "Option::is_none")]
2089    pub ownr: Option<PartyIdentification1352>,
2090    #[serde(rename = "Svcr", skip_serializing_if = "Option::is_none")]
2091    pub svcr: Option<BranchAndFinancialInstitutionIdentification61>,
2092}
2093
2094impl Validate for CashAccount391 {
2095    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2096        self.id
2097            .validate(&helpers::child_path(path, "Id"), config, collector);
2098        if let Some(ref val) = self.tp
2099            && config.validate_optional_fields
2100        {
2101            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2102        }
2103        helpers::validate_pattern(
2104            &self.ccy,
2105            "Ccy",
2106            "[A-Z]{3,3}",
2107            &helpers::child_path(path, "Ccy"),
2108            config,
2109            collector,
2110        );
2111        if let Some(ref val) = self.nm {
2112            helpers::validate_length(
2113                val,
2114                "Nm",
2115                Some(1),
2116                Some(70),
2117                &helpers::child_path(path, "Nm"),
2118                config,
2119                collector,
2120            );
2121        }
2122        if let Some(ref val) = self.nm {
2123            helpers::validate_pattern(
2124                val,
2125                "Nm",
2126                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2127                &helpers::child_path(path, "Nm"),
2128                config,
2129                collector,
2130            );
2131        }
2132        if let Some(ref val) = self.prxy
2133            && config.validate_optional_fields
2134        {
2135            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
2136        }
2137        if let Some(ref val) = self.ownr
2138            && config.validate_optional_fields
2139        {
2140            val.validate(&helpers::child_path(path, "Ownr"), config, collector);
2141        }
2142        if let Some(ref val) = self.svcr
2143            && config.validate_optional_fields
2144        {
2145            val.validate(&helpers::child_path(path, "Svcr"), config, collector);
2146        }
2147    }
2148}
2149
2150// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
2151#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2152pub struct CashAccountType2Choice1 {
2153    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2154    pub cd: Option<String>,
2155    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2156    pub prtry: Option<String>,
2157}
2158
2159impl Validate for CashAccountType2Choice1 {
2160    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2161        if let Some(ref val) = self.cd {
2162            helpers::validate_length(
2163                val,
2164                "Cd",
2165                Some(1),
2166                Some(4),
2167                &helpers::child_path(path, "Cd"),
2168                config,
2169                collector,
2170            );
2171        }
2172        if let Some(ref val) = self.prtry {
2173            helpers::validate_length(
2174                val,
2175                "Prtry",
2176                Some(1),
2177                Some(35),
2178                &helpers::child_path(path, "Prtry"),
2179                config,
2180                collector,
2181            );
2182        }
2183        if let Some(ref val) = self.prtry {
2184            helpers::validate_pattern(
2185                val,
2186                "Prtry",
2187                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2188                &helpers::child_path(path, "Prtry"),
2189                config,
2190                collector,
2191            );
2192        }
2193    }
2194}
2195
2196// CashAvailability1: Indicates whether the availability balance is a credit or a debit balance.
2197// Usage: A zero balance is considered to be a credit balance.
2198#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2199pub struct CashAvailability1 {
2200    #[serde(rename = "Dt")]
2201    pub dt: CashAvailabilityDate1Choice,
2202    #[serde(rename = "Amt")]
2203    pub amt: ActiveOrHistoricCurrencyAndAmount,
2204    #[serde(rename = "CdtDbtInd")]
2205    pub cdt_dbt_ind: CreditDebitCode,
2206}
2207
2208impl Validate for CashAvailability1 {
2209    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2210        self.dt
2211            .validate(&helpers::child_path(path, "Dt"), config, collector);
2212        self.amt
2213            .validate(&helpers::child_path(path, "Amt"), config, collector);
2214        self.cdt_dbt_ind
2215            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2216    }
2217}
2218
2219// CashAvailabilityDate1Choice: Identifies the actual availability date.
2220#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2221pub struct CashAvailabilityDate1Choice {
2222    #[serde(rename = "NbOfDays", skip_serializing_if = "Option::is_none")]
2223    pub nb_of_days: Option<String>,
2224    #[serde(rename = "ActlDt", skip_serializing_if = "Option::is_none")]
2225    pub actl_dt: Option<String>,
2226}
2227
2228impl Validate for CashAvailabilityDate1Choice {
2229    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2230        if let Some(ref val) = self.nb_of_days {
2231            helpers::validate_pattern(
2232                val,
2233                "NbOfDays",
2234                "[\\+]{0,1}[0-9]{1,15}",
2235                &helpers::child_path(path, "NbOfDays"),
2236                config,
2237                collector,
2238            );
2239        }
2240    }
2241}
2242
2243// CashDeposit1: Specifies the total amount of money in the cash deposit, that is the note denomination times the number of notes.
2244#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2245pub struct CashDeposit1 {
2246    #[serde(rename = "NoteDnmtn")]
2247    pub note_dnmtn: ActiveCurrencyAndAmount,
2248    #[serde(rename = "NbOfNotes")]
2249    pub nb_of_notes: String,
2250    #[serde(rename = "Amt")]
2251    pub amt: ActiveCurrencyAndAmount,
2252}
2253
2254impl Validate for CashDeposit1 {
2255    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2256        self.note_dnmtn
2257            .validate(&helpers::child_path(path, "NoteDnmtn"), config, collector);
2258        helpers::validate_pattern(
2259            &self.nb_of_notes,
2260            "NbOfNotes",
2261            "[0-9]{1,15}",
2262            &helpers::child_path(path, "NbOfNotes"),
2263            config,
2264            collector,
2265        );
2266        self.amt
2267            .validate(&helpers::child_path(path, "Amt"), config, collector);
2268    }
2269}
2270
2271// ChargeBearerType1Code: Charges are to be applied following the rules agreed in the service level and/or scheme.
2272#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2273pub enum ChargeBearerType1Code {
2274    #[default]
2275    #[serde(rename = "DEBT")]
2276    CodeDEBT,
2277    #[serde(rename = "CRED")]
2278    CodeCRED,
2279    #[serde(rename = "SHAR")]
2280    CodeSHAR,
2281    #[serde(rename = "SLEV")]
2282    CodeSLEV,
2283}
2284
2285impl Validate for ChargeBearerType1Code {
2286    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2287        // Enum validation is typically empty
2288    }
2289}
2290
2291// ChargeType3Choice1: Type of charge in a proprietary form, as defined by the issuer.
2292#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2293pub struct ChargeType3Choice1 {
2294    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2295    pub cd: Option<String>,
2296    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2297    pub prtry: Option<GenericIdentification31>,
2298}
2299
2300impl Validate for ChargeType3Choice1 {
2301    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2302        if let Some(ref val) = self.cd {
2303            helpers::validate_length(
2304                val,
2305                "Cd",
2306                Some(1),
2307                Some(4),
2308                &helpers::child_path(path, "Cd"),
2309                config,
2310                collector,
2311            );
2312        }
2313        if let Some(ref val) = self.prtry
2314            && config.validate_optional_fields
2315        {
2316            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
2317        }
2318    }
2319}
2320
2321// Charges61: Provides details of the individual charges record.
2322#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2323pub struct Charges61 {
2324    #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2325    pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2326    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2327    pub rcrd: Option<Vec<ChargesRecord31>>,
2328}
2329
2330impl Validate for Charges61 {
2331    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2332        if let Some(ref val) = self.ttl_chrgs_and_tax_amt
2333            && config.validate_optional_fields
2334        {
2335            val.validate(
2336                &helpers::child_path(path, "TtlChrgsAndTaxAmt"),
2337                config,
2338                collector,
2339            );
2340        }
2341        if let Some(ref vec) = self.rcrd
2342            && config.validate_optional_fields
2343        {
2344            for item in vec {
2345                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
2346            }
2347        }
2348    }
2349}
2350
2351// Charges62: Provides details of the individual charges record.
2352#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2353pub struct Charges62 {
2354    #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2355    pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2356    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2357    pub rcrd: Option<Vec<ChargesRecord32>>,
2358}
2359
2360impl Validate for Charges62 {
2361    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2362        if let Some(ref val) = self.ttl_chrgs_and_tax_amt
2363            && config.validate_optional_fields
2364        {
2365            val.validate(
2366                &helpers::child_path(path, "TtlChrgsAndTaxAmt"),
2367                config,
2368                collector,
2369            );
2370        }
2371        if let Some(ref vec) = self.rcrd
2372            && config.validate_optional_fields
2373        {
2374            for item in vec {
2375                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
2376            }
2377        }
2378    }
2379}
2380
2381// ChargesRecord31: Provides details on the tax applied to charges.
2382#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2383pub struct ChargesRecord31 {
2384    #[serde(rename = "Amt")]
2385    pub amt: ActiveOrHistoricCurrencyAndAmount,
2386    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2387    pub cdt_dbt_ind: Option<CreditDebitCode>,
2388    #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2389    pub chrg_incl_ind: Option<bool>,
2390    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2391    pub tp: Option<ChargeType3Choice1>,
2392    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2393    pub rate: Option<f64>,
2394    #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2395    pub br: Option<ChargeBearerType1Code>,
2396    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2397    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
2398    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2399    pub tax: Option<TaxCharges21>,
2400}
2401
2402impl Validate for ChargesRecord31 {
2403    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2404        self.amt
2405            .validate(&helpers::child_path(path, "Amt"), config, collector);
2406        if let Some(ref val) = self.cdt_dbt_ind
2407            && config.validate_optional_fields
2408        {
2409            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2410        }
2411        if let Some(ref val) = self.tp
2412            && config.validate_optional_fields
2413        {
2414            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2415        }
2416        if let Some(ref val) = self.br
2417            && config.validate_optional_fields
2418        {
2419            val.validate(&helpers::child_path(path, "Br"), config, collector);
2420        }
2421        if let Some(ref val) = self.agt
2422            && config.validate_optional_fields
2423        {
2424            val.validate(&helpers::child_path(path, "Agt"), config, collector);
2425        }
2426        if let Some(ref val) = self.tax
2427            && config.validate_optional_fields
2428        {
2429            val.validate(&helpers::child_path(path, "Tax"), config, collector);
2430        }
2431    }
2432}
2433
2434// ChargesRecord32: Provides details on the tax applied to charges.
2435#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2436pub struct ChargesRecord32 {
2437    #[serde(rename = "Amt")]
2438    pub amt: ActiveOrHistoricCurrencyAndAmount,
2439    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2440    pub cdt_dbt_ind: Option<CreditDebitCode>,
2441    #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2442    pub chrg_incl_ind: Option<bool>,
2443    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2444    pub tp: Option<ChargeType3Choice1>,
2445    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2446    pub rate: Option<f64>,
2447    #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2448    pub br: Option<ChargeBearerType1Code>,
2449    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2450    pub agt: Option<BranchAndFinancialInstitutionIdentification63>,
2451    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2452    pub tax: Option<TaxCharges21>,
2453}
2454
2455impl Validate for ChargesRecord32 {
2456    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2457        self.amt
2458            .validate(&helpers::child_path(path, "Amt"), config, collector);
2459        if let Some(ref val) = self.cdt_dbt_ind
2460            && config.validate_optional_fields
2461        {
2462            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
2463        }
2464        if let Some(ref val) = self.tp
2465            && config.validate_optional_fields
2466        {
2467            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2468        }
2469        if let Some(ref val) = self.br
2470            && config.validate_optional_fields
2471        {
2472            val.validate(&helpers::child_path(path, "Br"), config, collector);
2473        }
2474        if let Some(ref val) = self.agt
2475            && config.validate_optional_fields
2476        {
2477            val.validate(&helpers::child_path(path, "Agt"), config, collector);
2478        }
2479        if let Some(ref val) = self.tax
2480            && config.validate_optional_fields
2481        {
2482            val.validate(&helpers::child_path(path, "Tax"), config, collector);
2483        }
2484    }
2485}
2486
2487// ClearingSystemIdentification2Choice: Identification code for a clearing system, that has not yet been identified in the list of clearing systems.
2488#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2489pub struct ClearingSystemIdentification2Choice {
2490    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2491    pub cd: Option<String>,
2492    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2493    pub prtry: Option<String>,
2494}
2495
2496impl Validate for ClearingSystemIdentification2Choice {
2497    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2498        if let Some(ref val) = self.cd {
2499            helpers::validate_length(
2500                val,
2501                "Cd",
2502                Some(1),
2503                Some(5),
2504                &helpers::child_path(path, "Cd"),
2505                config,
2506                collector,
2507            );
2508        }
2509        if let Some(ref val) = self.prtry {
2510            helpers::validate_length(
2511                val,
2512                "Prtry",
2513                Some(1),
2514                Some(35),
2515                &helpers::child_path(path, "Prtry"),
2516                config,
2517                collector,
2518            );
2519        }
2520    }
2521}
2522
2523// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
2524#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2525pub struct ClearingSystemIdentification2Choice1 {
2526    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2527    pub cd: Option<String>,
2528}
2529
2530impl Validate for ClearingSystemIdentification2Choice1 {
2531    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2532        if let Some(ref val) = self.cd {
2533            helpers::validate_length(
2534                val,
2535                "Cd",
2536                Some(1),
2537                Some(5),
2538                &helpers::child_path(path, "Cd"),
2539                config,
2540                collector,
2541            );
2542        }
2543    }
2544}
2545
2546// ClearingSystemIdentification2Choice2: Identification code for a clearing system, that has not yet been identified in the list of clearing systems.
2547#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2548pub struct ClearingSystemIdentification2Choice2 {
2549    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2550    pub cd: Option<String>,
2551    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2552    pub prtry: Option<String>,
2553}
2554
2555impl Validate for ClearingSystemIdentification2Choice2 {
2556    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2557        if let Some(ref val) = self.cd {
2558            helpers::validate_length(
2559                val,
2560                "Cd",
2561                Some(1),
2562                Some(5),
2563                &helpers::child_path(path, "Cd"),
2564                config,
2565                collector,
2566            );
2567        }
2568        if let Some(ref val) = self.prtry {
2569            helpers::validate_length(
2570                val,
2571                "Prtry",
2572                Some(1),
2573                Some(35),
2574                &helpers::child_path(path, "Prtry"),
2575                config,
2576                collector,
2577            );
2578        }
2579        if let Some(ref val) = self.prtry {
2580            helpers::validate_pattern(
2581                val,
2582                "Prtry",
2583                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2584                &helpers::child_path(path, "Prtry"),
2585                config,
2586                collector,
2587            );
2588        }
2589    }
2590}
2591
2592// ClearingSystemMemberIdentification2: Identification of a member of a clearing system.
2593#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2594pub struct ClearingSystemMemberIdentification2 {
2595    #[serde(rename = "ClrSysId", skip_serializing_if = "Option::is_none")]
2596    pub clr_sys_id: Option<ClearingSystemIdentification2Choice>,
2597    #[serde(rename = "MmbId")]
2598    pub mmb_id: String,
2599}
2600
2601impl Validate for ClearingSystemMemberIdentification2 {
2602    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2603        if let Some(ref val) = self.clr_sys_id
2604            && config.validate_optional_fields
2605        {
2606            val.validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2607        }
2608        helpers::validate_length(
2609            &self.mmb_id,
2610            "MmbId",
2611            Some(1),
2612            Some(35),
2613            &helpers::child_path(path, "MmbId"),
2614            config,
2615            collector,
2616        );
2617    }
2618}
2619
2620// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
2621#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2622pub struct ClearingSystemMemberIdentification21 {
2623    #[serde(rename = "ClrSysId")]
2624    pub clr_sys_id: ClearingSystemIdentification2Choice1,
2625    #[serde(rename = "MmbId")]
2626    pub mmb_id: String,
2627}
2628
2629impl Validate for ClearingSystemMemberIdentification21 {
2630    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2631        self.clr_sys_id
2632            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2633        helpers::validate_length(
2634            &self.mmb_id,
2635            "MmbId",
2636            Some(1),
2637            Some(28),
2638            &helpers::child_path(path, "MmbId"),
2639            config,
2640            collector,
2641        );
2642        helpers::validate_pattern(
2643            &self.mmb_id,
2644            "MmbId",
2645            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2646            &helpers::child_path(path, "MmbId"),
2647            config,
2648            collector,
2649        );
2650    }
2651}
2652
2653// ClearingSystemMemberIdentification22: Identification of a member of a clearing system.
2654#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2655pub struct ClearingSystemMemberIdentification22 {
2656    #[serde(rename = "ClrSysId")]
2657    pub clr_sys_id: ClearingSystemIdentification2Choice2,
2658    #[serde(rename = "MmbId")]
2659    pub mmb_id: String,
2660}
2661
2662impl Validate for ClearingSystemMemberIdentification22 {
2663    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2664        self.clr_sys_id
2665            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
2666        helpers::validate_length(
2667            &self.mmb_id,
2668            "MmbId",
2669            Some(1),
2670            Some(28),
2671            &helpers::child_path(path, "MmbId"),
2672            config,
2673            collector,
2674        );
2675        helpers::validate_pattern(
2676            &self.mmb_id,
2677            "MmbId",
2678            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2679            &helpers::child_path(path, "MmbId"),
2680            config,
2681            collector,
2682        );
2683    }
2684}
2685
2686// Contact41: Name by which a party is known and which is usually used to identify that party.
2687#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2688pub struct Contact41 {
2689    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2690    pub nm: Option<String>,
2691}
2692
2693impl Validate for Contact41 {
2694    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2695        if let Some(ref val) = self.nm {
2696            helpers::validate_length(
2697                val,
2698                "Nm",
2699                Some(1),
2700                Some(140),
2701                &helpers::child_path(path, "Nm"),
2702                config,
2703                collector,
2704            );
2705        }
2706        if let Some(ref val) = self.nm {
2707            helpers::validate_pattern(
2708                val,
2709                "Nm",
2710                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2711                &helpers::child_path(path, "Nm"),
2712                config,
2713                collector,
2714            );
2715        }
2716    }
2717}
2718
2719// Contact42: Preferred method used to reach the contact.
2720#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2721pub struct Contact42 {
2722    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2723    pub nm: Option<String>,
2724    #[serde(rename = "PrefrdMtd", skip_serializing_if = "Option::is_none")]
2725    pub prefrd_mtd: Option<PreferredContactMethod1Code>,
2726}
2727
2728impl Validate for Contact42 {
2729    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2730        if let Some(ref val) = self.nm {
2731            helpers::validate_length(
2732                val,
2733                "Nm",
2734                Some(1),
2735                Some(140),
2736                &helpers::child_path(path, "Nm"),
2737                config,
2738                collector,
2739            );
2740        }
2741        if let Some(ref val) = self.nm {
2742            helpers::validate_pattern(
2743                val,
2744                "Nm",
2745                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2746                &helpers::child_path(path, "Nm"),
2747                config,
2748                collector,
2749            );
2750        }
2751        if let Some(ref val) = self.prefrd_mtd
2752            && config.validate_optional_fields
2753        {
2754            val.validate(&helpers::child_path(path, "PrefrdMtd"), config, collector);
2755        }
2756    }
2757}
2758
2759// Contact43: Name by which a party is known and which is usually used to identify that party.
2760#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2761pub struct Contact43 {
2762    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2763    pub nm: Option<String>,
2764}
2765
2766impl Validate for Contact43 {
2767    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2768        if let Some(ref val) = self.nm {
2769            helpers::validate_length(
2770                val,
2771                "Nm",
2772                Some(1),
2773                Some(140),
2774                &helpers::child_path(path, "Nm"),
2775                config,
2776                collector,
2777            );
2778        }
2779    }
2780}
2781
2782// CopyDuplicate1Code: Message is for information/confirmation purposes. It is a duplicate of a message previously sent.
2783#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2784pub enum CopyDuplicate1Code {
2785    #[default]
2786    #[serde(rename = "CODU")]
2787    CodeCODU,
2788    #[serde(rename = "COPY")]
2789    CodeCOPY,
2790    #[serde(rename = "DUPL")]
2791    CodeDUPL,
2792}
2793
2794impl Validate for CopyDuplicate1Code {
2795    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2796        // Enum validation is typically empty
2797    }
2798}
2799
2800// CorporateAction91: Identification of a corporate action assigned by an official central body/entity within a given market.
2801#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2802pub struct CorporateAction91 {
2803    #[serde(rename = "EvtTp")]
2804    pub evt_tp: String,
2805    #[serde(rename = "EvtId")]
2806    pub evt_id: String,
2807}
2808
2809impl Validate for CorporateAction91 {
2810    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2811        helpers::validate_length(
2812            &self.evt_tp,
2813            "EvtTp",
2814            Some(1),
2815            Some(35),
2816            &helpers::child_path(path, "EvtTp"),
2817            config,
2818            collector,
2819        );
2820        helpers::validate_pattern(
2821            &self.evt_tp,
2822            "EvtTp",
2823            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2824            &helpers::child_path(path, "EvtTp"),
2825            config,
2826            collector,
2827        );
2828        helpers::validate_length(
2829            &self.evt_id,
2830            "EvtId",
2831            Some(1),
2832            Some(35),
2833            &helpers::child_path(path, "EvtId"),
2834            config,
2835            collector,
2836        );
2837        helpers::validate_pattern(
2838            &self.evt_id,
2839            "EvtId",
2840            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2841            &helpers::child_path(path, "EvtId"),
2842            config,
2843            collector,
2844        );
2845    }
2846}
2847
2848// CreditDebitCode: Operation is a decrease.
2849#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2850pub enum CreditDebitCode {
2851    #[default]
2852    #[serde(rename = "CRDT")]
2853    CodeCRDT,
2854    #[serde(rename = "DBIT")]
2855    CodeDBIT,
2856}
2857
2858impl Validate for CreditDebitCode {
2859    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2860        // Enum validation is typically empty
2861    }
2862}
2863
2864// CreditorReferenceInformation21: Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction.
2865//
2866// 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.
2867//
2868// 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.
2869#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2870pub struct CreditorReferenceInformation21 {
2871    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2872    pub tp: Option<CreditorReferenceType21>,
2873    #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
2874    pub ref_attr: Option<String>,
2875}
2876
2877impl Validate for CreditorReferenceInformation21 {
2878    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2879        if let Some(ref val) = self.tp
2880            && config.validate_optional_fields
2881        {
2882            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2883        }
2884        if let Some(ref val) = self.ref_attr {
2885            helpers::validate_length(
2886                val,
2887                "Ref",
2888                Some(1),
2889                Some(35),
2890                &helpers::child_path(path, "Ref"),
2891                config,
2892                collector,
2893            );
2894        }
2895        if let Some(ref val) = self.ref_attr {
2896            helpers::validate_pattern(
2897                val,
2898                "Ref",
2899                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2900                &helpers::child_path(path, "Ref"),
2901                config,
2902                collector,
2903            );
2904        }
2905    }
2906}
2907
2908// CreditorReferenceType1Choice1: Creditor reference type, in a proprietary form.
2909#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2910pub struct CreditorReferenceType1Choice1 {
2911    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2912    pub cd: Option<DocumentType3Code>,
2913    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2914    pub prtry: Option<String>,
2915}
2916
2917impl Validate for CreditorReferenceType1Choice1 {
2918    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2919        if let Some(ref val) = self.cd
2920            && config.validate_optional_fields
2921        {
2922            val.validate(&helpers::child_path(path, "Cd"), config, collector);
2923        }
2924        if let Some(ref val) = self.prtry {
2925            helpers::validate_length(
2926                val,
2927                "Prtry",
2928                Some(1),
2929                Some(35),
2930                &helpers::child_path(path, "Prtry"),
2931                config,
2932                collector,
2933            );
2934        }
2935        if let Some(ref val) = self.prtry {
2936            helpers::validate_pattern(
2937                val,
2938                "Prtry",
2939                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2940                &helpers::child_path(path, "Prtry"),
2941                config,
2942                collector,
2943            );
2944        }
2945    }
2946}
2947
2948// CreditorReferenceType21: Entity that assigns the credit reference type.
2949#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2950pub struct CreditorReferenceType21 {
2951    #[serde(rename = "CdOrPrtry")]
2952    pub cd_or_prtry: CreditorReferenceType1Choice1,
2953    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2954    pub issr: Option<String>,
2955}
2956
2957impl Validate for CreditorReferenceType21 {
2958    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2959        self.cd_or_prtry
2960            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
2961        if let Some(ref val) = self.issr {
2962            helpers::validate_length(
2963                val,
2964                "Issr",
2965                Some(1),
2966                Some(35),
2967                &helpers::child_path(path, "Issr"),
2968                config,
2969                collector,
2970            );
2971        }
2972        if let Some(ref val) = self.issr {
2973            helpers::validate_pattern(
2974                val,
2975                "Issr",
2976                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2977                &helpers::child_path(path, "Issr"),
2978                config,
2979                collector,
2980            );
2981        }
2982    }
2983}
2984
2985// CurrencyExchange51: Date and time at which an exchange rate is quoted.
2986#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2987pub struct CurrencyExchange51 {
2988    #[serde(rename = "SrcCcy")]
2989    pub src_ccy: String,
2990    #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2991    pub trgt_ccy: Option<String>,
2992    #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2993    pub unit_ccy: Option<String>,
2994    #[serde(rename = "XchgRate")]
2995    pub xchg_rate: f64,
2996    #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2997    pub ctrct_id: Option<String>,
2998    #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2999    pub qtn_dt: Option<String>,
3000}
3001
3002impl Validate for CurrencyExchange51 {
3003    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3004        helpers::validate_pattern(
3005            &self.src_ccy,
3006            "SrcCcy",
3007            "[A-Z]{3,3}",
3008            &helpers::child_path(path, "SrcCcy"),
3009            config,
3010            collector,
3011        );
3012        if let Some(ref val) = self.trgt_ccy {
3013            helpers::validate_pattern(
3014                val,
3015                "TrgtCcy",
3016                "[A-Z]{3,3}",
3017                &helpers::child_path(path, "TrgtCcy"),
3018                config,
3019                collector,
3020            );
3021        }
3022        if let Some(ref val) = self.unit_ccy {
3023            helpers::validate_pattern(
3024                val,
3025                "UnitCcy",
3026                "[A-Z]{3,3}",
3027                &helpers::child_path(path, "UnitCcy"),
3028                config,
3029                collector,
3030            );
3031        }
3032        if let Some(ref val) = self.ctrct_id {
3033            helpers::validate_length(
3034                val,
3035                "CtrctId",
3036                Some(1),
3037                Some(35),
3038                &helpers::child_path(path, "CtrctId"),
3039                config,
3040                collector,
3041            );
3042        }
3043        if let Some(ref val) = self.ctrct_id {
3044            helpers::validate_pattern(
3045                val,
3046                "CtrctId",
3047                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3048                &helpers::child_path(path, "CtrctId"),
3049                config,
3050                collector,
3051            );
3052        }
3053        if let Some(ref val) = self.qtn_dt {
3054            helpers::validate_pattern(
3055                val,
3056                "QtnDt",
3057                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3058                &helpers::child_path(path, "QtnDt"),
3059                config,
3060                collector,
3061            );
3062        }
3063    }
3064}
3065
3066// DateAndDateTime2Choice1: Specified date and time.
3067#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3068pub struct DateAndDateTime2Choice1 {
3069    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3070    pub dt: Option<String>,
3071    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3072    pub dt_tm: Option<String>,
3073}
3074
3075impl Validate for DateAndDateTime2Choice1 {
3076    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3077        if let Some(ref val) = self.dt_tm {
3078            helpers::validate_pattern(
3079                val,
3080                "DtTm",
3081                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3082                &helpers::child_path(path, "DtTm"),
3083                config,
3084                collector,
3085            );
3086        }
3087    }
3088}
3089
3090// DateAndDateTime2Choice2: Specified date and time.
3091#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3092pub struct DateAndDateTime2Choice2 {
3093    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3094    pub dt_tm: Option<String>,
3095}
3096
3097impl Validate for DateAndDateTime2Choice2 {
3098    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3099        if let Some(ref val) = self.dt_tm {
3100            helpers::validate_pattern(
3101                val,
3102                "DtTm",
3103                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3104                &helpers::child_path(path, "DtTm"),
3105                config,
3106                collector,
3107            );
3108        }
3109    }
3110}
3111
3112// DateAndPlaceOfBirth11: Country where a person was born.
3113#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3114pub struct DateAndPlaceOfBirth11 {
3115    #[serde(rename = "BirthDt")]
3116    pub birth_dt: String,
3117    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
3118    pub prvc_of_birth: Option<String>,
3119    #[serde(rename = "CityOfBirth")]
3120    pub city_of_birth: String,
3121    #[serde(rename = "CtryOfBirth")]
3122    pub ctry_of_birth: String,
3123}
3124
3125impl Validate for DateAndPlaceOfBirth11 {
3126    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3127        if let Some(ref val) = self.prvc_of_birth {
3128            helpers::validate_length(
3129                val,
3130                "PrvcOfBirth",
3131                Some(1),
3132                Some(35),
3133                &helpers::child_path(path, "PrvcOfBirth"),
3134                config,
3135                collector,
3136            );
3137        }
3138        if let Some(ref val) = self.prvc_of_birth {
3139            helpers::validate_pattern(
3140                val,
3141                "PrvcOfBirth",
3142                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3143                &helpers::child_path(path, "PrvcOfBirth"),
3144                config,
3145                collector,
3146            );
3147        }
3148        helpers::validate_length(
3149            &self.city_of_birth,
3150            "CityOfBirth",
3151            Some(1),
3152            Some(35),
3153            &helpers::child_path(path, "CityOfBirth"),
3154            config,
3155            collector,
3156        );
3157        helpers::validate_pattern(
3158            &self.city_of_birth,
3159            "CityOfBirth",
3160            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3161            &helpers::child_path(path, "CityOfBirth"),
3162            config,
3163            collector,
3164        );
3165        helpers::validate_pattern(
3166            &self.ctry_of_birth,
3167            "CtryOfBirth",
3168            "[A-Z]{2,2}",
3169            &helpers::child_path(path, "CtryOfBirth"),
3170            config,
3171            collector,
3172        );
3173    }
3174}
3175
3176// DateOrDateTimePeriod1Choice1: Period expressed a dates and times.
3177#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3178pub struct DateOrDateTimePeriod1Choice1 {
3179    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3180    pub dt: Option<DatePeriod2>,
3181    #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3182    pub dt_tm: Option<DateTimePeriod11>,
3183}
3184
3185impl Validate for DateOrDateTimePeriod1Choice1 {
3186    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3187        if let Some(ref val) = self.dt
3188            && config.validate_optional_fields
3189        {
3190            val.validate(&helpers::child_path(path, "Dt"), config, collector);
3191        }
3192        if let Some(ref val) = self.dt_tm
3193            && config.validate_optional_fields
3194        {
3195            val.validate(&helpers::child_path(path, "DtTm"), config, collector);
3196        }
3197    }
3198}
3199
3200// DatePeriod2: End date of the range.
3201#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3202pub struct DatePeriod2 {
3203    #[serde(rename = "FrDt")]
3204    pub fr_dt: String,
3205    #[serde(rename = "ToDt")]
3206    pub to_dt: String,
3207}
3208
3209impl Validate for DatePeriod2 {
3210    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
3211}
3212
3213// DateTimePeriod11: Date and time at which the period ends.
3214#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3215pub struct DateTimePeriod11 {
3216    #[serde(rename = "FrDtTm")]
3217    pub fr_dt_tm: String,
3218    #[serde(rename = "ToDtTm")]
3219    pub to_dt_tm: String,
3220}
3221
3222impl Validate for DateTimePeriod11 {
3223    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3224        helpers::validate_pattern(
3225            &self.fr_dt_tm,
3226            "FrDtTm",
3227            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3228            &helpers::child_path(path, "FrDtTm"),
3229            config,
3230            collector,
3231        );
3232        helpers::validate_pattern(
3233            &self.to_dt_tm,
3234            "ToDtTm",
3235            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3236            &helpers::child_path(path, "ToDtTm"),
3237            config,
3238            collector,
3239        );
3240    }
3241}
3242
3243// DiscountAmountAndType11: Amount of money, which has been typed.
3244#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3245pub struct DiscountAmountAndType11 {
3246    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3247    pub tp: Option<DiscountAmountType1Choice1>,
3248    #[serde(rename = "Amt")]
3249    pub amt: ActiveOrHistoricCurrencyAndAmount,
3250}
3251
3252impl Validate for DiscountAmountAndType11 {
3253    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3254        if let Some(ref val) = self.tp
3255            && config.validate_optional_fields
3256        {
3257            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3258        }
3259        self.amt
3260            .validate(&helpers::child_path(path, "Amt"), config, collector);
3261    }
3262}
3263
3264// DiscountAmountAndType12: Amount of money, which has been typed.
3265#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3266pub struct DiscountAmountAndType12 {
3267    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3268    pub tp: Option<DiscountAmountType1Choice2>,
3269    #[serde(rename = "Amt")]
3270    pub amt: ActiveOrHistoricCurrencyAndAmount,
3271}
3272
3273impl Validate for DiscountAmountAndType12 {
3274    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3275        if let Some(ref val) = self.tp
3276            && config.validate_optional_fields
3277        {
3278            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3279        }
3280        self.amt
3281            .validate(&helpers::child_path(path, "Amt"), config, collector);
3282    }
3283}
3284
3285// DiscountAmountType1Choice1: Specifies the amount type, in a free-text form.
3286#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3287pub struct DiscountAmountType1Choice1 {
3288    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3289    pub cd: Option<String>,
3290    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3291    pub prtry: Option<String>,
3292}
3293
3294impl Validate for DiscountAmountType1Choice1 {
3295    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3296        if let Some(ref val) = self.cd {
3297            helpers::validate_length(
3298                val,
3299                "Cd",
3300                Some(1),
3301                Some(4),
3302                &helpers::child_path(path, "Cd"),
3303                config,
3304                collector,
3305            );
3306        }
3307        if let Some(ref val) = self.prtry {
3308            helpers::validate_length(
3309                val,
3310                "Prtry",
3311                Some(1),
3312                Some(35),
3313                &helpers::child_path(path, "Prtry"),
3314                config,
3315                collector,
3316            );
3317        }
3318        if let Some(ref val) = self.prtry {
3319            helpers::validate_pattern(
3320                val,
3321                "Prtry",
3322                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3323                &helpers::child_path(path, "Prtry"),
3324                config,
3325                collector,
3326            );
3327        }
3328    }
3329}
3330
3331// DiscountAmountType1Choice2: Specifies the amount type, in a free-text form.
3332#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3333pub struct DiscountAmountType1Choice2 {
3334    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3335    pub cd: Option<String>,
3336    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3337    pub prtry: Option<String>,
3338}
3339
3340impl Validate for DiscountAmountType1Choice2 {
3341    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3342        if let Some(ref val) = self.cd {
3343            helpers::validate_length(
3344                val,
3345                "Cd",
3346                Some(1),
3347                Some(4),
3348                &helpers::child_path(path, "Cd"),
3349                config,
3350                collector,
3351            );
3352        }
3353        if let Some(ref val) = self.prtry {
3354            helpers::validate_length(
3355                val,
3356                "Prtry",
3357                Some(1),
3358                Some(35),
3359                &helpers::child_path(path, "Prtry"),
3360                config,
3361                collector,
3362            );
3363        }
3364        if let Some(ref val) = self.prtry {
3365            helpers::validate_pattern(
3366                val,
3367                "Prtry",
3368                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3369                &helpers::child_path(path, "Prtry"),
3370                config,
3371                collector,
3372            );
3373        }
3374    }
3375}
3376
3377// DisplayCapabilities1: Number of columns of the display component.
3378#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3379pub struct DisplayCapabilities1 {
3380    #[serde(rename = "DispTp")]
3381    pub disp_tp: UserInterface2Code,
3382    #[serde(rename = "NbOfLines")]
3383    pub nb_of_lines: String,
3384    #[serde(rename = "LineWidth")]
3385    pub line_width: String,
3386}
3387
3388impl Validate for DisplayCapabilities1 {
3389    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3390        self.disp_tp
3391            .validate(&helpers::child_path(path, "DispTp"), config, collector);
3392        helpers::validate_pattern(
3393            &self.nb_of_lines,
3394            "NbOfLines",
3395            "[0-9]{1,3}",
3396            &helpers::child_path(path, "NbOfLines"),
3397            config,
3398            collector,
3399        );
3400        helpers::validate_pattern(
3401            &self.line_width,
3402            "LineWidth",
3403            "[0-9]{1,3}",
3404            &helpers::child_path(path, "LineWidth"),
3405            config,
3406            collector,
3407        );
3408    }
3409}
3410
3411// DocumentAdjustment11: Provides further details on the document adjustment.
3412#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3413pub struct DocumentAdjustment11 {
3414    #[serde(rename = "Amt")]
3415    pub amt: ActiveOrHistoricCurrencyAndAmount,
3416    #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
3417    pub cdt_dbt_ind: Option<CreditDebitCode>,
3418    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
3419    pub rsn: Option<String>,
3420    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
3421    pub addtl_inf: Option<String>,
3422}
3423
3424impl Validate for DocumentAdjustment11 {
3425    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3426        self.amt
3427            .validate(&helpers::child_path(path, "Amt"), config, collector);
3428        if let Some(ref val) = self.cdt_dbt_ind
3429            && config.validate_optional_fields
3430        {
3431            val.validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
3432        }
3433        if let Some(ref val) = self.rsn {
3434            helpers::validate_length(
3435                val,
3436                "Rsn",
3437                Some(1),
3438                Some(4),
3439                &helpers::child_path(path, "Rsn"),
3440                config,
3441                collector,
3442            );
3443        }
3444        if let Some(ref val) = self.rsn {
3445            helpers::validate_pattern(
3446                val,
3447                "Rsn",
3448                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3449                &helpers::child_path(path, "Rsn"),
3450                config,
3451                collector,
3452            );
3453        }
3454        if let Some(ref val) = self.addtl_inf {
3455            helpers::validate_length(
3456                val,
3457                "AddtlInf",
3458                Some(1),
3459                Some(140),
3460                &helpers::child_path(path, "AddtlInf"),
3461                config,
3462                collector,
3463            );
3464        }
3465        if let Some(ref val) = self.addtl_inf {
3466            helpers::validate_pattern(
3467                val,
3468                "AddtlInf",
3469                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3470                &helpers::child_path(path, "AddtlInf"),
3471                config,
3472                collector,
3473            );
3474        }
3475    }
3476}
3477
3478// DocumentLineIdentification11: Date associated with the referred document line.
3479#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3480pub struct DocumentLineIdentification11 {
3481    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3482    pub tp: Option<DocumentLineType11>,
3483    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
3484    pub nb: Option<String>,
3485    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
3486    pub rltd_dt: Option<String>,
3487}
3488
3489impl Validate for DocumentLineIdentification11 {
3490    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3491        if let Some(ref val) = self.tp
3492            && config.validate_optional_fields
3493        {
3494            val.validate(&helpers::child_path(path, "Tp"), config, collector);
3495        }
3496        if let Some(ref val) = self.nb {
3497            helpers::validate_length(
3498                val,
3499                "Nb",
3500                Some(1),
3501                Some(35),
3502                &helpers::child_path(path, "Nb"),
3503                config,
3504                collector,
3505            );
3506        }
3507        if let Some(ref val) = self.nb {
3508            helpers::validate_pattern(
3509                val,
3510                "Nb",
3511                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3512                &helpers::child_path(path, "Nb"),
3513                config,
3514                collector,
3515            );
3516        }
3517    }
3518}
3519
3520// DocumentLineInformation11: Provides details on the amounts of the document line.
3521#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3522pub struct DocumentLineInformation11 {
3523    #[serde(rename = "Id")]
3524    pub id: Vec<DocumentLineIdentification11>,
3525    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
3526    pub desc: Option<String>,
3527    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
3528    pub amt: Option<RemittanceAmount31>,
3529}
3530
3531impl Validate for DocumentLineInformation11 {
3532    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3533        for item in &self.id {
3534            item.validate(&helpers::child_path(path, "Id"), config, collector);
3535        }
3536        if let Some(ref val) = self.desc {
3537            helpers::validate_length(
3538                val,
3539                "Desc",
3540                Some(1),
3541                Some(35),
3542                &helpers::child_path(path, "Desc"),
3543                config,
3544                collector,
3545            );
3546        }
3547        if let Some(ref val) = self.desc {
3548            helpers::validate_pattern(
3549                val,
3550                "Desc",
3551                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3552                &helpers::child_path(path, "Desc"),
3553                config,
3554                collector,
3555            );
3556        }
3557        if let Some(ref val) = self.amt
3558            && config.validate_optional_fields
3559        {
3560            val.validate(&helpers::child_path(path, "Amt"), config, collector);
3561        }
3562    }
3563}
3564
3565// DocumentLineType1Choice1: Proprietary identification of the type of the remittance document.
3566#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3567pub struct DocumentLineType1Choice1 {
3568    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3569    pub cd: Option<String>,
3570    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3571    pub prtry: Option<String>,
3572}
3573
3574impl Validate for DocumentLineType1Choice1 {
3575    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3576        if let Some(ref val) = self.cd {
3577            helpers::validate_length(
3578                val,
3579                "Cd",
3580                Some(1),
3581                Some(4),
3582                &helpers::child_path(path, "Cd"),
3583                config,
3584                collector,
3585            );
3586        }
3587        if let Some(ref val) = self.prtry {
3588            helpers::validate_length(
3589                val,
3590                "Prtry",
3591                Some(1),
3592                Some(35),
3593                &helpers::child_path(path, "Prtry"),
3594                config,
3595                collector,
3596            );
3597        }
3598        if let Some(ref val) = self.prtry {
3599            helpers::validate_pattern(
3600                val,
3601                "Prtry",
3602                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3603                &helpers::child_path(path, "Prtry"),
3604                config,
3605                collector,
3606            );
3607        }
3608    }
3609}
3610
3611// DocumentLineType11: Identification of the issuer of the reference document line identificationtype.
3612#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3613pub struct DocumentLineType11 {
3614    #[serde(rename = "CdOrPrtry")]
3615    pub cd_or_prtry: DocumentLineType1Choice1,
3616    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3617    pub issr: Option<String>,
3618}
3619
3620impl Validate for DocumentLineType11 {
3621    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3622        self.cd_or_prtry
3623            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
3624        if let Some(ref val) = self.issr {
3625            helpers::validate_length(
3626                val,
3627                "Issr",
3628                Some(1),
3629                Some(35),
3630                &helpers::child_path(path, "Issr"),
3631                config,
3632                collector,
3633            );
3634        }
3635        if let Some(ref val) = self.issr {
3636            helpers::validate_pattern(
3637                val,
3638                "Issr",
3639                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3640                &helpers::child_path(path, "Issr"),
3641                config,
3642                collector,
3643            );
3644        }
3645    }
3646}
3647
3648// DocumentType3Code: Document is a structured communication reference provided by the creditor to identify the referred transaction.
3649#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3650pub enum DocumentType3Code {
3651    #[default]
3652    #[serde(rename = "RADM")]
3653    CodeRADM,
3654    #[serde(rename = "RPIN")]
3655    CodeRPIN,
3656    #[serde(rename = "FXDR")]
3657    CodeFXDR,
3658    #[serde(rename = "DISP")]
3659    CodeDISP,
3660    #[serde(rename = "PUOR")]
3661    CodePUOR,
3662    #[serde(rename = "SCOR")]
3663    CodeSCOR,
3664}
3665
3666impl Validate for DocumentType3Code {
3667    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3668        // Enum validation is typically empty
3669    }
3670}
3671
3672// DocumentType6Code: Document is a purchase order.
3673#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3674pub enum DocumentType6Code {
3675    #[default]
3676    #[serde(rename = "MSIN")]
3677    CodeMSIN,
3678    #[serde(rename = "CNFA")]
3679    CodeCNFA,
3680    #[serde(rename = "DNFA")]
3681    CodeDNFA,
3682    #[serde(rename = "CINV")]
3683    CodeCINV,
3684    #[serde(rename = "CREN")]
3685    CodeCREN,
3686    #[serde(rename = "DEBN")]
3687    CodeDEBN,
3688    #[serde(rename = "HIRI")]
3689    CodeHIRI,
3690    #[serde(rename = "SBIN")]
3691    CodeSBIN,
3692    #[serde(rename = "CMCN")]
3693    CodeCMCN,
3694    #[serde(rename = "SOAC")]
3695    CodeSOAC,
3696    #[serde(rename = "DISP")]
3697    CodeDISP,
3698    #[serde(rename = "BOLD")]
3699    CodeBOLD,
3700    #[serde(rename = "VCHR")]
3701    CodeVCHR,
3702    #[serde(rename = "AROI")]
3703    CodeAROI,
3704    #[serde(rename = "TSUT")]
3705    CodeTSUT,
3706    #[serde(rename = "PUOR")]
3707    CodePUOR,
3708}
3709
3710impl Validate for DocumentType6Code {
3711    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3712        // Enum validation is typically empty
3713    }
3714}
3715
3716// EntryDetails91: Provides information on the underlying transaction(s).
3717#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3718pub struct EntryDetails91 {
3719    #[serde(rename = "Btch", skip_serializing_if = "Option::is_none")]
3720    pub btch: Option<BatchInformation21>,
3721    #[serde(rename = "TxDtls", skip_serializing_if = "Option::is_none")]
3722    pub tx_dtls: Option<Vec<Box<EntryTransaction101>>>,
3723}
3724
3725impl Validate for EntryDetails91 {
3726    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3727        if let Some(ref val) = self.btch
3728            && config.validate_optional_fields
3729        {
3730            val.validate(&helpers::child_path(path, "Btch"), config, collector);
3731        }
3732        if let Some(ref vec) = self.tx_dtls
3733            && config.validate_optional_fields
3734        {
3735            for item in vec {
3736                item.validate(&helpers::child_path(path, "TxDtls"), config, collector);
3737            }
3738        }
3739    }
3740}
3741
3742// EntryStatus1Choice1: Entry status, in a coded form.
3743#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3744pub struct EntryStatus1Choice1 {
3745    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3746    pub cd: Option<String>,
3747}
3748
3749impl Validate for EntryStatus1Choice1 {
3750    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3751        if let Some(ref val) = self.cd {
3752            helpers::validate_length(
3753                val,
3754                "Cd",
3755                Some(1),
3756                Some(4),
3757                &helpers::child_path(path, "Cd"),
3758                config,
3759                collector,
3760            );
3761        }
3762    }
3763}
3764
3765// EntryTransaction101: Further details of the transaction.
3766#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3767pub struct EntryTransaction101 {
3768    #[serde(rename = "Refs")]
3769    pub refs: TransactionReferences61,
3770    #[serde(rename = "Amt")]
3771    pub amt: ActiveOrHistoricCurrencyAndAmount,
3772    #[serde(rename = "CdtDbtInd")]
3773    pub cdt_dbt_ind: CreditDebitCode,
3774    #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
3775    pub amt_dtls: Option<AmountAndCurrencyExchange31>,
3776    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
3777    pub avlbty: Option<Vec<CashAvailability1>>,
3778    #[serde(rename = "BkTxCd", skip_serializing_if = "Option::is_none")]
3779    pub bk_tx_cd: Option<BankTransactionCodeStructure41>,
3780    #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
3781    pub chrgs: Option<Charges62>,
3782    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
3783    pub intrst: Option<TransactionInterest41>,
3784    #[serde(rename = "RltdPties", skip_serializing_if = "Option::is_none")]
3785    pub rltd_pties: Option<TransactionParties61>,
3786    #[serde(rename = "RltdAgts", skip_serializing_if = "Option::is_none")]
3787    pub rltd_agts: Option<TransactionAgents51>,
3788    #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3789    pub lcl_instrm: Option<LocalInstrument2Choice1>,
3790    #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
3791    pub purp: Option<Purpose2Choice1>,
3792    #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
3793    pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
3794    #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
3795    pub rmt_inf: Option<RemittanceInformation161>,
3796    #[serde(rename = "RltdDts")]
3797    pub rltd_dts: TransactionDates31,
3798    #[serde(rename = "RltdPric", skip_serializing_if = "Option::is_none")]
3799    pub rltd_pric: Option<TransactionPrice4Choice1>,
3800    #[serde(rename = "RltdQties", skip_serializing_if = "Option::is_none")]
3801    pub rltd_qties: Option<Vec<TransactionQuantities3Choice1>>,
3802    #[serde(rename = "FinInstrmId", skip_serializing_if = "Option::is_none")]
3803    pub fin_instrm_id: Option<SecurityIdentification191>,
3804    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
3805    pub tax: Option<TaxInformation81>,
3806    #[serde(rename = "RtrInf", skip_serializing_if = "Option::is_none")]
3807    pub rtr_inf: Option<PaymentReturnReason51>,
3808    #[serde(rename = "CorpActn", skip_serializing_if = "Option::is_none")]
3809    pub corp_actn: Option<CorporateAction91>,
3810    #[serde(rename = "SfkpgAcct", skip_serializing_if = "Option::is_none")]
3811    pub sfkpg_acct: Option<SecuritiesAccount191>,
3812    #[serde(rename = "CshDpst", skip_serializing_if = "Option::is_none")]
3813    pub csh_dpst: Option<Vec<CashDeposit1>>,
3814    #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
3815    pub card_tx: Option<CardTransaction171>,
3816    #[serde(rename = "AddtlTxInf", skip_serializing_if = "Option::is_none")]
3817    pub addtl_tx_inf: Option<String>,
3818}
3819
3820impl Validate for EntryTransaction101 {
3821    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3822        self.refs
3823            .validate(&helpers::child_path(path, "Refs"), config, collector);
3824        self.amt
3825            .validate(&helpers::child_path(path, "Amt"), config, collector);
3826        self.cdt_dbt_ind
3827            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
3828        if let Some(ref val) = self.amt_dtls
3829            && config.validate_optional_fields
3830        {
3831            val.validate(&helpers::child_path(path, "AmtDtls"), config, collector);
3832        }
3833        if let Some(ref vec) = self.avlbty
3834            && config.validate_optional_fields
3835        {
3836            for item in vec {
3837                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
3838            }
3839        }
3840        if let Some(ref val) = self.bk_tx_cd
3841            && config.validate_optional_fields
3842        {
3843            val.validate(&helpers::child_path(path, "BkTxCd"), config, collector);
3844        }
3845        if let Some(ref val) = self.chrgs
3846            && config.validate_optional_fields
3847        {
3848            val.validate(&helpers::child_path(path, "Chrgs"), config, collector);
3849        }
3850        if let Some(ref val) = self.intrst
3851            && config.validate_optional_fields
3852        {
3853            val.validate(&helpers::child_path(path, "Intrst"), config, collector);
3854        }
3855        if let Some(ref val) = self.rltd_pties
3856            && config.validate_optional_fields
3857        {
3858            val.validate(&helpers::child_path(path, "RltdPties"), config, collector);
3859        }
3860        if let Some(ref val) = self.rltd_agts
3861            && config.validate_optional_fields
3862        {
3863            val.validate(&helpers::child_path(path, "RltdAgts"), config, collector);
3864        }
3865        if let Some(ref val) = self.lcl_instrm
3866            && config.validate_optional_fields
3867        {
3868            val.validate(&helpers::child_path(path, "LclInstrm"), config, collector);
3869        }
3870        if let Some(ref val) = self.purp
3871            && config.validate_optional_fields
3872        {
3873            val.validate(&helpers::child_path(path, "Purp"), config, collector);
3874        }
3875        if let Some(ref vec) = self.rltd_rmt_inf
3876            && config.validate_optional_fields
3877        {
3878            for item in vec {
3879                item.validate(&helpers::child_path(path, "RltdRmtInf"), config, collector);
3880            }
3881        }
3882        if let Some(ref val) = self.rmt_inf
3883            && config.validate_optional_fields
3884        {
3885            val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
3886        }
3887        self.rltd_dts
3888            .validate(&helpers::child_path(path, "RltdDts"), config, collector);
3889        if let Some(ref val) = self.rltd_pric
3890            && config.validate_optional_fields
3891        {
3892            val.validate(&helpers::child_path(path, "RltdPric"), config, collector);
3893        }
3894        if let Some(ref vec) = self.rltd_qties
3895            && config.validate_optional_fields
3896        {
3897            for item in vec {
3898                item.validate(&helpers::child_path(path, "RltdQties"), config, collector);
3899            }
3900        }
3901        if let Some(ref val) = self.fin_instrm_id
3902            && config.validate_optional_fields
3903        {
3904            val.validate(&helpers::child_path(path, "FinInstrmId"), config, collector);
3905        }
3906        if let Some(ref val) = self.tax
3907            && config.validate_optional_fields
3908        {
3909            val.validate(&helpers::child_path(path, "Tax"), config, collector);
3910        }
3911        if let Some(ref val) = self.rtr_inf
3912            && config.validate_optional_fields
3913        {
3914            val.validate(&helpers::child_path(path, "RtrInf"), config, collector);
3915        }
3916        if let Some(ref val) = self.corp_actn
3917            && config.validate_optional_fields
3918        {
3919            val.validate(&helpers::child_path(path, "CorpActn"), config, collector);
3920        }
3921        if let Some(ref val) = self.sfkpg_acct
3922            && config.validate_optional_fields
3923        {
3924            val.validate(&helpers::child_path(path, "SfkpgAcct"), config, collector);
3925        }
3926        if let Some(ref vec) = self.csh_dpst
3927            && config.validate_optional_fields
3928        {
3929            for item in vec {
3930                item.validate(&helpers::child_path(path, "CshDpst"), config, collector);
3931            }
3932        }
3933        if let Some(ref val) = self.card_tx
3934            && config.validate_optional_fields
3935        {
3936            val.validate(&helpers::child_path(path, "CardTx"), config, collector);
3937        }
3938        if let Some(ref val) = self.addtl_tx_inf {
3939            helpers::validate_length(
3940                val,
3941                "AddtlTxInf",
3942                Some(1),
3943                Some(500),
3944                &helpers::child_path(path, "AddtlTxInf"),
3945                config,
3946                collector,
3947            );
3948        }
3949        if let Some(ref val) = self.addtl_tx_inf {
3950            helpers::validate_pattern(
3951                val,
3952                "AddtlTxInf",
3953                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3954                &helpers::child_path(path, "AddtlTxInf"),
3955                config,
3956                collector,
3957            );
3958        }
3959    }
3960}
3961
3962// FinancialIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
3963#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3964pub struct FinancialIdentificationSchemeName1Choice1 {
3965    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3966    pub cd: Option<String>,
3967    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3968    pub prtry: Option<String>,
3969}
3970
3971impl Validate for FinancialIdentificationSchemeName1Choice1 {
3972    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3973        if let Some(ref val) = self.cd {
3974            helpers::validate_length(
3975                val,
3976                "Cd",
3977                Some(1),
3978                Some(4),
3979                &helpers::child_path(path, "Cd"),
3980                config,
3981                collector,
3982            );
3983        }
3984        if let Some(ref val) = self.prtry {
3985            helpers::validate_length(
3986                val,
3987                "Prtry",
3988                Some(1),
3989                Some(35),
3990                &helpers::child_path(path, "Prtry"),
3991                config,
3992                collector,
3993            );
3994        }
3995        if let Some(ref val) = self.prtry {
3996            helpers::validate_pattern(
3997                val,
3998                "Prtry",
3999                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4000                &helpers::child_path(path, "Prtry"),
4001                config,
4002                collector,
4003            );
4004        }
4005    }
4006}
4007
4008// FinancialInstitutionIdentification181: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4009#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4010pub struct FinancialInstitutionIdentification181 {
4011    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4012    pub bicfi: Option<String>,
4013    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4014    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
4015    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4016    pub lei: Option<String>,
4017    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4018    pub nm: Option<String>,
4019    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4020    pub pstl_adr: Option<PostalAddress242>,
4021    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4022    pub othr: Option<GenericFinancialIdentification11>,
4023}
4024
4025impl Validate for FinancialInstitutionIdentification181 {
4026    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4027        if let Some(ref val) = self.bicfi {
4028            helpers::validate_pattern(
4029                val,
4030                "BICFI",
4031                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4032                &helpers::child_path(path, "BICFI"),
4033                config,
4034                collector,
4035            );
4036        }
4037        if let Some(ref val) = self.clr_sys_mmb_id
4038            && config.validate_optional_fields
4039        {
4040            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4041        }
4042        if let Some(ref val) = self.lei {
4043            helpers::validate_pattern(
4044                val,
4045                "LEI",
4046                "[A-Z0-9]{18,18}[0-9]{2,2}",
4047                &helpers::child_path(path, "LEI"),
4048                config,
4049                collector,
4050            );
4051        }
4052        if let Some(ref val) = self.nm {
4053            helpers::validate_length(
4054                val,
4055                "Nm",
4056                Some(1),
4057                Some(140),
4058                &helpers::child_path(path, "Nm"),
4059                config,
4060                collector,
4061            );
4062        }
4063        if let Some(ref val) = self.nm {
4064            helpers::validate_pattern(
4065                val,
4066                "Nm",
4067                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4068                &helpers::child_path(path, "Nm"),
4069                config,
4070                collector,
4071            );
4072        }
4073        if let Some(ref val) = self.pstl_adr
4074            && config.validate_optional_fields
4075        {
4076            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4077        }
4078        if let Some(ref val) = self.othr
4079            && config.validate_optional_fields
4080        {
4081            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4082        }
4083    }
4084}
4085
4086// FinancialInstitutionIdentification182: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4087#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4088pub struct FinancialInstitutionIdentification182 {
4089    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4090    pub bicfi: Option<String>,
4091    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4092    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
4093    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4094    pub lei: Option<String>,
4095    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4096    pub nm: Option<String>,
4097    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4098    pub pstl_adr: Option<PostalAddress241>,
4099    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4100    pub othr: Option<GenericFinancialIdentification11>,
4101}
4102
4103impl Validate for FinancialInstitutionIdentification182 {
4104    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4105        if let Some(ref val) = self.bicfi {
4106            helpers::validate_pattern(
4107                val,
4108                "BICFI",
4109                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4110                &helpers::child_path(path, "BICFI"),
4111                config,
4112                collector,
4113            );
4114        }
4115        if let Some(ref val) = self.clr_sys_mmb_id
4116            && config.validate_optional_fields
4117        {
4118            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4119        }
4120        if let Some(ref val) = self.lei {
4121            helpers::validate_pattern(
4122                val,
4123                "LEI",
4124                "[A-Z0-9]{18,18}[0-9]{2,2}",
4125                &helpers::child_path(path, "LEI"),
4126                config,
4127                collector,
4128            );
4129        }
4130        if let Some(ref val) = self.nm {
4131            helpers::validate_length(
4132                val,
4133                "Nm",
4134                Some(1),
4135                Some(140),
4136                &helpers::child_path(path, "Nm"),
4137                config,
4138                collector,
4139            );
4140        }
4141        if let Some(ref val) = self.nm {
4142            helpers::validate_pattern(
4143                val,
4144                "Nm",
4145                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4146                &helpers::child_path(path, "Nm"),
4147                config,
4148                collector,
4149            );
4150        }
4151        if let Some(ref val) = self.pstl_adr
4152            && config.validate_optional_fields
4153        {
4154            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4155        }
4156        if let Some(ref val) = self.othr
4157            && config.validate_optional_fields
4158        {
4159            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4160        }
4161    }
4162}
4163
4164// FinancialInstitutionIdentification183: Information that locates and identifies a specific address, as defined by postal services.
4165#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4166pub struct FinancialInstitutionIdentification183 {
4167    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4168    pub bicfi: Option<String>,
4169    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4170    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
4171    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4172    pub lei: Option<String>,
4173    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4174    pub nm: Option<String>,
4175    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4176    pub pstl_adr: Option<PostalAddress243>,
4177}
4178
4179impl Validate for FinancialInstitutionIdentification183 {
4180    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4181        if let Some(ref val) = self.bicfi {
4182            helpers::validate_pattern(
4183                val,
4184                "BICFI",
4185                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4186                &helpers::child_path(path, "BICFI"),
4187                config,
4188                collector,
4189            );
4190        }
4191        if let Some(ref val) = self.clr_sys_mmb_id
4192            && config.validate_optional_fields
4193        {
4194            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4195        }
4196        if let Some(ref val) = self.lei {
4197            helpers::validate_pattern(
4198                val,
4199                "LEI",
4200                "[A-Z0-9]{18,18}[0-9]{2,2}",
4201                &helpers::child_path(path, "LEI"),
4202                config,
4203                collector,
4204            );
4205        }
4206        if let Some(ref val) = self.nm {
4207            helpers::validate_length(
4208                val,
4209                "Nm",
4210                Some(1),
4211                Some(140),
4212                &helpers::child_path(path, "Nm"),
4213                config,
4214                collector,
4215            );
4216        }
4217        if let Some(ref val) = self.nm {
4218            helpers::validate_pattern(
4219                val,
4220                "Nm",
4221                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4222                &helpers::child_path(path, "Nm"),
4223                config,
4224                collector,
4225            );
4226        }
4227        if let Some(ref val) = self.pstl_adr
4228            && config.validate_optional_fields
4229        {
4230            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4231        }
4232    }
4233}
4234
4235// FinancialInstitutionIdentification184: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4236#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4237pub struct FinancialInstitutionIdentification184 {
4238    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4239    pub bicfi: Option<String>,
4240    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4241    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
4242    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4243    pub lei: Option<String>,
4244    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4245    pub nm: Option<String>,
4246    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4247    pub pstl_adr: Option<PostalAddress241>,
4248    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4249    pub othr: Option<GenericFinancialIdentification11>,
4250}
4251
4252impl Validate for FinancialInstitutionIdentification184 {
4253    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4254        if let Some(ref val) = self.bicfi {
4255            helpers::validate_pattern(
4256                val,
4257                "BICFI",
4258                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4259                &helpers::child_path(path, "BICFI"),
4260                config,
4261                collector,
4262            );
4263        }
4264        if let Some(ref val) = self.clr_sys_mmb_id
4265            && config.validate_optional_fields
4266        {
4267            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4268        }
4269        if let Some(ref val) = self.lei {
4270            helpers::validate_pattern(
4271                val,
4272                "LEI",
4273                "[A-Z0-9]{18,18}[0-9]{2,2}",
4274                &helpers::child_path(path, "LEI"),
4275                config,
4276                collector,
4277            );
4278        }
4279        if let Some(ref val) = self.nm {
4280            helpers::validate_length(
4281                val,
4282                "Nm",
4283                Some(1),
4284                Some(140),
4285                &helpers::child_path(path, "Nm"),
4286                config,
4287                collector,
4288            );
4289        }
4290        if let Some(ref val) = self.nm {
4291            helpers::validate_pattern(
4292                val,
4293                "Nm",
4294                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4295                &helpers::child_path(path, "Nm"),
4296                config,
4297                collector,
4298            );
4299        }
4300        if let Some(ref val) = self.pstl_adr
4301            && config.validate_optional_fields
4302        {
4303            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4304        }
4305        if let Some(ref val) = self.othr
4306            && config.validate_optional_fields
4307        {
4308            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4309        }
4310    }
4311}
4312
4313// FinancialInstitutionIdentification185: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4314#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4315pub struct FinancialInstitutionIdentification185 {
4316    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4317    pub bicfi: Option<String>,
4318    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4319    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification2>,
4320    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4321    pub lei: Option<String>,
4322    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4323    pub nm: Option<String>,
4324    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4325    pub pstl_adr: Option<PostalAddress241>,
4326    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4327    pub othr: Option<GenericFinancialIdentification11>,
4328}
4329
4330impl Validate for FinancialInstitutionIdentification185 {
4331    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4332        if let Some(ref val) = self.bicfi {
4333            helpers::validate_pattern(
4334                val,
4335                "BICFI",
4336                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4337                &helpers::child_path(path, "BICFI"),
4338                config,
4339                collector,
4340            );
4341        }
4342        if let Some(ref val) = self.clr_sys_mmb_id
4343            && config.validate_optional_fields
4344        {
4345            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4346        }
4347        if let Some(ref val) = self.lei {
4348            helpers::validate_pattern(
4349                val,
4350                "LEI",
4351                "[A-Z0-9]{18,18}[0-9]{2,2}",
4352                &helpers::child_path(path, "LEI"),
4353                config,
4354                collector,
4355            );
4356        }
4357        if let Some(ref val) = self.nm {
4358            helpers::validate_length(
4359                val,
4360                "Nm",
4361                Some(1),
4362                Some(140),
4363                &helpers::child_path(path, "Nm"),
4364                config,
4365                collector,
4366            );
4367        }
4368        if let Some(ref val) = self.nm {
4369            helpers::validate_pattern(
4370                val,
4371                "Nm",
4372                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4373                &helpers::child_path(path, "Nm"),
4374                config,
4375                collector,
4376            );
4377        }
4378        if let Some(ref val) = self.pstl_adr
4379            && config.validate_optional_fields
4380        {
4381            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4382        }
4383        if let Some(ref val) = self.othr
4384            && config.validate_optional_fields
4385        {
4386            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4387        }
4388    }
4389}
4390
4391// FinancialInstitutionIdentification186: Unique identification of an agent, as assigned by an institution, using an identification scheme.
4392#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4393pub struct FinancialInstitutionIdentification186 {
4394    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4395    pub bicfi: Option<String>,
4396    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4397    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
4398    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4399    pub lei: Option<String>,
4400    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4401    pub nm: Option<String>,
4402    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4403    pub pstl_adr: Option<PostalAddress243>,
4404    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4405    pub othr: Option<GenericFinancialIdentification11>,
4406}
4407
4408impl Validate for FinancialInstitutionIdentification186 {
4409    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4410        if let Some(ref val) = self.bicfi {
4411            helpers::validate_pattern(
4412                val,
4413                "BICFI",
4414                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
4415                &helpers::child_path(path, "BICFI"),
4416                config,
4417                collector,
4418            );
4419        }
4420        if let Some(ref val) = self.clr_sys_mmb_id
4421            && config.validate_optional_fields
4422        {
4423            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
4424        }
4425        if let Some(ref val) = self.lei {
4426            helpers::validate_pattern(
4427                val,
4428                "LEI",
4429                "[A-Z0-9]{18,18}[0-9]{2,2}",
4430                &helpers::child_path(path, "LEI"),
4431                config,
4432                collector,
4433            );
4434        }
4435        if let Some(ref val) = self.nm {
4436            helpers::validate_length(
4437                val,
4438                "Nm",
4439                Some(1),
4440                Some(140),
4441                &helpers::child_path(path, "Nm"),
4442                config,
4443                collector,
4444            );
4445        }
4446        if let Some(ref val) = self.nm {
4447            helpers::validate_pattern(
4448                val,
4449                "Nm",
4450                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4451                &helpers::child_path(path, "Nm"),
4452                config,
4453                collector,
4454            );
4455        }
4456        if let Some(ref val) = self.pstl_adr
4457            && config.validate_optional_fields
4458        {
4459            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
4460        }
4461        if let Some(ref val) = self.othr
4462            && config.validate_optional_fields
4463        {
4464            val.validate(&helpers::child_path(path, "Othr"), config, collector);
4465        }
4466    }
4467}
4468
4469// 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.
4470#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4471pub struct FinancialInstrumentQuantity1Choice {
4472    #[serde(rename = "Unit", skip_serializing_if = "Option::is_none")]
4473    pub unit: Option<f64>,
4474    #[serde(rename = "FaceAmt", skip_serializing_if = "Option::is_none")]
4475    pub face_amt: Option<f64>,
4476    #[serde(rename = "AmtsdVal", skip_serializing_if = "Option::is_none")]
4477    pub amtsd_val: Option<f64>,
4478}
4479
4480impl Validate for FinancialInstrumentQuantity1Choice {
4481    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
4482}
4483
4484// FromToAmountRange1: Upper boundary of a range of amount values.
4485#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4486pub struct FromToAmountRange1 {
4487    #[serde(rename = "FrAmt")]
4488    pub fr_amt: AmountRangeBoundary1,
4489    #[serde(rename = "ToAmt")]
4490    pub to_amt: AmountRangeBoundary1,
4491}
4492
4493impl Validate for FromToAmountRange1 {
4494    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4495        self.fr_amt
4496            .validate(&helpers::child_path(path, "FrAmt"), config, collector);
4497        self.to_amt
4498            .validate(&helpers::child_path(path, "ToAmt"), config, collector);
4499    }
4500}
4501
4502// Garnishment31: Indicates if the employment of the person to whom the garnishment applies (that is, the ultimate debtor) has been terminated.
4503#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4504pub struct Garnishment31 {
4505    #[serde(rename = "Tp")]
4506    pub tp: GarnishmentType11,
4507    #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
4508    pub grnshee: Option<PartyIdentification1359>,
4509    #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
4510    pub grnshmt_admstr: Option<PartyIdentification1359>,
4511    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4512    pub ref_nb: Option<String>,
4513    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4514    pub dt: Option<String>,
4515    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4516    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4517    #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
4518    pub fmly_mdcl_insrnc_ind: Option<bool>,
4519    #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
4520    pub mplyee_termntn_ind: Option<bool>,
4521}
4522
4523impl Validate for Garnishment31 {
4524    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4525        self.tp
4526            .validate(&helpers::child_path(path, "Tp"), config, collector);
4527        if let Some(ref val) = self.grnshee
4528            && config.validate_optional_fields
4529        {
4530            val.validate(&helpers::child_path(path, "Grnshee"), config, collector);
4531        }
4532        if let Some(ref val) = self.grnshmt_admstr
4533            && config.validate_optional_fields
4534        {
4535            val.validate(
4536                &helpers::child_path(path, "GrnshmtAdmstr"),
4537                config,
4538                collector,
4539            );
4540        }
4541        if let Some(ref val) = self.ref_nb {
4542            helpers::validate_length(
4543                val,
4544                "RefNb",
4545                Some(1),
4546                Some(140),
4547                &helpers::child_path(path, "RefNb"),
4548                config,
4549                collector,
4550            );
4551        }
4552        if let Some(ref val) = self.ref_nb {
4553            helpers::validate_pattern(
4554                val,
4555                "RefNb",
4556                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4557                &helpers::child_path(path, "RefNb"),
4558                config,
4559                collector,
4560            );
4561        }
4562        if let Some(ref val) = self.rmtd_amt
4563            && config.validate_optional_fields
4564        {
4565            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
4566        }
4567    }
4568}
4569
4570// GarnishmentType1Choice1: Proprietary identification of the type of garnishment.
4571#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4572pub struct GarnishmentType1Choice1 {
4573    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4574    pub cd: Option<String>,
4575    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4576    pub prtry: Option<String>,
4577}
4578
4579impl Validate for GarnishmentType1Choice1 {
4580    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4581        if let Some(ref val) = self.cd {
4582            helpers::validate_length(
4583                val,
4584                "Cd",
4585                Some(1),
4586                Some(4),
4587                &helpers::child_path(path, "Cd"),
4588                config,
4589                collector,
4590            );
4591        }
4592        if let Some(ref val) = self.prtry {
4593            helpers::validate_length(
4594                val,
4595                "Prtry",
4596                Some(1),
4597                Some(35),
4598                &helpers::child_path(path, "Prtry"),
4599                config,
4600                collector,
4601            );
4602        }
4603        if let Some(ref val) = self.prtry {
4604            helpers::validate_pattern(
4605                val,
4606                "Prtry",
4607                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4608                &helpers::child_path(path, "Prtry"),
4609                config,
4610                collector,
4611            );
4612        }
4613    }
4614}
4615
4616// GarnishmentType11: Identification of the issuer of the garnishment type.
4617#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4618pub struct GarnishmentType11 {
4619    #[serde(rename = "CdOrPrtry")]
4620    pub cd_or_prtry: GarnishmentType1Choice1,
4621    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4622    pub issr: Option<String>,
4623}
4624
4625impl Validate for GarnishmentType11 {
4626    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4627        self.cd_or_prtry
4628            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
4629        if let Some(ref val) = self.issr {
4630            helpers::validate_length(
4631                val,
4632                "Issr",
4633                Some(1),
4634                Some(35),
4635                &helpers::child_path(path, "Issr"),
4636                config,
4637                collector,
4638            );
4639        }
4640        if let Some(ref val) = self.issr {
4641            helpers::validate_pattern(
4642                val,
4643                "Issr",
4644                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4645                &helpers::child_path(path, "Issr"),
4646                config,
4647                collector,
4648            );
4649        }
4650    }
4651}
4652
4653// GenericAccountIdentification11: Entity that assigns the identification.
4654#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4655pub struct GenericAccountIdentification11 {
4656    #[serde(rename = "Id")]
4657    pub id: String,
4658    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4659    pub schme_nm: Option<AccountSchemeName1Choice1>,
4660    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4661    pub issr: Option<String>,
4662}
4663
4664impl Validate for GenericAccountIdentification11 {
4665    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4666        helpers::validate_length(
4667            &self.id,
4668            "Id",
4669            Some(1),
4670            Some(34),
4671            &helpers::child_path(path, "Id"),
4672            config,
4673            collector,
4674        );
4675        helpers::validate_pattern(
4676            &self.id,
4677            "Id",
4678            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
4679            &helpers::child_path(path, "Id"),
4680            config,
4681            collector,
4682        );
4683        if let Some(ref val) = self.schme_nm
4684            && config.validate_optional_fields
4685        {
4686            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4687        }
4688        if let Some(ref val) = self.issr {
4689            helpers::validate_length(
4690                val,
4691                "Issr",
4692                Some(1),
4693                Some(35),
4694                &helpers::child_path(path, "Issr"),
4695                config,
4696                collector,
4697            );
4698        }
4699        if let Some(ref val) = self.issr {
4700            helpers::validate_pattern(
4701                val,
4702                "Issr",
4703                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4704                &helpers::child_path(path, "Issr"),
4705                config,
4706                collector,
4707            );
4708        }
4709    }
4710}
4711
4712// GenericFinancialIdentification11: Entity that assigns the identification.
4713#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4714pub struct GenericFinancialIdentification11 {
4715    #[serde(rename = "Id")]
4716    pub id: String,
4717    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4718    pub schme_nm: Option<FinancialIdentificationSchemeName1Choice1>,
4719    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4720    pub issr: Option<String>,
4721}
4722
4723impl Validate for GenericFinancialIdentification11 {
4724    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4725        helpers::validate_length(
4726            &self.id,
4727            "Id",
4728            Some(1),
4729            Some(35),
4730            &helpers::child_path(path, "Id"),
4731            config,
4732            collector,
4733        );
4734        helpers::validate_pattern(
4735            &self.id,
4736            "Id",
4737            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4738            &helpers::child_path(path, "Id"),
4739            config,
4740            collector,
4741        );
4742        if let Some(ref val) = self.schme_nm
4743            && config.validate_optional_fields
4744        {
4745            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
4746        }
4747        if let Some(ref val) = self.issr {
4748            helpers::validate_length(
4749                val,
4750                "Issr",
4751                Some(1),
4752                Some(35),
4753                &helpers::child_path(path, "Issr"),
4754                config,
4755                collector,
4756            );
4757        }
4758        if let Some(ref val) = self.issr {
4759            helpers::validate_pattern(
4760                val,
4761                "Issr",
4762                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4763                &helpers::child_path(path, "Issr"),
4764                config,
4765                collector,
4766            );
4767        }
4768    }
4769}
4770
4771// GenericIdentification11: Entity that assigns the identification.
4772#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4773pub struct GenericIdentification11 {
4774    #[serde(rename = "Id")]
4775    pub id: String,
4776    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4777    pub schme_nm: Option<String>,
4778    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4779    pub issr: Option<String>,
4780}
4781
4782impl Validate for GenericIdentification11 {
4783    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4784        helpers::validate_length(
4785            &self.id,
4786            "Id",
4787            Some(1),
4788            Some(35),
4789            &helpers::child_path(path, "Id"),
4790            config,
4791            collector,
4792        );
4793        helpers::validate_pattern(
4794            &self.id,
4795            "Id",
4796            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4797            &helpers::child_path(path, "Id"),
4798            config,
4799            collector,
4800        );
4801        if let Some(ref val) = self.schme_nm {
4802            helpers::validate_length(
4803                val,
4804                "SchmeNm",
4805                Some(1),
4806                Some(35),
4807                &helpers::child_path(path, "SchmeNm"),
4808                config,
4809                collector,
4810            );
4811        }
4812        if let Some(ref val) = self.schme_nm {
4813            helpers::validate_pattern(
4814                val,
4815                "SchmeNm",
4816                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4817                &helpers::child_path(path, "SchmeNm"),
4818                config,
4819                collector,
4820            );
4821        }
4822        if let Some(ref val) = self.issr {
4823            helpers::validate_length(
4824                val,
4825                "Issr",
4826                Some(1),
4827                Some(35),
4828                &helpers::child_path(path, "Issr"),
4829                config,
4830                collector,
4831            );
4832        }
4833        if let Some(ref val) = self.issr {
4834            helpers::validate_pattern(
4835                val,
4836                "Issr",
4837                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4838                &helpers::child_path(path, "Issr"),
4839                config,
4840                collector,
4841            );
4842        }
4843    }
4844}
4845
4846// GenericIdentification30: Short textual description of the scheme.
4847#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4848pub struct GenericIdentification30 {
4849    #[serde(rename = "Id")]
4850    pub id: String,
4851    #[serde(rename = "Issr")]
4852    pub issr: String,
4853    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4854    pub schme_nm: Option<String>,
4855}
4856
4857impl Validate for GenericIdentification30 {
4858    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4859        helpers::validate_pattern(
4860            &self.id,
4861            "Id",
4862            "[a-zA-Z0-9]{4}",
4863            &helpers::child_path(path, "Id"),
4864            config,
4865            collector,
4866        );
4867        helpers::validate_length(
4868            &self.issr,
4869            "Issr",
4870            Some(1),
4871            Some(35),
4872            &helpers::child_path(path, "Issr"),
4873            config,
4874            collector,
4875        );
4876        if let Some(ref val) = self.schme_nm {
4877            helpers::validate_length(
4878                val,
4879                "SchmeNm",
4880                Some(1),
4881                Some(35),
4882                &helpers::child_path(path, "SchmeNm"),
4883                config,
4884                collector,
4885            );
4886        }
4887    }
4888}
4889
4890// GenericIdentification301: Short textual description of the scheme.
4891#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4892pub struct GenericIdentification301 {
4893    #[serde(rename = "Id")]
4894    pub id: String,
4895    #[serde(rename = "Issr")]
4896    pub issr: String,
4897    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4898    pub schme_nm: Option<String>,
4899}
4900
4901impl Validate for GenericIdentification301 {
4902    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4903        helpers::validate_pattern(
4904            &self.id,
4905            "Id",
4906            "[a-zA-Z0-9]{4}",
4907            &helpers::child_path(path, "Id"),
4908            config,
4909            collector,
4910        );
4911        helpers::validate_length(
4912            &self.issr,
4913            "Issr",
4914            Some(1),
4915            Some(35),
4916            &helpers::child_path(path, "Issr"),
4917            config,
4918            collector,
4919        );
4920        helpers::validate_pattern(
4921            &self.issr,
4922            "Issr",
4923            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4924            &helpers::child_path(path, "Issr"),
4925            config,
4926            collector,
4927        );
4928        if let Some(ref val) = self.schme_nm {
4929            helpers::validate_length(
4930                val,
4931                "SchmeNm",
4932                Some(1),
4933                Some(35),
4934                &helpers::child_path(path, "SchmeNm"),
4935                config,
4936                collector,
4937            );
4938        }
4939        if let Some(ref val) = self.schme_nm {
4940            helpers::validate_pattern(
4941                val,
4942                "SchmeNm",
4943                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4944                &helpers::child_path(path, "SchmeNm"),
4945                config,
4946                collector,
4947            );
4948        }
4949    }
4950}
4951
4952// GenericIdentification302: Short textual description of the scheme.
4953#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4954pub struct GenericIdentification302 {
4955    #[serde(rename = "Id")]
4956    pub id: String,
4957    #[serde(rename = "Issr")]
4958    pub issr: String,
4959    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4960    pub schme_nm: Option<String>,
4961}
4962
4963impl Validate for GenericIdentification302 {
4964    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
4965        helpers::validate_pattern(
4966            &self.id,
4967            "Id",
4968            "[a-zA-Z0-9]{4}",
4969            &helpers::child_path(path, "Id"),
4970            config,
4971            collector,
4972        );
4973        helpers::validate_length(
4974            &self.issr,
4975            "Issr",
4976            Some(1),
4977            Some(35),
4978            &helpers::child_path(path, "Issr"),
4979            config,
4980            collector,
4981        );
4982        helpers::validate_pattern(
4983            &self.issr,
4984            "Issr",
4985            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
4986            &helpers::child_path(path, "Issr"),
4987            config,
4988            collector,
4989        );
4990        if let Some(ref val) = self.schme_nm {
4991            helpers::validate_length(
4992                val,
4993                "SchmeNm",
4994                Some(1),
4995                Some(35),
4996                &helpers::child_path(path, "SchmeNm"),
4997                config,
4998                collector,
4999            );
5000        }
5001        if let Some(ref val) = self.schme_nm {
5002            helpers::validate_pattern(
5003                val,
5004                "SchmeNm",
5005                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5006                &helpers::child_path(path, "SchmeNm"),
5007                config,
5008                collector,
5009            );
5010        }
5011    }
5012}
5013
5014// GenericIdentification321: Name of the entity.
5015#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5016pub struct GenericIdentification321 {
5017    #[serde(rename = "Id")]
5018    pub id: String,
5019    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5020    pub tp: Option<PartyType3Code>,
5021    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5022    pub issr: Option<PartyType4Code>,
5023    #[serde(rename = "ShrtNm", skip_serializing_if = "Option::is_none")]
5024    pub shrt_nm: Option<String>,
5025}
5026
5027impl Validate for GenericIdentification321 {
5028    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5029        helpers::validate_length(
5030            &self.id,
5031            "Id",
5032            Some(1),
5033            Some(35),
5034            &helpers::child_path(path, "Id"),
5035            config,
5036            collector,
5037        );
5038        helpers::validate_pattern(
5039            &self.id,
5040            "Id",
5041            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5042            &helpers::child_path(path, "Id"),
5043            config,
5044            collector,
5045        );
5046        if let Some(ref val) = self.tp
5047            && config.validate_optional_fields
5048        {
5049            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5050        }
5051        if let Some(ref val) = self.issr
5052            && config.validate_optional_fields
5053        {
5054            val.validate(&helpers::child_path(path, "Issr"), config, collector);
5055        }
5056        if let Some(ref val) = self.shrt_nm {
5057            helpers::validate_length(
5058                val,
5059                "ShrtNm",
5060                Some(1),
5061                Some(35),
5062                &helpers::child_path(path, "ShrtNm"),
5063                config,
5064                collector,
5065            );
5066        }
5067        if let Some(ref val) = self.shrt_nm {
5068            helpers::validate_pattern(
5069                val,
5070                "ShrtNm",
5071                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5072                &helpers::child_path(path, "ShrtNm"),
5073                config,
5074                collector,
5075            );
5076        }
5077    }
5078}
5079
5080// GenericIdentification31: Entity that assigns the identification.
5081#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5082pub struct GenericIdentification31 {
5083    #[serde(rename = "Id")]
5084    pub id: String,
5085    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5086    pub issr: Option<String>,
5087}
5088
5089impl Validate for GenericIdentification31 {
5090    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5091        helpers::validate_length(
5092            &self.id,
5093            "Id",
5094            Some(1),
5095            Some(35),
5096            &helpers::child_path(path, "Id"),
5097            config,
5098            collector,
5099        );
5100        helpers::validate_pattern(
5101            &self.id,
5102            "Id",
5103            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5104            &helpers::child_path(path, "Id"),
5105            config,
5106            collector,
5107        );
5108        if let Some(ref val) = self.issr {
5109            helpers::validate_length(
5110                val,
5111                "Issr",
5112                Some(1),
5113                Some(35),
5114                &helpers::child_path(path, "Issr"),
5115                config,
5116                collector,
5117            );
5118        }
5119        if let Some(ref val) = self.issr {
5120            helpers::validate_pattern(
5121                val,
5122                "Issr",
5123                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5124                &helpers::child_path(path, "Issr"),
5125                config,
5126                collector,
5127            );
5128        }
5129    }
5130}
5131
5132// GenericOrganisationIdentification11: Entity that assigns the identification.
5133#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5134pub struct GenericOrganisationIdentification11 {
5135    #[serde(rename = "Id")]
5136    pub id: String,
5137    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5138    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
5139    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5140    pub issr: Option<String>,
5141}
5142
5143impl Validate for GenericOrganisationIdentification11 {
5144    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5145        helpers::validate_length(
5146            &self.id,
5147            "Id",
5148            Some(1),
5149            Some(35),
5150            &helpers::child_path(path, "Id"),
5151            config,
5152            collector,
5153        );
5154        helpers::validate_pattern(
5155            &self.id,
5156            "Id",
5157            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5158            &helpers::child_path(path, "Id"),
5159            config,
5160            collector,
5161        );
5162        if let Some(ref val) = self.schme_nm
5163            && config.validate_optional_fields
5164        {
5165            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5166        }
5167        if let Some(ref val) = self.issr {
5168            helpers::validate_length(
5169                val,
5170                "Issr",
5171                Some(1),
5172                Some(35),
5173                &helpers::child_path(path, "Issr"),
5174                config,
5175                collector,
5176            );
5177        }
5178        if let Some(ref val) = self.issr {
5179            helpers::validate_pattern(
5180                val,
5181                "Issr",
5182                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5183                &helpers::child_path(path, "Issr"),
5184                config,
5185                collector,
5186            );
5187        }
5188    }
5189}
5190
5191// GenericOrganisationIdentification12: Entity that assigns the identification.
5192#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5193pub struct GenericOrganisationIdentification12 {
5194    #[serde(rename = "Id")]
5195    pub id: String,
5196    #[serde(rename = "SchmeNm")]
5197    pub schme_nm: OrganisationIdentificationSchemeName1Choice1,
5198    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5199    pub issr: Option<String>,
5200}
5201
5202impl Validate for GenericOrganisationIdentification12 {
5203    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5204        helpers::validate_length(
5205            &self.id,
5206            "Id",
5207            Some(1),
5208            Some(35),
5209            &helpers::child_path(path, "Id"),
5210            config,
5211            collector,
5212        );
5213        helpers::validate_pattern(
5214            &self.id,
5215            "Id",
5216            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5217            &helpers::child_path(path, "Id"),
5218            config,
5219            collector,
5220        );
5221        self.schme_nm
5222            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5223        if let Some(ref val) = self.issr {
5224            helpers::validate_length(
5225                val,
5226                "Issr",
5227                Some(1),
5228                Some(35),
5229                &helpers::child_path(path, "Issr"),
5230                config,
5231                collector,
5232            );
5233        }
5234        if let Some(ref val) = self.issr {
5235            helpers::validate_pattern(
5236                val,
5237                "Issr",
5238                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5239                &helpers::child_path(path, "Issr"),
5240                config,
5241                collector,
5242            );
5243        }
5244    }
5245}
5246
5247// GenericOrganisationIdentification13: Entity that assigns the identification.
5248#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5249pub struct GenericOrganisationIdentification13 {
5250    #[serde(rename = "Id")]
5251    pub id: String,
5252    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5253    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice2>,
5254    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5255    pub issr: Option<String>,
5256}
5257
5258impl Validate for GenericOrganisationIdentification13 {
5259    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5260        helpers::validate_length(
5261            &self.id,
5262            "Id",
5263            Some(1),
5264            Some(35),
5265            &helpers::child_path(path, "Id"),
5266            config,
5267            collector,
5268        );
5269        helpers::validate_pattern(
5270            &self.id,
5271            "Id",
5272            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5273            &helpers::child_path(path, "Id"),
5274            config,
5275            collector,
5276        );
5277        if let Some(ref val) = self.schme_nm
5278            && config.validate_optional_fields
5279        {
5280            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5281        }
5282        if let Some(ref val) = self.issr {
5283            helpers::validate_length(
5284                val,
5285                "Issr",
5286                Some(1),
5287                Some(35),
5288                &helpers::child_path(path, "Issr"),
5289                config,
5290                collector,
5291            );
5292        }
5293        if let Some(ref val) = self.issr {
5294            helpers::validate_pattern(
5295                val,
5296                "Issr",
5297                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5298                &helpers::child_path(path, "Issr"),
5299                config,
5300                collector,
5301            );
5302        }
5303    }
5304}
5305
5306// GenericPersonIdentification11: Entity that assigns the identification.
5307#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5308pub struct GenericPersonIdentification11 {
5309    #[serde(rename = "Id")]
5310    pub id: String,
5311    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5312    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
5313    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5314    pub issr: Option<String>,
5315}
5316
5317impl Validate for GenericPersonIdentification11 {
5318    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5319        helpers::validate_length(
5320            &self.id,
5321            "Id",
5322            Some(1),
5323            Some(35),
5324            &helpers::child_path(path, "Id"),
5325            config,
5326            collector,
5327        );
5328        helpers::validate_pattern(
5329            &self.id,
5330            "Id",
5331            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5332            &helpers::child_path(path, "Id"),
5333            config,
5334            collector,
5335        );
5336        if let Some(ref val) = self.schme_nm
5337            && config.validate_optional_fields
5338        {
5339            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5340        }
5341        if let Some(ref val) = self.issr {
5342            helpers::validate_length(
5343                val,
5344                "Issr",
5345                Some(1),
5346                Some(35),
5347                &helpers::child_path(path, "Issr"),
5348                config,
5349                collector,
5350            );
5351        }
5352        if let Some(ref val) = self.issr {
5353            helpers::validate_pattern(
5354                val,
5355                "Issr",
5356                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5357                &helpers::child_path(path, "Issr"),
5358                config,
5359                collector,
5360            );
5361        }
5362    }
5363}
5364
5365// GenericPersonIdentification12: Entity that assigns the identification.
5366#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5367pub struct GenericPersonIdentification12 {
5368    #[serde(rename = "Id")]
5369    pub id: String,
5370    #[serde(rename = "SchmeNm")]
5371    pub schme_nm: PersonIdentificationSchemeName1Choice1,
5372    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5373    pub issr: Option<String>,
5374}
5375
5376impl Validate for GenericPersonIdentification12 {
5377    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5378        helpers::validate_length(
5379            &self.id,
5380            "Id",
5381            Some(1),
5382            Some(35),
5383            &helpers::child_path(path, "Id"),
5384            config,
5385            collector,
5386        );
5387        helpers::validate_pattern(
5388            &self.id,
5389            "Id",
5390            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5391            &helpers::child_path(path, "Id"),
5392            config,
5393            collector,
5394        );
5395        self.schme_nm
5396            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5397        if let Some(ref val) = self.issr {
5398            helpers::validate_length(
5399                val,
5400                "Issr",
5401                Some(1),
5402                Some(35),
5403                &helpers::child_path(path, "Issr"),
5404                config,
5405                collector,
5406            );
5407        }
5408        if let Some(ref val) = self.issr {
5409            helpers::validate_pattern(
5410                val,
5411                "Issr",
5412                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5413                &helpers::child_path(path, "Issr"),
5414                config,
5415                collector,
5416            );
5417        }
5418    }
5419}
5420
5421// GenericPersonIdentification13: Entity that assigns the identification.
5422#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5423pub struct GenericPersonIdentification13 {
5424    #[serde(rename = "Id")]
5425    pub id: String,
5426    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5427    pub schme_nm: Option<PersonIdentificationSchemeName1Choice2>,
5428    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5429    pub issr: Option<String>,
5430}
5431
5432impl Validate for GenericPersonIdentification13 {
5433    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5434        helpers::validate_length(
5435            &self.id,
5436            "Id",
5437            Some(1),
5438            Some(35),
5439            &helpers::child_path(path, "Id"),
5440            config,
5441            collector,
5442        );
5443        helpers::validate_pattern(
5444            &self.id,
5445            "Id",
5446            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5447            &helpers::child_path(path, "Id"),
5448            config,
5449            collector,
5450        );
5451        if let Some(ref val) = self.schme_nm
5452            && config.validate_optional_fields
5453        {
5454            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
5455        }
5456        if let Some(ref val) = self.issr {
5457            helpers::validate_length(
5458                val,
5459                "Issr",
5460                Some(1),
5461                Some(35),
5462                &helpers::child_path(path, "Issr"),
5463                config,
5464                collector,
5465            );
5466        }
5467        if let Some(ref val) = self.issr {
5468            helpers::validate_pattern(
5469                val,
5470                "Issr",
5471                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5472                &helpers::child_path(path, "Issr"),
5473                config,
5474                collector,
5475            );
5476        }
5477    }
5478}
5479
5480// GroupHeader811: Further details of the message.
5481#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5482pub struct GroupHeader811 {
5483    #[serde(rename = "MsgId")]
5484    pub msg_id: String,
5485    #[serde(rename = "CreDtTm")]
5486    pub cre_dt_tm: String,
5487    #[serde(rename = "MsgRcpt", skip_serializing_if = "Option::is_none")]
5488    pub msg_rcpt: Option<PartyIdentification1351>,
5489    #[serde(rename = "OrgnlBizQry", skip_serializing_if = "Option::is_none")]
5490    pub orgnl_biz_qry: Option<OriginalBusinessQuery11>,
5491    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
5492    pub addtl_inf: Option<String>,
5493}
5494
5495impl Validate for GroupHeader811 {
5496    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5497        helpers::validate_length(
5498            &self.msg_id,
5499            "MsgId",
5500            Some(1),
5501            Some(35),
5502            &helpers::child_path(path, "MsgId"),
5503            config,
5504            collector,
5505        );
5506        helpers::validate_pattern(
5507            &self.msg_id,
5508            "MsgId",
5509            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5510            &helpers::child_path(path, "MsgId"),
5511            config,
5512            collector,
5513        );
5514        helpers::validate_pattern(
5515            &self.cre_dt_tm,
5516            "CreDtTm",
5517            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
5518            &helpers::child_path(path, "CreDtTm"),
5519            config,
5520            collector,
5521        );
5522        if let Some(ref val) = self.msg_rcpt
5523            && config.validate_optional_fields
5524        {
5525            val.validate(&helpers::child_path(path, "MsgRcpt"), config, collector);
5526        }
5527        if let Some(ref val) = self.orgnl_biz_qry
5528            && config.validate_optional_fields
5529        {
5530            val.validate(&helpers::child_path(path, "OrgnlBizQry"), config, collector);
5531        }
5532        if let Some(ref val) = self.addtl_inf {
5533            helpers::validate_length(
5534                val,
5535                "AddtlInf",
5536                Some(1),
5537                Some(500),
5538                &helpers::child_path(path, "AddtlInf"),
5539                config,
5540                collector,
5541            );
5542        }
5543        if let Some(ref val) = self.addtl_inf {
5544            helpers::validate_pattern(
5545                val,
5546                "AddtlInf",
5547                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5548                &helpers::child_path(path, "AddtlInf"),
5549                config,
5550                collector,
5551            );
5552        }
5553    }
5554}
5555
5556// IdentificationSource3Choice1: Unique and unambiguous identification source using a proprietary identification scheme.
5557#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5558pub struct IdentificationSource3Choice1 {
5559    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5560    pub cd: Option<String>,
5561    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5562    pub prtry: Option<String>,
5563}
5564
5565impl Validate for IdentificationSource3Choice1 {
5566    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5567        if let Some(ref val) = self.cd {
5568            helpers::validate_length(
5569                val,
5570                "Cd",
5571                Some(1),
5572                Some(4),
5573                &helpers::child_path(path, "Cd"),
5574                config,
5575                collector,
5576            );
5577        }
5578        if let Some(ref val) = self.prtry {
5579            helpers::validate_length(
5580                val,
5581                "Prtry",
5582                Some(1),
5583                Some(35),
5584                &helpers::child_path(path, "Prtry"),
5585                config,
5586                collector,
5587            );
5588        }
5589        if let Some(ref val) = self.prtry {
5590            helpers::validate_pattern(
5591                val,
5592                "Prtry",
5593                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5594                &helpers::child_path(path, "Prtry"),
5595                config,
5596                collector,
5597            );
5598        }
5599    }
5600}
5601
5602// ImpliedCurrencyAmountRange1Choice: Value that an amount must not match to be considered valid.
5603#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5604pub struct ImpliedCurrencyAmountRange1Choice {
5605    #[serde(rename = "FrAmt", skip_serializing_if = "Option::is_none")]
5606    pub fr_amt: Option<AmountRangeBoundary1>,
5607    #[serde(rename = "ToAmt", skip_serializing_if = "Option::is_none")]
5608    pub to_amt: Option<AmountRangeBoundary1>,
5609    #[serde(rename = "FrToAmt", skip_serializing_if = "Option::is_none")]
5610    pub fr_to_amt: Option<FromToAmountRange1>,
5611    #[serde(rename = "EQAmt", skip_serializing_if = "Option::is_none")]
5612    pub eq_amt: Option<f64>,
5613    #[serde(rename = "NEQAmt", skip_serializing_if = "Option::is_none")]
5614    pub neq_amt: Option<f64>,
5615}
5616
5617impl Validate for ImpliedCurrencyAmountRange1Choice {
5618    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5619        if let Some(ref val) = self.fr_amt
5620            && config.validate_optional_fields
5621        {
5622            val.validate(&helpers::child_path(path, "FrAmt"), config, collector);
5623        }
5624        if let Some(ref val) = self.to_amt
5625            && config.validate_optional_fields
5626        {
5627            val.validate(&helpers::child_path(path, "ToAmt"), config, collector);
5628        }
5629        if let Some(ref val) = self.fr_to_amt
5630            && config.validate_optional_fields
5631        {
5632            val.validate(&helpers::child_path(path, "FrToAmt"), config, collector);
5633        }
5634    }
5635}
5636
5637// InterestRecord21: Provides details on the tax applied to charges.
5638#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5639pub struct InterestRecord21 {
5640    #[serde(rename = "Amt")]
5641    pub amt: ActiveOrHistoricCurrencyAndAmount,
5642    #[serde(rename = "CdtDbtInd")]
5643    pub cdt_dbt_ind: CreditDebitCode,
5644    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5645    pub tp: Option<InterestType1Choice1>,
5646    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
5647    pub rate: Option<Rate41>,
5648    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5649    pub fr_to_dt: Option<DateTimePeriod11>,
5650    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
5651    pub rsn: Option<String>,
5652    #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
5653    pub tax: Option<TaxCharges21>,
5654}
5655
5656impl Validate for InterestRecord21 {
5657    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5658        self.amt
5659            .validate(&helpers::child_path(path, "Amt"), config, collector);
5660        self.cdt_dbt_ind
5661            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
5662        if let Some(ref val) = self.tp
5663            && config.validate_optional_fields
5664        {
5665            val.validate(&helpers::child_path(path, "Tp"), config, collector);
5666        }
5667        if let Some(ref val) = self.rate
5668            && config.validate_optional_fields
5669        {
5670            val.validate(&helpers::child_path(path, "Rate"), config, collector);
5671        }
5672        if let Some(ref val) = self.fr_to_dt
5673            && config.validate_optional_fields
5674        {
5675            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
5676        }
5677        if let Some(ref val) = self.rsn {
5678            helpers::validate_length(
5679                val,
5680                "Rsn",
5681                Some(1),
5682                Some(35),
5683                &helpers::child_path(path, "Rsn"),
5684                config,
5685                collector,
5686            );
5687        }
5688        if let Some(ref val) = self.rsn {
5689            helpers::validate_pattern(
5690                val,
5691                "Rsn",
5692                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5693                &helpers::child_path(path, "Rsn"),
5694                config,
5695                collector,
5696            );
5697        }
5698        if let Some(ref val) = self.tax
5699            && config.validate_optional_fields
5700        {
5701            val.validate(&helpers::child_path(path, "Tax"), config, collector);
5702        }
5703    }
5704}
5705
5706// InterestType1Choice1: Specifies the type of interest in uncoded form.
5707#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5708pub struct InterestType1Choice1 {
5709    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5710    pub cd: Option<InterestType1Code>,
5711    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5712    pub prtry: Option<String>,
5713}
5714
5715impl Validate for InterestType1Choice1 {
5716    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5717        if let Some(ref val) = self.cd
5718            && config.validate_optional_fields
5719        {
5720            val.validate(&helpers::child_path(path, "Cd"), config, collector);
5721        }
5722        if let Some(ref val) = self.prtry {
5723            helpers::validate_length(
5724                val,
5725                "Prtry",
5726                Some(1),
5727                Some(35),
5728                &helpers::child_path(path, "Prtry"),
5729                config,
5730                collector,
5731            );
5732        }
5733        if let Some(ref val) = self.prtry {
5734            helpers::validate_pattern(
5735                val,
5736                "Prtry",
5737                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5738                &helpers::child_path(path, "Prtry"),
5739                config,
5740                collector,
5741            );
5742        }
5743    }
5744}
5745
5746// InterestType1Code: Period of time between the end of a business day and the start of the next business day (usually the day after).
5747#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5748pub enum InterestType1Code {
5749    #[default]
5750    #[serde(rename = "INDY")]
5751    CodeINDY,
5752    #[serde(rename = "OVRN")]
5753    CodeOVRN,
5754}
5755
5756impl Validate for InterestType1Code {
5757    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5758        // Enum validation is typically empty
5759    }
5760}
5761
5762// LocalInstrument2Choice1: Specifies the local instrument, as a proprietary code.
5763#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5764pub struct LocalInstrument2Choice1 {
5765    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5766    pub cd: Option<String>,
5767    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5768    pub prtry: Option<String>,
5769}
5770
5771impl Validate for LocalInstrument2Choice1 {
5772    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5773        if let Some(ref val) = self.cd {
5774            helpers::validate_length(
5775                val,
5776                "Cd",
5777                Some(1),
5778                Some(35),
5779                &helpers::child_path(path, "Cd"),
5780                config,
5781                collector,
5782            );
5783        }
5784        if let Some(ref val) = self.prtry {
5785            helpers::validate_length(
5786                val,
5787                "Prtry",
5788                Some(1),
5789                Some(35),
5790                &helpers::child_path(path, "Prtry"),
5791                config,
5792                collector,
5793            );
5794        }
5795        if let Some(ref val) = self.prtry {
5796            helpers::validate_pattern(
5797                val,
5798                "Prtry",
5799                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5800                &helpers::child_path(path, "Prtry"),
5801                config,
5802                collector,
5803            );
5804        }
5805    }
5806}
5807
5808// MessageIdentification21: Specifies the identification of the message that will be used to provide additional details.
5809#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5810pub struct MessageIdentification21 {
5811    #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5812    pub msg_nm_id: Option<String>,
5813    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
5814    pub msg_id: Option<String>,
5815}
5816
5817impl Validate for MessageIdentification21 {
5818    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5819        if let Some(ref val) = self.msg_nm_id {
5820            helpers::validate_length(
5821                val,
5822                "MsgNmId",
5823                Some(1),
5824                Some(35),
5825                &helpers::child_path(path, "MsgNmId"),
5826                config,
5827                collector,
5828            );
5829        }
5830        if let Some(ref val) = self.msg_nm_id {
5831            helpers::validate_pattern(
5832                val,
5833                "MsgNmId",
5834                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5835                &helpers::child_path(path, "MsgNmId"),
5836                config,
5837                collector,
5838            );
5839        }
5840        if let Some(ref val) = self.msg_id {
5841            helpers::validate_length(
5842                val,
5843                "MsgId",
5844                Some(1),
5845                Some(35),
5846                &helpers::child_path(path, "MsgId"),
5847                config,
5848                collector,
5849            );
5850        }
5851        if let Some(ref val) = self.msg_id {
5852            helpers::validate_pattern(
5853                val,
5854                "MsgId",
5855                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
5856                &helpers::child_path(path, "MsgId"),
5857                config,
5858                collector,
5859            );
5860        }
5861    }
5862}
5863
5864// NameAndAddress161: Postal address of a party.
5865#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5866pub struct NameAndAddress161 {
5867    #[serde(rename = "Nm")]
5868    pub nm: String,
5869    #[serde(rename = "Adr")]
5870    pub adr: PostalAddress241,
5871}
5872
5873impl Validate for NameAndAddress161 {
5874    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5875        helpers::validate_length(
5876            &self.nm,
5877            "Nm",
5878            Some(1),
5879            Some(140),
5880            &helpers::child_path(path, "Nm"),
5881            config,
5882            collector,
5883        );
5884        helpers::validate_pattern(
5885            &self.nm,
5886            "Nm",
5887            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5888            &helpers::child_path(path, "Nm"),
5889            config,
5890            collector,
5891        );
5892        self.adr
5893            .validate(&helpers::child_path(path, "Adr"), config, collector);
5894    }
5895}
5896
5897// NumberAndSumOfTransactions1: Total of all individual entries included in the report.
5898#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5899pub struct NumberAndSumOfTransactions1 {
5900    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5901    pub nb_of_ntries: Option<String>,
5902    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5903    pub sum: Option<f64>,
5904}
5905
5906impl Validate for NumberAndSumOfTransactions1 {
5907    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5908        if let Some(ref val) = self.nb_of_ntries {
5909            helpers::validate_pattern(
5910                val,
5911                "NbOfNtries",
5912                "[0-9]{1,15}",
5913                &helpers::child_path(path, "NbOfNtries"),
5914                config,
5915                collector,
5916            );
5917        }
5918    }
5919}
5920
5921// NumberAndSumOfTransactions4: Resulting debit or credit amount of the netted amounts for all debit and credit entries.
5922#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5923pub struct NumberAndSumOfTransactions4 {
5924    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5925    pub nb_of_ntries: Option<String>,
5926    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5927    pub sum: Option<f64>,
5928    #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
5929    pub ttl_net_ntry: Option<AmountAndDirection35>,
5930}
5931
5932impl Validate for NumberAndSumOfTransactions4 {
5933    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5934        if let Some(ref val) = self.nb_of_ntries {
5935            helpers::validate_pattern(
5936                val,
5937                "NbOfNtries",
5938                "[0-9]{1,15}",
5939                &helpers::child_path(path, "NbOfNtries"),
5940                config,
5941                collector,
5942            );
5943        }
5944        if let Some(ref val) = self.ttl_net_ntry
5945            && config.validate_optional_fields
5946        {
5947            val.validate(&helpers::child_path(path, "TtlNetNtry"), config, collector);
5948        }
5949    }
5950}
5951
5952// OnLineCapability1Code: Off-line capable with possible on-line requests to the acquirer.
5953#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5954pub enum OnLineCapability1Code {
5955    #[default]
5956    #[serde(rename = "OFLN")]
5957    CodeOFLN,
5958    #[serde(rename = "ONLN")]
5959    CodeONLN,
5960    #[serde(rename = "SMON")]
5961    CodeSMON,
5962}
5963
5964impl Validate for OnLineCapability1Code {
5965    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
5966        // Enum validation is typically empty
5967    }
5968}
5969
5970// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
5971#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5972pub struct OrganisationIdentification291 {
5973    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5974    pub any_bic: Option<String>,
5975    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5976    pub lei: Option<String>,
5977    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5978    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
5979}
5980
5981impl Validate for OrganisationIdentification291 {
5982    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
5983        if let Some(ref val) = self.any_bic {
5984            helpers::validate_pattern(
5985                val,
5986                "AnyBIC",
5987                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
5988                &helpers::child_path(path, "AnyBIC"),
5989                config,
5990                collector,
5991            );
5992        }
5993        if let Some(ref val) = self.lei {
5994            helpers::validate_pattern(
5995                val,
5996                "LEI",
5997                "[A-Z0-9]{18,18}[0-9]{2,2}",
5998                &helpers::child_path(path, "LEI"),
5999                config,
6000                collector,
6001            );
6002        }
6003        if let Some(ref vec) = self.othr
6004            && config.validate_optional_fields
6005        {
6006            for item in vec {
6007                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6008            }
6009        }
6010    }
6011}
6012
6013// OrganisationIdentification292: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
6014#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6015pub struct OrganisationIdentification292 {
6016    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
6017    pub any_bic: Option<String>,
6018    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
6019    pub lei: Option<String>,
6020    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6021    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
6022}
6023
6024impl Validate for OrganisationIdentification292 {
6025    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6026        if let Some(ref val) = self.any_bic {
6027            helpers::validate_pattern(
6028                val,
6029                "AnyBIC",
6030                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
6031                &helpers::child_path(path, "AnyBIC"),
6032                config,
6033                collector,
6034            );
6035        }
6036        if let Some(ref val) = self.lei {
6037            helpers::validate_pattern(
6038                val,
6039                "LEI",
6040                "[A-Z0-9]{18,18}[0-9]{2,2}",
6041                &helpers::child_path(path, "LEI"),
6042                config,
6043                collector,
6044            );
6045        }
6046        if let Some(ref vec) = self.othr
6047            && config.validate_optional_fields
6048        {
6049            for item in vec {
6050                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6051            }
6052        }
6053    }
6054}
6055
6056// OrganisationIdentification293: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
6057#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6058pub struct OrganisationIdentification293 {
6059    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
6060    pub any_bic: Option<String>,
6061    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
6062    pub lei: Option<String>,
6063    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6064    pub othr: Option<Vec<GenericOrganisationIdentification12>>,
6065}
6066
6067impl Validate for OrganisationIdentification293 {
6068    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6069        if let Some(ref val) = self.any_bic {
6070            helpers::validate_pattern(
6071                val,
6072                "AnyBIC",
6073                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
6074                &helpers::child_path(path, "AnyBIC"),
6075                config,
6076                collector,
6077            );
6078        }
6079        if let Some(ref val) = self.lei {
6080            helpers::validate_pattern(
6081                val,
6082                "LEI",
6083                "[A-Z0-9]{18,18}[0-9]{2,2}",
6084                &helpers::child_path(path, "LEI"),
6085                config,
6086                collector,
6087            );
6088        }
6089        if let Some(ref vec) = self.othr
6090            && config.validate_optional_fields
6091        {
6092            for item in vec {
6093                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6094            }
6095        }
6096    }
6097}
6098
6099// OrganisationIdentification294: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
6100#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6101pub struct OrganisationIdentification294 {
6102    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
6103    pub any_bic: Option<String>,
6104    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
6105    pub lei: Option<String>,
6106    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6107    pub othr: Option<Vec<GenericOrganisationIdentification13>>,
6108}
6109
6110impl Validate for OrganisationIdentification294 {
6111    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6112        if let Some(ref val) = self.any_bic {
6113            helpers::validate_pattern(
6114                val,
6115                "AnyBIC",
6116                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
6117                &helpers::child_path(path, "AnyBIC"),
6118                config,
6119                collector,
6120            );
6121        }
6122        if let Some(ref val) = self.lei {
6123            helpers::validate_pattern(
6124                val,
6125                "LEI",
6126                "[A-Z0-9]{18,18}[0-9]{2,2}",
6127                &helpers::child_path(path, "LEI"),
6128                config,
6129                collector,
6130            );
6131        }
6132        if let Some(ref vec) = self.othr
6133            && config.validate_optional_fields
6134        {
6135            for item in vec {
6136                item.validate(&helpers::child_path(path, "Othr"), config, collector);
6137            }
6138        }
6139    }
6140}
6141
6142// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
6143#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6144pub struct OrganisationIdentificationSchemeName1Choice1 {
6145    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6146    pub cd: Option<String>,
6147    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6148    pub prtry: Option<String>,
6149}
6150
6151impl Validate for OrganisationIdentificationSchemeName1Choice1 {
6152    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6153        if let Some(ref val) = self.cd {
6154            helpers::validate_length(
6155                val,
6156                "Cd",
6157                Some(1),
6158                Some(4),
6159                &helpers::child_path(path, "Cd"),
6160                config,
6161                collector,
6162            );
6163        }
6164        if let Some(ref val) = self.prtry {
6165            helpers::validate_length(
6166                val,
6167                "Prtry",
6168                Some(1),
6169                Some(35),
6170                &helpers::child_path(path, "Prtry"),
6171                config,
6172                collector,
6173            );
6174        }
6175        if let Some(ref val) = self.prtry {
6176            helpers::validate_pattern(
6177                val,
6178                "Prtry",
6179                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6180                &helpers::child_path(path, "Prtry"),
6181                config,
6182                collector,
6183            );
6184        }
6185    }
6186}
6187
6188// OrganisationIdentificationSchemeName1Choice2: Name of the identification scheme, in a free text form.
6189#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6190pub struct OrganisationIdentificationSchemeName1Choice2 {
6191    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6192    pub cd: Option<String>,
6193    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6194    pub prtry: Option<String>,
6195}
6196
6197impl Validate for OrganisationIdentificationSchemeName1Choice2 {
6198    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6199        if let Some(ref val) = self.cd {
6200            helpers::validate_length(
6201                val,
6202                "Cd",
6203                Some(1),
6204                Some(4),
6205                &helpers::child_path(path, "Cd"),
6206                config,
6207                collector,
6208            );
6209        }
6210        if let Some(ref val) = self.prtry {
6211            helpers::validate_length(
6212                val,
6213                "Prtry",
6214                Some(1),
6215                Some(35),
6216                &helpers::child_path(path, "Prtry"),
6217                config,
6218                collector,
6219            );
6220        }
6221        if let Some(ref val) = self.prtry {
6222            helpers::validate_pattern(
6223                val,
6224                "Prtry",
6225                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6226                &helpers::child_path(path, "Prtry"),
6227                config,
6228                collector,
6229            );
6230        }
6231    }
6232}
6233
6234// 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.
6235#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6236pub struct OriginalAndCurrentQuantities1 {
6237    #[serde(rename = "FaceAmt")]
6238    pub face_amt: f64,
6239    #[serde(rename = "AmtsdVal")]
6240    pub amtsd_val: f64,
6241}
6242
6243impl Validate for OriginalAndCurrentQuantities1 {
6244    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
6245}
6246
6247// OriginalBusinessQuery11: Date and time at which the message was created.
6248#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6249pub struct OriginalBusinessQuery11 {
6250    #[serde(rename = "MsgId")]
6251    pub msg_id: String,
6252    #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
6253    pub msg_nm_id: Option<String>,
6254    #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
6255    pub cre_dt_tm: Option<String>,
6256}
6257
6258impl Validate for OriginalBusinessQuery11 {
6259    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6260        helpers::validate_length(
6261            &self.msg_id,
6262            "MsgId",
6263            Some(1),
6264            Some(35),
6265            &helpers::child_path(path, "MsgId"),
6266            config,
6267            collector,
6268        );
6269        helpers::validate_pattern(
6270            &self.msg_id,
6271            "MsgId",
6272            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6273            &helpers::child_path(path, "MsgId"),
6274            config,
6275            collector,
6276        );
6277        if let Some(ref val) = self.msg_nm_id {
6278            helpers::validate_length(
6279                val,
6280                "MsgNmId",
6281                Some(1),
6282                Some(35),
6283                &helpers::child_path(path, "MsgNmId"),
6284                config,
6285                collector,
6286            );
6287        }
6288        if let Some(ref val) = self.msg_nm_id {
6289            helpers::validate_pattern(
6290                val,
6291                "MsgNmId",
6292                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6293                &helpers::child_path(path, "MsgNmId"),
6294                config,
6295                collector,
6296            );
6297        }
6298        if let Some(ref val) = self.cre_dt_tm {
6299            helpers::validate_pattern(
6300                val,
6301                "CreDtTm",
6302                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
6303                &helpers::child_path(path, "CreDtTm"),
6304                config,
6305                collector,
6306            );
6307        }
6308    }
6309}
6310
6311// OtherIdentification11: Type of the identification.
6312#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6313pub struct OtherIdentification11 {
6314    #[serde(rename = "Id")]
6315    pub id: String,
6316    #[serde(rename = "Sfx", skip_serializing_if = "Option::is_none")]
6317    pub sfx: Option<String>,
6318    #[serde(rename = "Tp")]
6319    pub tp: IdentificationSource3Choice1,
6320}
6321
6322impl Validate for OtherIdentification11 {
6323    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6324        helpers::validate_length(
6325            &self.id,
6326            "Id",
6327            Some(1),
6328            Some(35),
6329            &helpers::child_path(path, "Id"),
6330            config,
6331            collector,
6332        );
6333        helpers::validate_pattern(
6334            &self.id,
6335            "Id",
6336            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6337            &helpers::child_path(path, "Id"),
6338            config,
6339            collector,
6340        );
6341        if let Some(ref val) = self.sfx {
6342            helpers::validate_length(
6343                val,
6344                "Sfx",
6345                Some(1),
6346                Some(16),
6347                &helpers::child_path(path, "Sfx"),
6348                config,
6349                collector,
6350            );
6351        }
6352        if let Some(ref val) = self.sfx {
6353            helpers::validate_pattern(
6354                val,
6355                "Sfx",
6356                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6357                &helpers::child_path(path, "Sfx"),
6358                config,
6359                collector,
6360            );
6361        }
6362        self.tp
6363            .validate(&helpers::child_path(path, "Tp"), config, collector);
6364    }
6365}
6366
6367// POIComponentType1Code: Personal identification number (or PIN) entry device (PED).
6368#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6369pub enum POIComponentType1Code {
6370    #[default]
6371    #[serde(rename = "SOFT")]
6372    CodeSOFT,
6373    #[serde(rename = "EMVK")]
6374    CodeEMVK,
6375    #[serde(rename = "EMVO")]
6376    CodeEMVO,
6377    #[serde(rename = "MRIT")]
6378    CodeMRIT,
6379    #[serde(rename = "CHIT")]
6380    CodeCHIT,
6381    #[serde(rename = "SECM")]
6382    CodeSECM,
6383    #[serde(rename = "PEDV")]
6384    CodePEDV,
6385}
6386
6387impl Validate for POIComponentType1Code {
6388    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
6389        // Enum validation is typically empty
6390    }
6391}
6392
6393// Pagination1: Indicates the last page.
6394#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6395pub struct Pagination1 {
6396    #[serde(rename = "PgNb")]
6397    pub pg_nb: String,
6398    #[serde(rename = "LastPgInd")]
6399    pub last_pg_ind: bool,
6400}
6401
6402impl Validate for Pagination1 {
6403    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6404        helpers::validate_pattern(
6405            &self.pg_nb,
6406            "PgNb",
6407            "[0-9]{1,5}",
6408            &helpers::child_path(path, "PgNb"),
6409            config,
6410            collector,
6411        );
6412    }
6413}
6414
6415// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
6416#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6417pub struct Party38Choice1 {
6418    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6419    pub org_id: Option<OrganisationIdentification291>,
6420    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6421    pub prvt_id: Option<PersonIdentification131>,
6422}
6423
6424impl Validate for Party38Choice1 {
6425    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6426        if let Some(ref val) = self.org_id
6427            && config.validate_optional_fields
6428        {
6429            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
6430        }
6431        if let Some(ref val) = self.prvt_id
6432            && config.validate_optional_fields
6433        {
6434            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
6435        }
6436    }
6437}
6438
6439// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
6440#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6441pub struct Party38Choice2 {
6442    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6443    pub org_id: Option<OrganisationIdentification292>,
6444    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6445    pub prvt_id: Option<PersonIdentification132>,
6446}
6447
6448impl Validate for Party38Choice2 {
6449    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6450        if let Some(ref val) = self.org_id
6451            && config.validate_optional_fields
6452        {
6453            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
6454        }
6455        if let Some(ref val) = self.prvt_id
6456            && config.validate_optional_fields
6457        {
6458            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
6459        }
6460    }
6461}
6462
6463// Party38Choice3: Unique and unambiguous identification of a person, for example a passport.
6464#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6465pub struct Party38Choice3 {
6466    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6467    pub org_id: Option<OrganisationIdentification293>,
6468    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6469    pub prvt_id: Option<PersonIdentification133>,
6470}
6471
6472impl Validate for Party38Choice3 {
6473    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6474        if let Some(ref val) = self.org_id
6475            && config.validate_optional_fields
6476        {
6477            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
6478        }
6479        if let Some(ref val) = self.prvt_id
6480            && config.validate_optional_fields
6481        {
6482            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
6483        }
6484    }
6485}
6486
6487// Party38Choice4: Unique and unambiguous identification of a person, for example a passport.
6488#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6489pub struct Party38Choice4 {
6490    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6491    pub org_id: Option<OrganisationIdentification294>,
6492    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6493    pub prvt_id: Option<PersonIdentification134>,
6494}
6495
6496impl Validate for Party38Choice4 {
6497    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6498        if let Some(ref val) = self.org_id
6499            && config.validate_optional_fields
6500        {
6501            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
6502        }
6503        if let Some(ref val) = self.prvt_id
6504            && config.validate_optional_fields
6505        {
6506            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
6507        }
6508    }
6509}
6510
6511// Party40Choice1: Identification of a financial institution.
6512#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6513pub struct Party40Choice1 {
6514    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6515    pub pty: Option<PartyIdentification1353>,
6516    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6517    pub agt: Option<BranchAndFinancialInstitutionIdentification64>,
6518}
6519
6520impl Validate for Party40Choice1 {
6521    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6522        if let Some(ref val) = self.pty
6523            && config.validate_optional_fields
6524        {
6525            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6526        }
6527        if let Some(ref val) = self.agt
6528            && config.validate_optional_fields
6529        {
6530            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6531        }
6532    }
6533}
6534
6535// Party40Choice2: Identification of a financial institution.
6536#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6537pub struct Party40Choice2 {
6538    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6539    pub pty: Option<PartyIdentification1354>,
6540    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6541    pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6542}
6543
6544impl Validate for Party40Choice2 {
6545    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6546        if let Some(ref val) = self.pty
6547            && config.validate_optional_fields
6548        {
6549            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6550        }
6551        if let Some(ref val) = self.agt
6552            && config.validate_optional_fields
6553        {
6554            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6555        }
6556    }
6557}
6558
6559// Party40Choice3: Identification of a financial institution.
6560#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6561pub struct Party40Choice3 {
6562    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6563    pub pty: Option<PartyIdentification1355>,
6564    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6565    pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6566}
6567
6568impl Validate for Party40Choice3 {
6569    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6570        if let Some(ref val) = self.pty
6571            && config.validate_optional_fields
6572        {
6573            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6574        }
6575        if let Some(ref val) = self.agt
6576            && config.validate_optional_fields
6577        {
6578            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6579        }
6580    }
6581}
6582
6583// Party40Choice4: Identification of a financial institution.
6584#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6585pub struct Party40Choice4 {
6586    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6587    pub pty: Option<PartyIdentification1356>,
6588    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6589    pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6590}
6591
6592impl Validate for Party40Choice4 {
6593    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6594        if let Some(ref val) = self.pty
6595            && config.validate_optional_fields
6596        {
6597            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6598        }
6599        if let Some(ref val) = self.agt
6600            && config.validate_optional_fields
6601        {
6602            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6603        }
6604    }
6605}
6606
6607// Party40Choice5: Identification of a financial institution.
6608#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6609pub struct Party40Choice5 {
6610    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6611    pub pty: Option<PartyIdentification1357>,
6612    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6613    pub agt: Option<BranchAndFinancialInstitutionIdentification66>,
6614}
6615
6616impl Validate for Party40Choice5 {
6617    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6618        if let Some(ref val) = self.pty
6619            && config.validate_optional_fields
6620        {
6621            val.validate(&helpers::child_path(path, "Pty"), config, collector);
6622        }
6623        if let Some(ref val) = self.agt
6624            && config.validate_optional_fields
6625        {
6626            val.validate(&helpers::child_path(path, "Agt"), config, collector);
6627        }
6628    }
6629}
6630
6631// PartyIdentification1351: Set of elements used to indicate how to contact the party.
6632#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6633pub struct PartyIdentification1351 {
6634    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6635    pub nm: Option<String>,
6636    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6637    pub pstl_adr: Option<PostalAddress241>,
6638    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6639    pub id: Option<Party38Choice1>,
6640    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6641    pub ctct_dtls: Option<Contact41>,
6642}
6643
6644impl Validate for PartyIdentification1351 {
6645    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6646        if let Some(ref val) = self.nm {
6647            helpers::validate_length(
6648                val,
6649                "Nm",
6650                Some(1),
6651                Some(140),
6652                &helpers::child_path(path, "Nm"),
6653                config,
6654                collector,
6655            );
6656        }
6657        if let Some(ref val) = self.nm {
6658            helpers::validate_pattern(
6659                val,
6660                "Nm",
6661                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6662                &helpers::child_path(path, "Nm"),
6663                config,
6664                collector,
6665            );
6666        }
6667        if let Some(ref val) = self.pstl_adr
6668            && config.validate_optional_fields
6669        {
6670            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6671        }
6672        if let Some(ref val) = self.id
6673            && config.validate_optional_fields
6674        {
6675            val.validate(&helpers::child_path(path, "Id"), config, collector);
6676        }
6677        if let Some(ref val) = self.ctct_dtls
6678            && config.validate_optional_fields
6679        {
6680            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6681        }
6682    }
6683}
6684
6685// PartyIdentification13510: Set of elements used to indicate how to contact the party.
6686#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6687pub struct PartyIdentification13510 {
6688    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6689    pub nm: Option<String>,
6690    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6691    pub pstl_adr: Option<PostalAddress243>,
6692    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6693    pub id: Option<Party38Choice1>,
6694    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6695    pub ctry_of_res: Option<String>,
6696    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6697    pub ctct_dtls: Option<Contact42>,
6698}
6699
6700impl Validate for PartyIdentification13510 {
6701    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6702        if let Some(ref val) = self.nm {
6703            helpers::validate_length(
6704                val,
6705                "Nm",
6706                Some(1),
6707                Some(140),
6708                &helpers::child_path(path, "Nm"),
6709                config,
6710                collector,
6711            );
6712        }
6713        if let Some(ref val) = self.nm {
6714            helpers::validate_pattern(
6715                val,
6716                "Nm",
6717                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6718                &helpers::child_path(path, "Nm"),
6719                config,
6720                collector,
6721            );
6722        }
6723        if let Some(ref val) = self.pstl_adr
6724            && config.validate_optional_fields
6725        {
6726            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6727        }
6728        if let Some(ref val) = self.id
6729            && config.validate_optional_fields
6730        {
6731            val.validate(&helpers::child_path(path, "Id"), config, collector);
6732        }
6733        if let Some(ref val) = self.ctry_of_res {
6734            helpers::validate_pattern(
6735                val,
6736                "CtryOfRes",
6737                "[A-Z]{2,2}",
6738                &helpers::child_path(path, "CtryOfRes"),
6739                config,
6740                collector,
6741            );
6742        }
6743        if let Some(ref val) = self.ctct_dtls
6744            && config.validate_optional_fields
6745        {
6746            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6747        }
6748    }
6749}
6750
6751// 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.
6752#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6753pub struct PartyIdentification1352 {
6754    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6755    pub nm: Option<String>,
6756    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6757    pub pstl_adr: Option<PostalAddress241>,
6758    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6759    pub id: Option<Party38Choice1>,
6760    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6761    pub ctry_of_res: Option<String>,
6762}
6763
6764impl Validate for PartyIdentification1352 {
6765    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6766        if let Some(ref val) = self.nm {
6767            helpers::validate_length(
6768                val,
6769                "Nm",
6770                Some(1),
6771                Some(140),
6772                &helpers::child_path(path, "Nm"),
6773                config,
6774                collector,
6775            );
6776        }
6777        if let Some(ref val) = self.nm {
6778            helpers::validate_pattern(
6779                val,
6780                "Nm",
6781                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6782                &helpers::child_path(path, "Nm"),
6783                config,
6784                collector,
6785            );
6786        }
6787        if let Some(ref val) = self.pstl_adr
6788            && config.validate_optional_fields
6789        {
6790            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6791        }
6792        if let Some(ref val) = self.id
6793            && config.validate_optional_fields
6794        {
6795            val.validate(&helpers::child_path(path, "Id"), config, collector);
6796        }
6797        if let Some(ref val) = self.ctry_of_res {
6798            helpers::validate_pattern(
6799                val,
6800                "CtryOfRes",
6801                "[A-Z]{2,2}",
6802                &helpers::child_path(path, "CtryOfRes"),
6803                config,
6804                collector,
6805            );
6806        }
6807    }
6808}
6809
6810// 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.
6811#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6812pub struct PartyIdentification1353 {
6813    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6814    pub nm: Option<String>,
6815    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6816    pub pstl_adr: Option<PostalAddress241>,
6817    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6818    pub id: Option<Party38Choice2>,
6819    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6820    pub ctry_of_res: Option<String>,
6821}
6822
6823impl Validate for PartyIdentification1353 {
6824    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6825        if let Some(ref val) = self.nm {
6826            helpers::validate_length(
6827                val,
6828                "Nm",
6829                Some(1),
6830                Some(140),
6831                &helpers::child_path(path, "Nm"),
6832                config,
6833                collector,
6834            );
6835        }
6836        if let Some(ref val) = self.nm {
6837            helpers::validate_pattern(
6838                val,
6839                "Nm",
6840                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6841                &helpers::child_path(path, "Nm"),
6842                config,
6843                collector,
6844            );
6845        }
6846        if let Some(ref val) = self.pstl_adr
6847            && config.validate_optional_fields
6848        {
6849            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6850        }
6851        if let Some(ref val) = self.id
6852            && config.validate_optional_fields
6853        {
6854            val.validate(&helpers::child_path(path, "Id"), config, collector);
6855        }
6856        if let Some(ref val) = self.ctry_of_res {
6857            helpers::validate_pattern(
6858                val,
6859                "CtryOfRes",
6860                "[A-Z]{2,2}",
6861                &helpers::child_path(path, "CtryOfRes"),
6862                config,
6863                collector,
6864            );
6865        }
6866    }
6867}
6868
6869// PartyIdentification1354: Set of elements used to indicate how to contact the party.
6870#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6871pub struct PartyIdentification1354 {
6872    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6873    pub nm: Option<String>,
6874    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6875    pub pstl_adr: Option<PostalAddress243>,
6876    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6877    pub id: Option<Party38Choice3>,
6878    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6879    pub ctry_of_res: Option<String>,
6880    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6881    pub ctct_dtls: Option<Contact42>,
6882}
6883
6884impl Validate for PartyIdentification1354 {
6885    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6886        if let Some(ref val) = self.nm {
6887            helpers::validate_length(
6888                val,
6889                "Nm",
6890                Some(1),
6891                Some(140),
6892                &helpers::child_path(path, "Nm"),
6893                config,
6894                collector,
6895            );
6896        }
6897        if let Some(ref val) = self.nm {
6898            helpers::validate_pattern(
6899                val,
6900                "Nm",
6901                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6902                &helpers::child_path(path, "Nm"),
6903                config,
6904                collector,
6905            );
6906        }
6907        if let Some(ref val) = self.pstl_adr
6908            && config.validate_optional_fields
6909        {
6910            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6911        }
6912        if let Some(ref val) = self.id
6913            && config.validate_optional_fields
6914        {
6915            val.validate(&helpers::child_path(path, "Id"), config, collector);
6916        }
6917        if let Some(ref val) = self.ctry_of_res {
6918            helpers::validate_pattern(
6919                val,
6920                "CtryOfRes",
6921                "[A-Z]{2,2}",
6922                &helpers::child_path(path, "CtryOfRes"),
6923                config,
6924                collector,
6925            );
6926        }
6927        if let Some(ref val) = self.ctct_dtls
6928            && config.validate_optional_fields
6929        {
6930            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6931        }
6932    }
6933}
6934
6935// PartyIdentification1355: Set of elements used to indicate how to contact the party.
6936#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6937pub struct PartyIdentification1355 {
6938    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6939    pub nm: Option<String>,
6940    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6941    pub pstl_adr: Option<PostalAddress241>,
6942    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6943    pub id: Option<Party38Choice1>,
6944    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6945    pub ctry_of_res: Option<String>,
6946    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6947    pub ctct_dtls: Option<Contact43>,
6948}
6949
6950impl Validate for PartyIdentification1355 {
6951    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
6952        if let Some(ref val) = self.nm {
6953            helpers::validate_length(
6954                val,
6955                "Nm",
6956                Some(1),
6957                Some(140),
6958                &helpers::child_path(path, "Nm"),
6959                config,
6960                collector,
6961            );
6962        }
6963        if let Some(ref val) = self.nm {
6964            helpers::validate_pattern(
6965                val,
6966                "Nm",
6967                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
6968                &helpers::child_path(path, "Nm"),
6969                config,
6970                collector,
6971            );
6972        }
6973        if let Some(ref val) = self.pstl_adr
6974            && config.validate_optional_fields
6975        {
6976            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
6977        }
6978        if let Some(ref val) = self.id
6979            && config.validate_optional_fields
6980        {
6981            val.validate(&helpers::child_path(path, "Id"), config, collector);
6982        }
6983        if let Some(ref val) = self.ctry_of_res {
6984            helpers::validate_pattern(
6985                val,
6986                "CtryOfRes",
6987                "[A-Z]{2,2}",
6988                &helpers::child_path(path, "CtryOfRes"),
6989                config,
6990                collector,
6991            );
6992        }
6993        if let Some(ref val) = self.ctct_dtls
6994            && config.validate_optional_fields
6995        {
6996            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
6997        }
6998    }
6999}
7000
7001// PartyIdentification1356: Set of elements used to indicate how to contact the party.
7002#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7003pub struct PartyIdentification1356 {
7004    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7005    pub nm: Option<String>,
7006    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7007    pub pstl_adr: Option<PostalAddress241>,
7008    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7009    pub id: Option<Party38Choice1>,
7010    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7011    pub ctry_of_res: Option<String>,
7012    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7013    pub ctct_dtls: Option<Contact41>,
7014}
7015
7016impl Validate for PartyIdentification1356 {
7017    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7018        if let Some(ref val) = self.nm {
7019            helpers::validate_length(
7020                val,
7021                "Nm",
7022                Some(1),
7023                Some(140),
7024                &helpers::child_path(path, "Nm"),
7025                config,
7026                collector,
7027            );
7028        }
7029        if let Some(ref val) = self.nm {
7030            helpers::validate_pattern(
7031                val,
7032                "Nm",
7033                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7034                &helpers::child_path(path, "Nm"),
7035                config,
7036                collector,
7037            );
7038        }
7039        if let Some(ref val) = self.pstl_adr
7040            && config.validate_optional_fields
7041        {
7042            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
7043        }
7044        if let Some(ref val) = self.id
7045            && config.validate_optional_fields
7046        {
7047            val.validate(&helpers::child_path(path, "Id"), config, collector);
7048        }
7049        if let Some(ref val) = self.ctry_of_res {
7050            helpers::validate_pattern(
7051                val,
7052                "CtryOfRes",
7053                "[A-Z]{2,2}",
7054                &helpers::child_path(path, "CtryOfRes"),
7055                config,
7056                collector,
7057            );
7058        }
7059        if let Some(ref val) = self.ctct_dtls
7060            && config.validate_optional_fields
7061        {
7062            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
7063        }
7064    }
7065}
7066
7067// PartyIdentification1357: Set of elements used to indicate how to contact the party.
7068#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7069pub struct PartyIdentification1357 {
7070    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7071    pub nm: Option<String>,
7072    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7073    pub pstl_adr: Option<PostalAddress241>,
7074    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7075    pub id: Option<Party38Choice1>,
7076    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7077    pub ctry_of_res: Option<String>,
7078    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7079    pub ctct_dtls: Option<Contact41>,
7080}
7081
7082impl Validate for PartyIdentification1357 {
7083    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7084        if let Some(ref val) = self.nm {
7085            helpers::validate_length(
7086                val,
7087                "Nm",
7088                Some(1),
7089                Some(140),
7090                &helpers::child_path(path, "Nm"),
7091                config,
7092                collector,
7093            );
7094        }
7095        if let Some(ref val) = self.nm {
7096            helpers::validate_pattern(
7097                val,
7098                "Nm",
7099                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7100                &helpers::child_path(path, "Nm"),
7101                config,
7102                collector,
7103            );
7104        }
7105        if let Some(ref val) = self.pstl_adr
7106            && config.validate_optional_fields
7107        {
7108            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
7109        }
7110        if let Some(ref val) = self.id
7111            && config.validate_optional_fields
7112        {
7113            val.validate(&helpers::child_path(path, "Id"), config, collector);
7114        }
7115        if let Some(ref val) = self.ctry_of_res {
7116            helpers::validate_pattern(
7117                val,
7118                "CtryOfRes",
7119                "[A-Z]{2,2}",
7120                &helpers::child_path(path, "CtryOfRes"),
7121                config,
7122                collector,
7123            );
7124        }
7125        if let Some(ref val) = self.ctct_dtls
7126            && config.validate_optional_fields
7127        {
7128            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
7129        }
7130    }
7131}
7132
7133// PartyIdentification1358: Set of elements used to indicate how to contact the party.
7134#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7135pub struct PartyIdentification1358 {
7136    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7137    pub nm: Option<String>,
7138    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7139    pub pstl_adr: Option<PostalAddress241>,
7140    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7141    pub id: Option<Party38Choice1>,
7142    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7143    pub ctry_of_res: Option<String>,
7144    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7145    pub ctct_dtls: Option<Contact43>,
7146}
7147
7148impl Validate for PartyIdentification1358 {
7149    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7150        if let Some(ref val) = self.nm {
7151            helpers::validate_length(
7152                val,
7153                "Nm",
7154                Some(1),
7155                Some(140),
7156                &helpers::child_path(path, "Nm"),
7157                config,
7158                collector,
7159            );
7160        }
7161        if let Some(ref val) = self.nm {
7162            helpers::validate_pattern(
7163                val,
7164                "Nm",
7165                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7166                &helpers::child_path(path, "Nm"),
7167                config,
7168                collector,
7169            );
7170        }
7171        if let Some(ref val) = self.pstl_adr
7172            && config.validate_optional_fields
7173        {
7174            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
7175        }
7176        if let Some(ref val) = self.id
7177            && config.validate_optional_fields
7178        {
7179            val.validate(&helpers::child_path(path, "Id"), config, collector);
7180        }
7181        if let Some(ref val) = self.ctry_of_res {
7182            helpers::validate_pattern(
7183                val,
7184                "CtryOfRes",
7185                "[A-Z]{2,2}",
7186                &helpers::child_path(path, "CtryOfRes"),
7187                config,
7188                collector,
7189            );
7190        }
7191        if let Some(ref val) = self.ctct_dtls
7192            && config.validate_optional_fields
7193        {
7194            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
7195        }
7196    }
7197}
7198
7199// PartyIdentification1359: Set of elements used to indicate how to contact the party.
7200#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7201pub struct PartyIdentification1359 {
7202    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7203    pub nm: Option<String>,
7204    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7205    pub pstl_adr: Option<PostalAddress241>,
7206    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7207    pub id: Option<Party38Choice4>,
7208    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7209    pub ctry_of_res: Option<String>,
7210    #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7211    pub ctct_dtls: Option<Contact43>,
7212}
7213
7214impl Validate for PartyIdentification1359 {
7215    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7216        if let Some(ref val) = self.nm {
7217            helpers::validate_length(
7218                val,
7219                "Nm",
7220                Some(1),
7221                Some(140),
7222                &helpers::child_path(path, "Nm"),
7223                config,
7224                collector,
7225            );
7226        }
7227        if let Some(ref val) = self.nm {
7228            helpers::validate_pattern(
7229                val,
7230                "Nm",
7231                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7232                &helpers::child_path(path, "Nm"),
7233                config,
7234                collector,
7235            );
7236        }
7237        if let Some(ref val) = self.pstl_adr
7238            && config.validate_optional_fields
7239        {
7240            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
7241        }
7242        if let Some(ref val) = self.id
7243            && config.validate_optional_fields
7244        {
7245            val.validate(&helpers::child_path(path, "Id"), config, collector);
7246        }
7247        if let Some(ref val) = self.ctry_of_res {
7248            helpers::validate_pattern(
7249                val,
7250                "CtryOfRes",
7251                "[A-Z]{2,2}",
7252                &helpers::child_path(path, "CtryOfRes"),
7253                config,
7254                collector,
7255            );
7256        }
7257        if let Some(ref val) = self.ctct_dtls
7258            && config.validate_optional_fields
7259        {
7260            val.validate(&helpers::child_path(path, "CtctDtls"), config, collector);
7261        }
7262    }
7263}
7264
7265// PartyType3Code: Party to whom the card issuer delegates to authorise card payment transactions.
7266#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7267pub enum PartyType3Code {
7268    #[default]
7269    #[serde(rename = "OPOI")]
7270    CodeOPOI,
7271    #[serde(rename = "MERC")]
7272    CodeMERC,
7273    #[serde(rename = "ACCP")]
7274    CodeACCP,
7275    #[serde(rename = "ITAG")]
7276    CodeITAG,
7277    #[serde(rename = "ACQR")]
7278    CodeACQR,
7279    #[serde(rename = "CISS")]
7280    CodeCISS,
7281    #[serde(rename = "DLIS")]
7282    CodeDLIS,
7283}
7284
7285impl Validate for PartyType3Code {
7286    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7287        // Enum validation is typically empty
7288    }
7289}
7290
7291// PartyType4Code: Tax authority.
7292#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7293pub enum PartyType4Code {
7294    #[default]
7295    #[serde(rename = "MERC")]
7296    CodeMERC,
7297    #[serde(rename = "ACCP")]
7298    CodeACCP,
7299    #[serde(rename = "ITAG")]
7300    CodeITAG,
7301    #[serde(rename = "ACQR")]
7302    CodeACQR,
7303    #[serde(rename = "CISS")]
7304    CodeCISS,
7305    #[serde(rename = "TAXH")]
7306    CodeTAXH,
7307}
7308
7309impl Validate for PartyType4Code {
7310    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
7311        // Enum validation is typically empty
7312    }
7313}
7314
7315// PaymentCard41: Additional card issuer specific data.
7316#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7317pub struct PaymentCard41 {
7318    #[serde(rename = "PlainCardData", skip_serializing_if = "Option::is_none")]
7319    pub plain_card_data: Option<PlainCardData11>,
7320    #[serde(rename = "CardCtryCd", skip_serializing_if = "Option::is_none")]
7321    pub card_ctry_cd: Option<String>,
7322    #[serde(rename = "CardBrnd", skip_serializing_if = "Option::is_none")]
7323    pub card_brnd: Option<GenericIdentification11>,
7324    #[serde(rename = "AddtlCardData", skip_serializing_if = "Option::is_none")]
7325    pub addtl_card_data: Option<String>,
7326}
7327
7328impl Validate for PaymentCard41 {
7329    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7330        if let Some(ref val) = self.plain_card_data
7331            && config.validate_optional_fields
7332        {
7333            val.validate(
7334                &helpers::child_path(path, "PlainCardData"),
7335                config,
7336                collector,
7337            );
7338        }
7339        if let Some(ref val) = self.card_ctry_cd {
7340            helpers::validate_pattern(
7341                val,
7342                "CardCtryCd",
7343                "[0-9]{3}",
7344                &helpers::child_path(path, "CardCtryCd"),
7345                config,
7346                collector,
7347            );
7348        }
7349        if let Some(ref val) = self.card_brnd
7350            && config.validate_optional_fields
7351        {
7352            val.validate(&helpers::child_path(path, "CardBrnd"), config, collector);
7353        }
7354        if let Some(ref val) = self.addtl_card_data {
7355            helpers::validate_length(
7356                val,
7357                "AddtlCardData",
7358                Some(1),
7359                Some(70),
7360                &helpers::child_path(path, "AddtlCardData"),
7361                config,
7362                collector,
7363            );
7364        }
7365        if let Some(ref val) = self.addtl_card_data {
7366            helpers::validate_pattern(
7367                val,
7368                "AddtlCardData",
7369                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7370                &helpers::child_path(path, "AddtlCardData"),
7371                config,
7372                collector,
7373            );
7374        }
7375    }
7376}
7377
7378// PaymentContext3: Method used to authenticate a cardholder.
7379#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7380pub struct PaymentContext3 {
7381    #[serde(rename = "CardPres", skip_serializing_if = "Option::is_none")]
7382    pub card_pres: Option<bool>,
7383    #[serde(rename = "CrdhldrPres", skip_serializing_if = "Option::is_none")]
7384    pub crdhldr_pres: Option<bool>,
7385    #[serde(rename = "OnLineCntxt", skip_serializing_if = "Option::is_none")]
7386    pub on_line_cntxt: Option<bool>,
7387    #[serde(rename = "AttndncCntxt", skip_serializing_if = "Option::is_none")]
7388    pub attndnc_cntxt: Option<AttendanceContext1Code>,
7389    #[serde(rename = "TxEnvt", skip_serializing_if = "Option::is_none")]
7390    pub tx_envt: Option<TransactionEnvironment1Code>,
7391    #[serde(rename = "TxChanl", skip_serializing_if = "Option::is_none")]
7392    pub tx_chanl: Option<TransactionChannel1Code>,
7393    #[serde(rename = "AttndntMsgCpbl", skip_serializing_if = "Option::is_none")]
7394    pub attndnt_msg_cpbl: Option<bool>,
7395    #[serde(rename = "AttndntLang", skip_serializing_if = "Option::is_none")]
7396    pub attndnt_lang: Option<String>,
7397    #[serde(rename = "CardDataNtryMd")]
7398    pub card_data_ntry_md: CardDataReading1Code,
7399    #[serde(rename = "FllbckInd", skip_serializing_if = "Option::is_none")]
7400    pub fllbck_ind: Option<bool>,
7401    #[serde(rename = "AuthntcnMtd", skip_serializing_if = "Option::is_none")]
7402    pub authntcn_mtd: Option<CardholderAuthentication2>,
7403}
7404
7405impl Validate for PaymentContext3 {
7406    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7407        if let Some(ref val) = self.attndnc_cntxt
7408            && config.validate_optional_fields
7409        {
7410            val.validate(
7411                &helpers::child_path(path, "AttndncCntxt"),
7412                config,
7413                collector,
7414            );
7415        }
7416        if let Some(ref val) = self.tx_envt
7417            && config.validate_optional_fields
7418        {
7419            val.validate(&helpers::child_path(path, "TxEnvt"), config, collector);
7420        }
7421        if let Some(ref val) = self.tx_chanl
7422            && config.validate_optional_fields
7423        {
7424            val.validate(&helpers::child_path(path, "TxChanl"), config, collector);
7425        }
7426        if let Some(ref val) = self.attndnt_lang {
7427            helpers::validate_pattern(
7428                val,
7429                "AttndntLang",
7430                "[a-z]{2,2}",
7431                &helpers::child_path(path, "AttndntLang"),
7432                config,
7433                collector,
7434            );
7435        }
7436        self.card_data_ntry_md.validate(
7437            &helpers::child_path(path, "CardDataNtryMd"),
7438            config,
7439            collector,
7440        );
7441        if let Some(ref val) = self.authntcn_mtd
7442            && config.validate_optional_fields
7443        {
7444            val.validate(&helpers::child_path(path, "AuthntcnMtd"), config, collector);
7445        }
7446    }
7447}
7448
7449// PaymentReturnReason51: Further details on the return reason.
7450#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7451pub struct PaymentReturnReason51 {
7452    #[serde(rename = "OrgnlBkTxCd", skip_serializing_if = "Option::is_none")]
7453    pub orgnl_bk_tx_cd: Option<BankTransactionCodeStructure41>,
7454    #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
7455    pub orgtr: Option<PartyIdentification13510>,
7456    #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
7457    pub rsn: Option<ReturnReason5Choice1>,
7458    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
7459    pub addtl_inf: Option<Vec<String>>,
7460}
7461
7462impl Validate for PaymentReturnReason51 {
7463    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7464        if let Some(ref val) = self.orgnl_bk_tx_cd
7465            && config.validate_optional_fields
7466        {
7467            val.validate(&helpers::child_path(path, "OrgnlBkTxCd"), config, collector);
7468        }
7469        if let Some(ref val) = self.orgtr
7470            && config.validate_optional_fields
7471        {
7472            val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
7473        }
7474        if let Some(ref val) = self.rsn
7475            && config.validate_optional_fields
7476        {
7477            val.validate(&helpers::child_path(path, "Rsn"), config, collector);
7478        }
7479        if let Some(ref vec) = self.addtl_inf {
7480            for item in vec {
7481                helpers::validate_length(
7482                    item,
7483                    "AddtlInf",
7484                    Some(1),
7485                    Some(105),
7486                    &helpers::child_path(path, "AddtlInf"),
7487                    config,
7488                    collector,
7489                );
7490            }
7491        }
7492        if let Some(ref vec) = self.addtl_inf {
7493            for item in vec {
7494                helpers::validate_pattern(
7495                    item,
7496                    "AddtlInf",
7497                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7498                    &helpers::child_path(path, "AddtlInf"),
7499                    config,
7500                    collector,
7501                );
7502            }
7503        }
7504    }
7505}
7506
7507// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
7508#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7509pub struct PersonIdentification131 {
7510    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7511    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7512    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7513    pub othr: Option<Vec<GenericPersonIdentification11>>,
7514}
7515
7516impl Validate for PersonIdentification131 {
7517    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7518        if let Some(ref val) = self.dt_and_plc_of_birth
7519            && config.validate_optional_fields
7520        {
7521            val.validate(
7522                &helpers::child_path(path, "DtAndPlcOfBirth"),
7523                config,
7524                collector,
7525            );
7526        }
7527        if let Some(ref vec) = self.othr
7528            && config.validate_optional_fields
7529        {
7530            for item in vec {
7531                item.validate(&helpers::child_path(path, "Othr"), config, collector);
7532            }
7533        }
7534    }
7535}
7536
7537// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
7538#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7539pub struct PersonIdentification132 {
7540    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7541    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7542    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7543    pub othr: Option<Vec<GenericPersonIdentification11>>,
7544}
7545
7546impl Validate for PersonIdentification132 {
7547    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7548        if let Some(ref val) = self.dt_and_plc_of_birth
7549            && config.validate_optional_fields
7550        {
7551            val.validate(
7552                &helpers::child_path(path, "DtAndPlcOfBirth"),
7553                config,
7554                collector,
7555            );
7556        }
7557        if let Some(ref vec) = self.othr
7558            && config.validate_optional_fields
7559        {
7560            for item in vec {
7561                item.validate(&helpers::child_path(path, "Othr"), config, collector);
7562            }
7563        }
7564    }
7565}
7566
7567// PersonIdentification133: Unique identification of a person, as assigned by an institution, using an identification scheme.
7568#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7569pub struct PersonIdentification133 {
7570    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7571    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7572    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7573    pub othr: Option<Vec<GenericPersonIdentification12>>,
7574}
7575
7576impl Validate for PersonIdentification133 {
7577    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7578        if let Some(ref val) = self.dt_and_plc_of_birth
7579            && config.validate_optional_fields
7580        {
7581            val.validate(
7582                &helpers::child_path(path, "DtAndPlcOfBirth"),
7583                config,
7584                collector,
7585            );
7586        }
7587        if let Some(ref vec) = self.othr
7588            && config.validate_optional_fields
7589        {
7590            for item in vec {
7591                item.validate(&helpers::child_path(path, "Othr"), config, collector);
7592            }
7593        }
7594    }
7595}
7596
7597// PersonIdentification134: Unique identification of a person, as assigned by an institution, using an identification scheme.
7598#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7599pub struct PersonIdentification134 {
7600    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7601    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7602    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7603    pub othr: Option<Vec<GenericPersonIdentification13>>,
7604}
7605
7606impl Validate for PersonIdentification134 {
7607    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7608        if let Some(ref val) = self.dt_and_plc_of_birth
7609            && config.validate_optional_fields
7610        {
7611            val.validate(
7612                &helpers::child_path(path, "DtAndPlcOfBirth"),
7613                config,
7614                collector,
7615            );
7616        }
7617        if let Some(ref vec) = self.othr
7618            && config.validate_optional_fields
7619        {
7620            for item in vec {
7621                item.validate(&helpers::child_path(path, "Othr"), config, collector);
7622            }
7623        }
7624    }
7625}
7626
7627// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
7628#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7629pub struct PersonIdentificationSchemeName1Choice1 {
7630    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
7631    pub cd: Option<String>,
7632    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
7633    pub prtry: Option<String>,
7634}
7635
7636impl Validate for PersonIdentificationSchemeName1Choice1 {
7637    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7638        if let Some(ref val) = self.cd {
7639            helpers::validate_length(
7640                val,
7641                "Cd",
7642                Some(1),
7643                Some(4),
7644                &helpers::child_path(path, "Cd"),
7645                config,
7646                collector,
7647            );
7648        }
7649        if let Some(ref val) = self.prtry {
7650            helpers::validate_length(
7651                val,
7652                "Prtry",
7653                Some(1),
7654                Some(35),
7655                &helpers::child_path(path, "Prtry"),
7656                config,
7657                collector,
7658            );
7659        }
7660        if let Some(ref val) = self.prtry {
7661            helpers::validate_pattern(
7662                val,
7663                "Prtry",
7664                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7665                &helpers::child_path(path, "Prtry"),
7666                config,
7667                collector,
7668            );
7669        }
7670    }
7671}
7672
7673// PersonIdentificationSchemeName1Choice2: Name of the identification scheme, in a free text form.
7674#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7675pub struct PersonIdentificationSchemeName1Choice2 {
7676    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
7677    pub cd: Option<String>,
7678    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
7679    pub prtry: Option<String>,
7680}
7681
7682impl Validate for PersonIdentificationSchemeName1Choice2 {
7683    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7684        if let Some(ref val) = self.cd {
7685            helpers::validate_length(
7686                val,
7687                "Cd",
7688                Some(1),
7689                Some(4),
7690                &helpers::child_path(path, "Cd"),
7691                config,
7692                collector,
7693            );
7694        }
7695        if let Some(ref val) = self.prtry {
7696            helpers::validate_length(
7697                val,
7698                "Prtry",
7699                Some(1),
7700                Some(35),
7701                &helpers::child_path(path, "Prtry"),
7702                config,
7703                collector,
7704            );
7705        }
7706        if let Some(ref val) = self.prtry {
7707            helpers::validate_pattern(
7708                val,
7709                "Prtry",
7710                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7711                &helpers::child_path(path, "Prtry"),
7712                config,
7713                collector,
7714            );
7715        }
7716    }
7717}
7718
7719// PlainCardData11: Card security code (CSC) associated with the card performing the transaction.
7720#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7721pub struct PlainCardData11 {
7722    #[serde(rename = "PAN")]
7723    pub pan: String,
7724    #[serde(rename = "CardSeqNb", skip_serializing_if = "Option::is_none")]
7725    pub card_seq_nb: Option<String>,
7726    #[serde(rename = "FctvDt", skip_serializing_if = "Option::is_none")]
7727    pub fctv_dt: Option<String>,
7728    #[serde(rename = "XpryDt")]
7729    pub xpry_dt: String,
7730    #[serde(rename = "SvcCd", skip_serializing_if = "Option::is_none")]
7731    pub svc_cd: Option<String>,
7732    #[serde(rename = "TrckData", skip_serializing_if = "Option::is_none")]
7733    pub trck_data: Option<Vec<TrackData11>>,
7734    #[serde(rename = "CardSctyCd", skip_serializing_if = "Option::is_none")]
7735    pub card_scty_cd: Option<CardSecurityInformation1>,
7736}
7737
7738impl Validate for PlainCardData11 {
7739    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7740        helpers::validate_pattern(
7741            &self.pan,
7742            "PAN",
7743            "[0-9]{8,28}",
7744            &helpers::child_path(path, "PAN"),
7745            config,
7746            collector,
7747        );
7748        if let Some(ref val) = self.card_seq_nb {
7749            helpers::validate_pattern(
7750                val,
7751                "CardSeqNb",
7752                "[0-9]{2,3}",
7753                &helpers::child_path(path, "CardSeqNb"),
7754                config,
7755                collector,
7756            );
7757        }
7758        if let Some(ref val) = self.svc_cd {
7759            helpers::validate_pattern(
7760                val,
7761                "SvcCd",
7762                "[0-9]{3}",
7763                &helpers::child_path(path, "SvcCd"),
7764                config,
7765                collector,
7766            );
7767        }
7768        if let Some(ref vec) = self.trck_data
7769            && config.validate_optional_fields
7770        {
7771            for item in vec {
7772                item.validate(&helpers::child_path(path, "TrckData"), config, collector);
7773            }
7774        }
7775        if let Some(ref val) = self.card_scty_cd
7776            && config.validate_optional_fields
7777        {
7778            val.validate(&helpers::child_path(path, "CardSctyCd"), config, collector);
7779        }
7780    }
7781}
7782
7783// PointOfInteraction11: Data related to a component of the POI performing the transaction.
7784#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7785pub struct PointOfInteraction11 {
7786    #[serde(rename = "Id")]
7787    pub id: GenericIdentification321,
7788    #[serde(rename = "SysNm", skip_serializing_if = "Option::is_none")]
7789    pub sys_nm: Option<String>,
7790    #[serde(rename = "GrpId", skip_serializing_if = "Option::is_none")]
7791    pub grp_id: Option<String>,
7792    #[serde(rename = "Cpblties", skip_serializing_if = "Option::is_none")]
7793    pub cpblties: Option<PointOfInteractionCapabilities1>,
7794    #[serde(rename = "Cmpnt", skip_serializing_if = "Option::is_none")]
7795    pub cmpnt: Option<Vec<PointOfInteractionComponent11>>,
7796}
7797
7798impl Validate for PointOfInteraction11 {
7799    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7800        self.id
7801            .validate(&helpers::child_path(path, "Id"), config, collector);
7802        if let Some(ref val) = self.sys_nm {
7803            helpers::validate_length(
7804                val,
7805                "SysNm",
7806                Some(1),
7807                Some(70),
7808                &helpers::child_path(path, "SysNm"),
7809                config,
7810                collector,
7811            );
7812        }
7813        if let Some(ref val) = self.sys_nm {
7814            helpers::validate_pattern(
7815                val,
7816                "SysNm",
7817                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7818                &helpers::child_path(path, "SysNm"),
7819                config,
7820                collector,
7821            );
7822        }
7823        if let Some(ref val) = self.grp_id {
7824            helpers::validate_length(
7825                val,
7826                "GrpId",
7827                Some(1),
7828                Some(35),
7829                &helpers::child_path(path, "GrpId"),
7830                config,
7831                collector,
7832            );
7833        }
7834        if let Some(ref val) = self.grp_id {
7835            helpers::validate_pattern(
7836                val,
7837                "GrpId",
7838                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7839                &helpers::child_path(path, "GrpId"),
7840                config,
7841                collector,
7842            );
7843        }
7844        if let Some(ref val) = self.cpblties
7845            && config.validate_optional_fields
7846        {
7847            val.validate(&helpers::child_path(path, "Cpblties"), config, collector);
7848        }
7849        if let Some(ref vec) = self.cmpnt
7850            && config.validate_optional_fields
7851        {
7852            for item in vec {
7853                item.validate(&helpers::child_path(path, "Cmpnt"), config, collector);
7854            }
7855        }
7856    }
7857}
7858
7859// PointOfInteractionCapabilities1: Number of columns of the printer component.
7860#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7861pub struct PointOfInteractionCapabilities1 {
7862    #[serde(rename = "CardRdngCpblties", skip_serializing_if = "Option::is_none")]
7863    pub card_rdng_cpblties: Option<Vec<CardDataReading1Code>>,
7864    #[serde(
7865        rename = "CrdhldrVrfctnCpblties",
7866        skip_serializing_if = "Option::is_none"
7867    )]
7868    pub crdhldr_vrfctn_cpblties: Option<Vec<CardholderVerificationCapability1Code>>,
7869    #[serde(rename = "OnLineCpblties", skip_serializing_if = "Option::is_none")]
7870    pub on_line_cpblties: Option<OnLineCapability1Code>,
7871    #[serde(rename = "DispCpblties", skip_serializing_if = "Option::is_none")]
7872    pub disp_cpblties: Option<Vec<DisplayCapabilities1>>,
7873    #[serde(rename = "PrtLineWidth", skip_serializing_if = "Option::is_none")]
7874    pub prt_line_width: Option<String>,
7875}
7876
7877impl Validate for PointOfInteractionCapabilities1 {
7878    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7879        if let Some(ref vec) = self.card_rdng_cpblties
7880            && config.validate_optional_fields
7881        {
7882            for item in vec {
7883                item.validate(
7884                    &helpers::child_path(path, "CardRdngCpblties"),
7885                    config,
7886                    collector,
7887                );
7888            }
7889        }
7890        if let Some(ref vec) = self.crdhldr_vrfctn_cpblties
7891            && config.validate_optional_fields
7892        {
7893            for item in vec {
7894                item.validate(
7895                    &helpers::child_path(path, "CrdhldrVrfctnCpblties"),
7896                    config,
7897                    collector,
7898                );
7899            }
7900        }
7901        if let Some(ref val) = self.on_line_cpblties
7902            && config.validate_optional_fields
7903        {
7904            val.validate(
7905                &helpers::child_path(path, "OnLineCpblties"),
7906                config,
7907                collector,
7908            );
7909        }
7910        if let Some(ref vec) = self.disp_cpblties
7911            && config.validate_optional_fields
7912        {
7913            for item in vec {
7914                item.validate(
7915                    &helpers::child_path(path, "DispCpblties"),
7916                    config,
7917                    collector,
7918                );
7919            }
7920        }
7921        if let Some(ref val) = self.prt_line_width {
7922            helpers::validate_pattern(
7923                val,
7924                "PrtLineWidth",
7925                "[0-9]{1,3}",
7926                &helpers::child_path(path, "PrtLineWidth"),
7927                config,
7928                collector,
7929            );
7930        }
7931    }
7932}
7933
7934// PointOfInteractionComponent11: Unique approval number for a component, delivered by a certification body.
7935
7936// 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).
7937#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7938pub struct PointOfInteractionComponent11 {
7939    #[serde(rename = "POICmpntTp")]
7940    pub poi_cmpnt_tp: POIComponentType1Code,
7941    #[serde(rename = "ManfctrId", skip_serializing_if = "Option::is_none")]
7942    pub manfctr_id: Option<String>,
7943    #[serde(rename = "Mdl", skip_serializing_if = "Option::is_none")]
7944    pub mdl: Option<String>,
7945    #[serde(rename = "VrsnNb", skip_serializing_if = "Option::is_none")]
7946    pub vrsn_nb: Option<String>,
7947    #[serde(rename = "SrlNb", skip_serializing_if = "Option::is_none")]
7948    pub srl_nb: Option<String>,
7949    #[serde(rename = "ApprvlNb", skip_serializing_if = "Option::is_none")]
7950    pub apprvl_nb: Option<Vec<String>>,
7951}
7952
7953impl Validate for PointOfInteractionComponent11 {
7954    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
7955        self.poi_cmpnt_tp
7956            .validate(&helpers::child_path(path, "POICmpntTp"), config, collector);
7957        if let Some(ref val) = self.manfctr_id {
7958            helpers::validate_length(
7959                val,
7960                "ManfctrId",
7961                Some(1),
7962                Some(35),
7963                &helpers::child_path(path, "ManfctrId"),
7964                config,
7965                collector,
7966            );
7967        }
7968        if let Some(ref val) = self.manfctr_id {
7969            helpers::validate_pattern(
7970                val,
7971                "ManfctrId",
7972                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7973                &helpers::child_path(path, "ManfctrId"),
7974                config,
7975                collector,
7976            );
7977        }
7978        if let Some(ref val) = self.mdl {
7979            helpers::validate_length(
7980                val,
7981                "Mdl",
7982                Some(1),
7983                Some(35),
7984                &helpers::child_path(path, "Mdl"),
7985                config,
7986                collector,
7987            );
7988        }
7989        if let Some(ref val) = self.mdl {
7990            helpers::validate_pattern(
7991                val,
7992                "Mdl",
7993                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
7994                &helpers::child_path(path, "Mdl"),
7995                config,
7996                collector,
7997            );
7998        }
7999        if let Some(ref val) = self.vrsn_nb {
8000            helpers::validate_length(
8001                val,
8002                "VrsnNb",
8003                Some(1),
8004                Some(16),
8005                &helpers::child_path(path, "VrsnNb"),
8006                config,
8007                collector,
8008            );
8009        }
8010        if let Some(ref val) = self.vrsn_nb {
8011            helpers::validate_pattern(
8012                val,
8013                "VrsnNb",
8014                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8015                &helpers::child_path(path, "VrsnNb"),
8016                config,
8017                collector,
8018            );
8019        }
8020        if let Some(ref val) = self.srl_nb {
8021            helpers::validate_length(
8022                val,
8023                "SrlNb",
8024                Some(1),
8025                Some(35),
8026                &helpers::child_path(path, "SrlNb"),
8027                config,
8028                collector,
8029            );
8030        }
8031        if let Some(ref val) = self.srl_nb {
8032            helpers::validate_pattern(
8033                val,
8034                "SrlNb",
8035                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8036                &helpers::child_path(path, "SrlNb"),
8037                config,
8038                collector,
8039            );
8040        }
8041        if let Some(ref vec) = self.apprvl_nb {
8042            for item in vec {
8043                helpers::validate_length(
8044                    item,
8045                    "ApprvlNb",
8046                    Some(1),
8047                    Some(70),
8048                    &helpers::child_path(path, "ApprvlNb"),
8049                    config,
8050                    collector,
8051                );
8052            }
8053        }
8054        if let Some(ref vec) = self.apprvl_nb {
8055            for item in vec {
8056                helpers::validate_pattern(
8057                    item,
8058                    "ApprvlNb",
8059                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
8060                    &helpers::child_path(path, "ApprvlNb"),
8061                    config,
8062                    collector,
8063                );
8064            }
8065        }
8066    }
8067}
8068
8069// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
8070#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8071pub struct PostalAddress241 {
8072    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
8073    pub adr_tp: Option<AddressType3Choice1>,
8074    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
8075    pub dept: Option<String>,
8076    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
8077    pub sub_dept: Option<String>,
8078    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
8079    pub strt_nm: Option<String>,
8080    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
8081    pub bldg_nb: Option<String>,
8082    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
8083    pub bldg_nm: Option<String>,
8084    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
8085    pub flr: Option<String>,
8086    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
8087    pub pst_bx: Option<String>,
8088    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
8089    pub room: Option<String>,
8090    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
8091    pub pst_cd: Option<String>,
8092    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
8093    pub twn_nm: Option<String>,
8094    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
8095    pub twn_lctn_nm: Option<String>,
8096    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
8097    pub dstrct_nm: Option<String>,
8098    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
8099    pub ctry_sub_dvsn: Option<String>,
8100    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
8101    pub ctry: Option<String>,
8102    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
8103    pub adr_line: Option<Vec<String>>,
8104}
8105
8106impl Validate for PostalAddress241 {
8107    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8108        if let Some(ref val) = self.adr_tp
8109            && config.validate_optional_fields
8110        {
8111            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
8112        }
8113        if let Some(ref val) = self.dept {
8114            helpers::validate_length(
8115                val,
8116                "Dept",
8117                Some(1),
8118                Some(70),
8119                &helpers::child_path(path, "Dept"),
8120                config,
8121                collector,
8122            );
8123        }
8124        if let Some(ref val) = self.dept {
8125            helpers::validate_pattern(
8126                val,
8127                "Dept",
8128                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8129                &helpers::child_path(path, "Dept"),
8130                config,
8131                collector,
8132            );
8133        }
8134        if let Some(ref val) = self.sub_dept {
8135            helpers::validate_length(
8136                val,
8137                "SubDept",
8138                Some(1),
8139                Some(70),
8140                &helpers::child_path(path, "SubDept"),
8141                config,
8142                collector,
8143            );
8144        }
8145        if let Some(ref val) = self.sub_dept {
8146            helpers::validate_pattern(
8147                val,
8148                "SubDept",
8149                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8150                &helpers::child_path(path, "SubDept"),
8151                config,
8152                collector,
8153            );
8154        }
8155        if let Some(ref val) = self.strt_nm {
8156            helpers::validate_length(
8157                val,
8158                "StrtNm",
8159                Some(1),
8160                Some(70),
8161                &helpers::child_path(path, "StrtNm"),
8162                config,
8163                collector,
8164            );
8165        }
8166        if let Some(ref val) = self.strt_nm {
8167            helpers::validate_pattern(
8168                val,
8169                "StrtNm",
8170                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8171                &helpers::child_path(path, "StrtNm"),
8172                config,
8173                collector,
8174            );
8175        }
8176        if let Some(ref val) = self.bldg_nb {
8177            helpers::validate_length(
8178                val,
8179                "BldgNb",
8180                Some(1),
8181                Some(16),
8182                &helpers::child_path(path, "BldgNb"),
8183                config,
8184                collector,
8185            );
8186        }
8187        if let Some(ref val) = self.bldg_nb {
8188            helpers::validate_pattern(
8189                val,
8190                "BldgNb",
8191                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8192                &helpers::child_path(path, "BldgNb"),
8193                config,
8194                collector,
8195            );
8196        }
8197        if let Some(ref val) = self.bldg_nm {
8198            helpers::validate_length(
8199                val,
8200                "BldgNm",
8201                Some(1),
8202                Some(35),
8203                &helpers::child_path(path, "BldgNm"),
8204                config,
8205                collector,
8206            );
8207        }
8208        if let Some(ref val) = self.bldg_nm {
8209            helpers::validate_pattern(
8210                val,
8211                "BldgNm",
8212                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8213                &helpers::child_path(path, "BldgNm"),
8214                config,
8215                collector,
8216            );
8217        }
8218        if let Some(ref val) = self.flr {
8219            helpers::validate_length(
8220                val,
8221                "Flr",
8222                Some(1),
8223                Some(70),
8224                &helpers::child_path(path, "Flr"),
8225                config,
8226                collector,
8227            );
8228        }
8229        if let Some(ref val) = self.flr {
8230            helpers::validate_pattern(
8231                val,
8232                "Flr",
8233                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8234                &helpers::child_path(path, "Flr"),
8235                config,
8236                collector,
8237            );
8238        }
8239        if let Some(ref val) = self.pst_bx {
8240            helpers::validate_length(
8241                val,
8242                "PstBx",
8243                Some(1),
8244                Some(16),
8245                &helpers::child_path(path, "PstBx"),
8246                config,
8247                collector,
8248            );
8249        }
8250        if let Some(ref val) = self.pst_bx {
8251            helpers::validate_pattern(
8252                val,
8253                "PstBx",
8254                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8255                &helpers::child_path(path, "PstBx"),
8256                config,
8257                collector,
8258            );
8259        }
8260        if let Some(ref val) = self.room {
8261            helpers::validate_length(
8262                val,
8263                "Room",
8264                Some(1),
8265                Some(70),
8266                &helpers::child_path(path, "Room"),
8267                config,
8268                collector,
8269            );
8270        }
8271        if let Some(ref val) = self.room {
8272            helpers::validate_pattern(
8273                val,
8274                "Room",
8275                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8276                &helpers::child_path(path, "Room"),
8277                config,
8278                collector,
8279            );
8280        }
8281        if let Some(ref val) = self.pst_cd {
8282            helpers::validate_length(
8283                val,
8284                "PstCd",
8285                Some(1),
8286                Some(16),
8287                &helpers::child_path(path, "PstCd"),
8288                config,
8289                collector,
8290            );
8291        }
8292        if let Some(ref val) = self.pst_cd {
8293            helpers::validate_pattern(
8294                val,
8295                "PstCd",
8296                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8297                &helpers::child_path(path, "PstCd"),
8298                config,
8299                collector,
8300            );
8301        }
8302        if let Some(ref val) = self.twn_nm {
8303            helpers::validate_length(
8304                val,
8305                "TwnNm",
8306                Some(1),
8307                Some(35),
8308                &helpers::child_path(path, "TwnNm"),
8309                config,
8310                collector,
8311            );
8312        }
8313        if let Some(ref val) = self.twn_nm {
8314            helpers::validate_pattern(
8315                val,
8316                "TwnNm",
8317                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8318                &helpers::child_path(path, "TwnNm"),
8319                config,
8320                collector,
8321            );
8322        }
8323        if let Some(ref val) = self.twn_lctn_nm {
8324            helpers::validate_length(
8325                val,
8326                "TwnLctnNm",
8327                Some(1),
8328                Some(35),
8329                &helpers::child_path(path, "TwnLctnNm"),
8330                config,
8331                collector,
8332            );
8333        }
8334        if let Some(ref val) = self.twn_lctn_nm {
8335            helpers::validate_pattern(
8336                val,
8337                "TwnLctnNm",
8338                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8339                &helpers::child_path(path, "TwnLctnNm"),
8340                config,
8341                collector,
8342            );
8343        }
8344        if let Some(ref val) = self.dstrct_nm {
8345            helpers::validate_length(
8346                val,
8347                "DstrctNm",
8348                Some(1),
8349                Some(35),
8350                &helpers::child_path(path, "DstrctNm"),
8351                config,
8352                collector,
8353            );
8354        }
8355        if let Some(ref val) = self.dstrct_nm {
8356            helpers::validate_pattern(
8357                val,
8358                "DstrctNm",
8359                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8360                &helpers::child_path(path, "DstrctNm"),
8361                config,
8362                collector,
8363            );
8364        }
8365        if let Some(ref val) = self.ctry_sub_dvsn {
8366            helpers::validate_length(
8367                val,
8368                "CtrySubDvsn",
8369                Some(1),
8370                Some(35),
8371                &helpers::child_path(path, "CtrySubDvsn"),
8372                config,
8373                collector,
8374            );
8375        }
8376        if let Some(ref val) = self.ctry_sub_dvsn {
8377            helpers::validate_pattern(
8378                val,
8379                "CtrySubDvsn",
8380                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8381                &helpers::child_path(path, "CtrySubDvsn"),
8382                config,
8383                collector,
8384            );
8385        }
8386        if let Some(ref val) = self.ctry {
8387            helpers::validate_pattern(
8388                val,
8389                "Ctry",
8390                "[A-Z]{2,2}",
8391                &helpers::child_path(path, "Ctry"),
8392                config,
8393                collector,
8394            );
8395        }
8396        if let Some(ref vec) = self.adr_line {
8397            for item in vec {
8398                helpers::validate_length(
8399                    item,
8400                    "AdrLine",
8401                    Some(1),
8402                    Some(70),
8403                    &helpers::child_path(path, "AdrLine"),
8404                    config,
8405                    collector,
8406                );
8407            }
8408        }
8409        if let Some(ref vec) = self.adr_line {
8410            for item in vec {
8411                helpers::validate_pattern(
8412                    item,
8413                    "AdrLine",
8414                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8415                    &helpers::child_path(path, "AdrLine"),
8416                    config,
8417                    collector,
8418                );
8419            }
8420        }
8421    }
8422}
8423
8424// PostalAddress242: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
8425#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8426pub struct PostalAddress242 {
8427    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
8428    pub adr_tp: Option<AddressType3Choice1>,
8429    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
8430    pub dept: Option<String>,
8431    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
8432    pub sub_dept: Option<String>,
8433    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
8434    pub strt_nm: Option<String>,
8435    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
8436    pub bldg_nb: Option<String>,
8437    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
8438    pub bldg_nm: Option<String>,
8439    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
8440    pub flr: Option<String>,
8441    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
8442    pub pst_bx: Option<String>,
8443    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
8444    pub room: Option<String>,
8445    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
8446    pub pst_cd: Option<String>,
8447    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
8448    pub twn_nm: Option<String>,
8449    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
8450    pub twn_lctn_nm: Option<String>,
8451    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
8452    pub dstrct_nm: Option<String>,
8453    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
8454    pub ctry_sub_dvsn: Option<String>,
8455    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
8456    pub ctry: Option<String>,
8457    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
8458    pub adr_line: Option<Vec<String>>,
8459}
8460
8461impl Validate for PostalAddress242 {
8462    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8463        if let Some(ref val) = self.adr_tp
8464            && config.validate_optional_fields
8465        {
8466            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
8467        }
8468        if let Some(ref val) = self.dept {
8469            helpers::validate_length(
8470                val,
8471                "Dept",
8472                Some(1),
8473                Some(70),
8474                &helpers::child_path(path, "Dept"),
8475                config,
8476                collector,
8477            );
8478        }
8479        if let Some(ref val) = self.dept {
8480            helpers::validate_pattern(
8481                val,
8482                "Dept",
8483                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8484                &helpers::child_path(path, "Dept"),
8485                config,
8486                collector,
8487            );
8488        }
8489        if let Some(ref val) = self.sub_dept {
8490            helpers::validate_length(
8491                val,
8492                "SubDept",
8493                Some(1),
8494                Some(70),
8495                &helpers::child_path(path, "SubDept"),
8496                config,
8497                collector,
8498            );
8499        }
8500        if let Some(ref val) = self.sub_dept {
8501            helpers::validate_pattern(
8502                val,
8503                "SubDept",
8504                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8505                &helpers::child_path(path, "SubDept"),
8506                config,
8507                collector,
8508            );
8509        }
8510        if let Some(ref val) = self.strt_nm {
8511            helpers::validate_length(
8512                val,
8513                "StrtNm",
8514                Some(1),
8515                Some(70),
8516                &helpers::child_path(path, "StrtNm"),
8517                config,
8518                collector,
8519            );
8520        }
8521        if let Some(ref val) = self.strt_nm {
8522            helpers::validate_pattern(
8523                val,
8524                "StrtNm",
8525                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8526                &helpers::child_path(path, "StrtNm"),
8527                config,
8528                collector,
8529            );
8530        }
8531        if let Some(ref val) = self.bldg_nb {
8532            helpers::validate_length(
8533                val,
8534                "BldgNb",
8535                Some(1),
8536                Some(35),
8537                &helpers::child_path(path, "BldgNb"),
8538                config,
8539                collector,
8540            );
8541        }
8542        if let Some(ref val) = self.bldg_nb {
8543            helpers::validate_pattern(
8544                val,
8545                "BldgNb",
8546                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8547                &helpers::child_path(path, "BldgNb"),
8548                config,
8549                collector,
8550            );
8551        }
8552        if let Some(ref val) = self.bldg_nm {
8553            helpers::validate_length(
8554                val,
8555                "BldgNm",
8556                Some(1),
8557                Some(35),
8558                &helpers::child_path(path, "BldgNm"),
8559                config,
8560                collector,
8561            );
8562        }
8563        if let Some(ref val) = self.bldg_nm {
8564            helpers::validate_pattern(
8565                val,
8566                "BldgNm",
8567                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8568                &helpers::child_path(path, "BldgNm"),
8569                config,
8570                collector,
8571            );
8572        }
8573        if let Some(ref val) = self.flr {
8574            helpers::validate_length(
8575                val,
8576                "Flr",
8577                Some(1),
8578                Some(70),
8579                &helpers::child_path(path, "Flr"),
8580                config,
8581                collector,
8582            );
8583        }
8584        if let Some(ref val) = self.flr {
8585            helpers::validate_pattern(
8586                val,
8587                "Flr",
8588                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8589                &helpers::child_path(path, "Flr"),
8590                config,
8591                collector,
8592            );
8593        }
8594        if let Some(ref val) = self.pst_bx {
8595            helpers::validate_length(
8596                val,
8597                "PstBx",
8598                Some(1),
8599                Some(16),
8600                &helpers::child_path(path, "PstBx"),
8601                config,
8602                collector,
8603            );
8604        }
8605        if let Some(ref val) = self.pst_bx {
8606            helpers::validate_pattern(
8607                val,
8608                "PstBx",
8609                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8610                &helpers::child_path(path, "PstBx"),
8611                config,
8612                collector,
8613            );
8614        }
8615        if let Some(ref val) = self.room {
8616            helpers::validate_length(
8617                val,
8618                "Room",
8619                Some(1),
8620                Some(70),
8621                &helpers::child_path(path, "Room"),
8622                config,
8623                collector,
8624            );
8625        }
8626        if let Some(ref val) = self.room {
8627            helpers::validate_pattern(
8628                val,
8629                "Room",
8630                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8631                &helpers::child_path(path, "Room"),
8632                config,
8633                collector,
8634            );
8635        }
8636        if let Some(ref val) = self.pst_cd {
8637            helpers::validate_length(
8638                val,
8639                "PstCd",
8640                Some(1),
8641                Some(16),
8642                &helpers::child_path(path, "PstCd"),
8643                config,
8644                collector,
8645            );
8646        }
8647        if let Some(ref val) = self.pst_cd {
8648            helpers::validate_pattern(
8649                val,
8650                "PstCd",
8651                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8652                &helpers::child_path(path, "PstCd"),
8653                config,
8654                collector,
8655            );
8656        }
8657        if let Some(ref val) = self.twn_nm {
8658            helpers::validate_length(
8659                val,
8660                "TwnNm",
8661                Some(1),
8662                Some(35),
8663                &helpers::child_path(path, "TwnNm"),
8664                config,
8665                collector,
8666            );
8667        }
8668        if let Some(ref val) = self.twn_nm {
8669            helpers::validate_pattern(
8670                val,
8671                "TwnNm",
8672                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8673                &helpers::child_path(path, "TwnNm"),
8674                config,
8675                collector,
8676            );
8677        }
8678        if let Some(ref val) = self.twn_lctn_nm {
8679            helpers::validate_length(
8680                val,
8681                "TwnLctnNm",
8682                Some(1),
8683                Some(35),
8684                &helpers::child_path(path, "TwnLctnNm"),
8685                config,
8686                collector,
8687            );
8688        }
8689        if let Some(ref val) = self.twn_lctn_nm {
8690            helpers::validate_pattern(
8691                val,
8692                "TwnLctnNm",
8693                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8694                &helpers::child_path(path, "TwnLctnNm"),
8695                config,
8696                collector,
8697            );
8698        }
8699        if let Some(ref val) = self.dstrct_nm {
8700            helpers::validate_length(
8701                val,
8702                "DstrctNm",
8703                Some(1),
8704                Some(35),
8705                &helpers::child_path(path, "DstrctNm"),
8706                config,
8707                collector,
8708            );
8709        }
8710        if let Some(ref val) = self.dstrct_nm {
8711            helpers::validate_pattern(
8712                val,
8713                "DstrctNm",
8714                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8715                &helpers::child_path(path, "DstrctNm"),
8716                config,
8717                collector,
8718            );
8719        }
8720        if let Some(ref val) = self.ctry_sub_dvsn {
8721            helpers::validate_length(
8722                val,
8723                "CtrySubDvsn",
8724                Some(1),
8725                Some(35),
8726                &helpers::child_path(path, "CtrySubDvsn"),
8727                config,
8728                collector,
8729            );
8730        }
8731        if let Some(ref val) = self.ctry_sub_dvsn {
8732            helpers::validate_pattern(
8733                val,
8734                "CtrySubDvsn",
8735                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8736                &helpers::child_path(path, "CtrySubDvsn"),
8737                config,
8738                collector,
8739            );
8740        }
8741        if let Some(ref val) = self.ctry {
8742            helpers::validate_pattern(
8743                val,
8744                "Ctry",
8745                "[A-Z]{2,2}",
8746                &helpers::child_path(path, "Ctry"),
8747                config,
8748                collector,
8749            );
8750        }
8751        if let Some(ref vec) = self.adr_line {
8752            for item in vec {
8753                helpers::validate_length(
8754                    item,
8755                    "AdrLine",
8756                    Some(1),
8757                    Some(70),
8758                    &helpers::child_path(path, "AdrLine"),
8759                    config,
8760                    collector,
8761                );
8762            }
8763        }
8764        if let Some(ref vec) = self.adr_line {
8765            for item in vec {
8766                helpers::validate_pattern(
8767                    item,
8768                    "AdrLine",
8769                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8770                    &helpers::child_path(path, "AdrLine"),
8771                    config,
8772                    collector,
8773                );
8774            }
8775        }
8776    }
8777}
8778
8779// PostalAddress243: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
8780#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8781pub struct PostalAddress243 {
8782    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
8783    pub dept: Option<String>,
8784    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
8785    pub sub_dept: Option<String>,
8786    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
8787    pub strt_nm: Option<String>,
8788    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
8789    pub bldg_nb: Option<String>,
8790    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
8791    pub bldg_nm: Option<String>,
8792    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
8793    pub flr: Option<String>,
8794    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
8795    pub pst_bx: Option<String>,
8796    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
8797    pub room: Option<String>,
8798    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
8799    pub pst_cd: Option<String>,
8800    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
8801    pub twn_nm: Option<String>,
8802    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
8803    pub twn_lctn_nm: Option<String>,
8804    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
8805    pub dstrct_nm: Option<String>,
8806    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
8807    pub ctry_sub_dvsn: Option<String>,
8808    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
8809    pub ctry: Option<String>,
8810    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
8811    pub adr_line: Option<Vec<String>>,
8812}
8813
8814impl Validate for PostalAddress243 {
8815    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
8816        if let Some(ref val) = self.dept {
8817            helpers::validate_length(
8818                val,
8819                "Dept",
8820                Some(1),
8821                Some(70),
8822                &helpers::child_path(path, "Dept"),
8823                config,
8824                collector,
8825            );
8826        }
8827        if let Some(ref val) = self.dept {
8828            helpers::validate_pattern(
8829                val,
8830                "Dept",
8831                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8832                &helpers::child_path(path, "Dept"),
8833                config,
8834                collector,
8835            );
8836        }
8837        if let Some(ref val) = self.sub_dept {
8838            helpers::validate_length(
8839                val,
8840                "SubDept",
8841                Some(1),
8842                Some(70),
8843                &helpers::child_path(path, "SubDept"),
8844                config,
8845                collector,
8846            );
8847        }
8848        if let Some(ref val) = self.sub_dept {
8849            helpers::validate_pattern(
8850                val,
8851                "SubDept",
8852                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8853                &helpers::child_path(path, "SubDept"),
8854                config,
8855                collector,
8856            );
8857        }
8858        if let Some(ref val) = self.strt_nm {
8859            helpers::validate_length(
8860                val,
8861                "StrtNm",
8862                Some(1),
8863                Some(70),
8864                &helpers::child_path(path, "StrtNm"),
8865                config,
8866                collector,
8867            );
8868        }
8869        if let Some(ref val) = self.strt_nm {
8870            helpers::validate_pattern(
8871                val,
8872                "StrtNm",
8873                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8874                &helpers::child_path(path, "StrtNm"),
8875                config,
8876                collector,
8877            );
8878        }
8879        if let Some(ref val) = self.bldg_nb {
8880            helpers::validate_length(
8881                val,
8882                "BldgNb",
8883                Some(1),
8884                Some(16),
8885                &helpers::child_path(path, "BldgNb"),
8886                config,
8887                collector,
8888            );
8889        }
8890        if let Some(ref val) = self.bldg_nb {
8891            helpers::validate_pattern(
8892                val,
8893                "BldgNb",
8894                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8895                &helpers::child_path(path, "BldgNb"),
8896                config,
8897                collector,
8898            );
8899        }
8900        if let Some(ref val) = self.bldg_nm {
8901            helpers::validate_length(
8902                val,
8903                "BldgNm",
8904                Some(1),
8905                Some(35),
8906                &helpers::child_path(path, "BldgNm"),
8907                config,
8908                collector,
8909            );
8910        }
8911        if let Some(ref val) = self.bldg_nm {
8912            helpers::validate_pattern(
8913                val,
8914                "BldgNm",
8915                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8916                &helpers::child_path(path, "BldgNm"),
8917                config,
8918                collector,
8919            );
8920        }
8921        if let Some(ref val) = self.flr {
8922            helpers::validate_length(
8923                val,
8924                "Flr",
8925                Some(1),
8926                Some(70),
8927                &helpers::child_path(path, "Flr"),
8928                config,
8929                collector,
8930            );
8931        }
8932        if let Some(ref val) = self.flr {
8933            helpers::validate_pattern(
8934                val,
8935                "Flr",
8936                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8937                &helpers::child_path(path, "Flr"),
8938                config,
8939                collector,
8940            );
8941        }
8942        if let Some(ref val) = self.pst_bx {
8943            helpers::validate_length(
8944                val,
8945                "PstBx",
8946                Some(1),
8947                Some(16),
8948                &helpers::child_path(path, "PstBx"),
8949                config,
8950                collector,
8951            );
8952        }
8953        if let Some(ref val) = self.pst_bx {
8954            helpers::validate_pattern(
8955                val,
8956                "PstBx",
8957                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8958                &helpers::child_path(path, "PstBx"),
8959                config,
8960                collector,
8961            );
8962        }
8963        if let Some(ref val) = self.room {
8964            helpers::validate_length(
8965                val,
8966                "Room",
8967                Some(1),
8968                Some(70),
8969                &helpers::child_path(path, "Room"),
8970                config,
8971                collector,
8972            );
8973        }
8974        if let Some(ref val) = self.room {
8975            helpers::validate_pattern(
8976                val,
8977                "Room",
8978                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8979                &helpers::child_path(path, "Room"),
8980                config,
8981                collector,
8982            );
8983        }
8984        if let Some(ref val) = self.pst_cd {
8985            helpers::validate_length(
8986                val,
8987                "PstCd",
8988                Some(1),
8989                Some(16),
8990                &helpers::child_path(path, "PstCd"),
8991                config,
8992                collector,
8993            );
8994        }
8995        if let Some(ref val) = self.pst_cd {
8996            helpers::validate_pattern(
8997                val,
8998                "PstCd",
8999                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9000                &helpers::child_path(path, "PstCd"),
9001                config,
9002                collector,
9003            );
9004        }
9005        if let Some(ref val) = self.twn_nm {
9006            helpers::validate_length(
9007                val,
9008                "TwnNm",
9009                Some(1),
9010                Some(35),
9011                &helpers::child_path(path, "TwnNm"),
9012                config,
9013                collector,
9014            );
9015        }
9016        if let Some(ref val) = self.twn_nm {
9017            helpers::validate_pattern(
9018                val,
9019                "TwnNm",
9020                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9021                &helpers::child_path(path, "TwnNm"),
9022                config,
9023                collector,
9024            );
9025        }
9026        if let Some(ref val) = self.twn_lctn_nm {
9027            helpers::validate_length(
9028                val,
9029                "TwnLctnNm",
9030                Some(1),
9031                Some(35),
9032                &helpers::child_path(path, "TwnLctnNm"),
9033                config,
9034                collector,
9035            );
9036        }
9037        if let Some(ref val) = self.twn_lctn_nm {
9038            helpers::validate_pattern(
9039                val,
9040                "TwnLctnNm",
9041                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9042                &helpers::child_path(path, "TwnLctnNm"),
9043                config,
9044                collector,
9045            );
9046        }
9047        if let Some(ref val) = self.dstrct_nm {
9048            helpers::validate_length(
9049                val,
9050                "DstrctNm",
9051                Some(1),
9052                Some(35),
9053                &helpers::child_path(path, "DstrctNm"),
9054                config,
9055                collector,
9056            );
9057        }
9058        if let Some(ref val) = self.dstrct_nm {
9059            helpers::validate_pattern(
9060                val,
9061                "DstrctNm",
9062                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9063                &helpers::child_path(path, "DstrctNm"),
9064                config,
9065                collector,
9066            );
9067        }
9068        if let Some(ref val) = self.ctry_sub_dvsn {
9069            helpers::validate_length(
9070                val,
9071                "CtrySubDvsn",
9072                Some(1),
9073                Some(35),
9074                &helpers::child_path(path, "CtrySubDvsn"),
9075                config,
9076                collector,
9077            );
9078        }
9079        if let Some(ref val) = self.ctry_sub_dvsn {
9080            helpers::validate_pattern(
9081                val,
9082                "CtrySubDvsn",
9083                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9084                &helpers::child_path(path, "CtrySubDvsn"),
9085                config,
9086                collector,
9087            );
9088        }
9089        if let Some(ref val) = self.ctry {
9090            helpers::validate_pattern(
9091                val,
9092                "Ctry",
9093                "[A-Z]{2,2}",
9094                &helpers::child_path(path, "Ctry"),
9095                config,
9096                collector,
9097            );
9098        }
9099        if let Some(ref vec) = self.adr_line {
9100            for item in vec {
9101                helpers::validate_length(
9102                    item,
9103                    "AdrLine",
9104                    Some(1),
9105                    Some(70),
9106                    &helpers::child_path(path, "AdrLine"),
9107                    config,
9108                    collector,
9109                );
9110            }
9111        }
9112        if let Some(ref vec) = self.adr_line {
9113            for item in vec {
9114                helpers::validate_pattern(
9115                    item,
9116                    "AdrLine",
9117                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9118                    &helpers::child_path(path, "AdrLine"),
9119                    config,
9120                    collector,
9121                );
9122            }
9123        }
9124    }
9125}
9126
9127// PostalAddress244: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
9128#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9129pub struct PostalAddress244 {
9130    #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
9131    pub adr_tp: Option<AddressType3Choice>,
9132    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
9133    pub dept: Option<String>,
9134    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
9135    pub sub_dept: Option<String>,
9136    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
9137    pub strt_nm: Option<String>,
9138    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
9139    pub bldg_nb: Option<String>,
9140    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
9141    pub bldg_nm: Option<String>,
9142    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
9143    pub flr: Option<String>,
9144    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
9145    pub pst_bx: Option<String>,
9146    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
9147    pub room: Option<String>,
9148    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
9149    pub pst_cd: Option<String>,
9150    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
9151    pub twn_nm: Option<String>,
9152    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
9153    pub twn_lctn_nm: Option<String>,
9154    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
9155    pub dstrct_nm: Option<String>,
9156    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
9157    pub ctry_sub_dvsn: Option<String>,
9158    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
9159    pub ctry: Option<String>,
9160    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
9161    pub adr_line: Option<Vec<String>>,
9162}
9163
9164impl Validate for PostalAddress244 {
9165    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9166        if let Some(ref val) = self.adr_tp
9167            && config.validate_optional_fields
9168        {
9169            val.validate(&helpers::child_path(path, "AdrTp"), config, collector);
9170        }
9171        if let Some(ref val) = self.dept {
9172            helpers::validate_length(
9173                val,
9174                "Dept",
9175                Some(1),
9176                Some(70),
9177                &helpers::child_path(path, "Dept"),
9178                config,
9179                collector,
9180            );
9181        }
9182        if let Some(ref val) = self.sub_dept {
9183            helpers::validate_length(
9184                val,
9185                "SubDept",
9186                Some(1),
9187                Some(70),
9188                &helpers::child_path(path, "SubDept"),
9189                config,
9190                collector,
9191            );
9192        }
9193        if let Some(ref val) = self.strt_nm {
9194            helpers::validate_length(
9195                val,
9196                "StrtNm",
9197                Some(1),
9198                Some(70),
9199                &helpers::child_path(path, "StrtNm"),
9200                config,
9201                collector,
9202            );
9203        }
9204        if let Some(ref val) = self.bldg_nb {
9205            helpers::validate_length(
9206                val,
9207                "BldgNb",
9208                Some(1),
9209                Some(16),
9210                &helpers::child_path(path, "BldgNb"),
9211                config,
9212                collector,
9213            );
9214        }
9215        if let Some(ref val) = self.bldg_nm {
9216            helpers::validate_length(
9217                val,
9218                "BldgNm",
9219                Some(1),
9220                Some(35),
9221                &helpers::child_path(path, "BldgNm"),
9222                config,
9223                collector,
9224            );
9225        }
9226        if let Some(ref val) = self.flr {
9227            helpers::validate_length(
9228                val,
9229                "Flr",
9230                Some(1),
9231                Some(70),
9232                &helpers::child_path(path, "Flr"),
9233                config,
9234                collector,
9235            );
9236        }
9237        if let Some(ref val) = self.pst_bx {
9238            helpers::validate_length(
9239                val,
9240                "PstBx",
9241                Some(1),
9242                Some(16),
9243                &helpers::child_path(path, "PstBx"),
9244                config,
9245                collector,
9246            );
9247        }
9248        if let Some(ref val) = self.room {
9249            helpers::validate_length(
9250                val,
9251                "Room",
9252                Some(1),
9253                Some(70),
9254                &helpers::child_path(path, "Room"),
9255                config,
9256                collector,
9257            );
9258        }
9259        if let Some(ref val) = self.pst_cd {
9260            helpers::validate_length(
9261                val,
9262                "PstCd",
9263                Some(1),
9264                Some(16),
9265                &helpers::child_path(path, "PstCd"),
9266                config,
9267                collector,
9268            );
9269        }
9270        if let Some(ref val) = self.twn_nm {
9271            helpers::validate_length(
9272                val,
9273                "TwnNm",
9274                Some(1),
9275                Some(35),
9276                &helpers::child_path(path, "TwnNm"),
9277                config,
9278                collector,
9279            );
9280        }
9281        if let Some(ref val) = self.twn_lctn_nm {
9282            helpers::validate_length(
9283                val,
9284                "TwnLctnNm",
9285                Some(1),
9286                Some(35),
9287                &helpers::child_path(path, "TwnLctnNm"),
9288                config,
9289                collector,
9290            );
9291        }
9292        if let Some(ref val) = self.dstrct_nm {
9293            helpers::validate_length(
9294                val,
9295                "DstrctNm",
9296                Some(1),
9297                Some(35),
9298                &helpers::child_path(path, "DstrctNm"),
9299                config,
9300                collector,
9301            );
9302        }
9303        if let Some(ref val) = self.ctry_sub_dvsn {
9304            helpers::validate_length(
9305                val,
9306                "CtrySubDvsn",
9307                Some(1),
9308                Some(35),
9309                &helpers::child_path(path, "CtrySubDvsn"),
9310                config,
9311                collector,
9312            );
9313        }
9314        if let Some(ref val) = self.ctry {
9315            helpers::validate_pattern(
9316                val,
9317                "Ctry",
9318                "[A-Z]{2,2}",
9319                &helpers::child_path(path, "Ctry"),
9320                config,
9321                collector,
9322            );
9323        }
9324        if let Some(ref vec) = self.adr_line {
9325            for item in vec {
9326                helpers::validate_length(
9327                    item,
9328                    "AdrLine",
9329                    Some(1),
9330                    Some(70),
9331                    &helpers::child_path(path, "AdrLine"),
9332                    config,
9333                    collector,
9334                );
9335            }
9336        }
9337        if let Some(ref vec) = self.adr_line {
9338            for item in vec {
9339                helpers::validate_pattern(
9340                    item,
9341                    "AdrLine",
9342                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9343                    &helpers::child_path(path, "AdrLine"),
9344                    config,
9345                    collector,
9346                );
9347            }
9348        }
9349    }
9350}
9351
9352// PreferredContactMethod1Code: Preferred method used to reach the contact is per mobile or cell phone.
9353#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9354pub enum PreferredContactMethod1Code {
9355    #[default]
9356    #[serde(rename = "LETT")]
9357    CodeLETT,
9358    #[serde(rename = "MAIL")]
9359    CodeMAIL,
9360    #[serde(rename = "PHON")]
9361    CodePHON,
9362    #[serde(rename = "FAXX")]
9363    CodeFAXX,
9364    #[serde(rename = "CELL")]
9365    CodeCELL,
9366}
9367
9368impl Validate for PreferredContactMethod1Code {
9369    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
9370        // Enum validation is typically empty
9371    }
9372}
9373
9374// Price7: Value of the price, for example, as a currency and value.
9375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9376pub struct Price7 {
9377    #[serde(rename = "Tp")]
9378    pub tp: YieldedOrValueType1Choice,
9379    #[serde(rename = "Val")]
9380    pub val: PriceRateOrAmount3Choice,
9381}
9382
9383impl Validate for Price7 {
9384    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9385        self.tp
9386            .validate(&helpers::child_path(path, "Tp"), config, collector);
9387        self.val
9388            .validate(&helpers::child_path(path, "Val"), config, collector);
9389    }
9390}
9391
9392// PriceRateOrAmount3Choice: Price expressed as a currency and value.
9393#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9394pub struct PriceRateOrAmount3Choice {
9395    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9396    pub rate: Option<f64>,
9397    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
9398    pub amt: Option<ActiveOrHistoricCurrencyAnd13DecimalAmount>,
9399}
9400
9401impl Validate for PriceRateOrAmount3Choice {
9402    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9403        if let Some(ref val) = self.amt
9404            && config.validate_optional_fields
9405        {
9406            val.validate(&helpers::child_path(path, "Amt"), config, collector);
9407        }
9408    }
9409}
9410
9411// PriceValueType1Code: Price is the face amount.
9412#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9413pub enum PriceValueType1Code {
9414    #[default]
9415    #[serde(rename = "DISC")]
9416    CodeDISC,
9417    #[serde(rename = "PREM")]
9418    CodePREM,
9419    #[serde(rename = "PARV")]
9420    CodePARV,
9421}
9422
9423impl Validate for PriceValueType1Code {
9424    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
9425        // Enum validation is typically empty
9426    }
9427}
9428
9429// Product21: Additional information related to the product.
9430#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9431pub struct Product21 {
9432    #[serde(rename = "PdctCd")]
9433    pub pdct_cd: String,
9434    #[serde(rename = "UnitOfMeasr", skip_serializing_if = "Option::is_none")]
9435    pub unit_of_measr: Option<UnitOfMeasure1Code>,
9436    #[serde(rename = "PdctQty", skip_serializing_if = "Option::is_none")]
9437    pub pdct_qty: Option<f64>,
9438    #[serde(rename = "UnitPric", skip_serializing_if = "Option::is_none")]
9439    pub unit_pric: Option<f64>,
9440    #[serde(rename = "PdctAmt", skip_serializing_if = "Option::is_none")]
9441    pub pdct_amt: Option<f64>,
9442    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
9443    pub tax_tp: Option<String>,
9444    #[serde(rename = "AddtlPdctInf", skip_serializing_if = "Option::is_none")]
9445    pub addtl_pdct_inf: Option<String>,
9446}
9447
9448impl Validate for Product21 {
9449    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9450        helpers::validate_length(
9451            &self.pdct_cd,
9452            "PdctCd",
9453            Some(1),
9454            Some(70),
9455            &helpers::child_path(path, "PdctCd"),
9456            config,
9457            collector,
9458        );
9459        helpers::validate_pattern(
9460            &self.pdct_cd,
9461            "PdctCd",
9462            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9463            &helpers::child_path(path, "PdctCd"),
9464            config,
9465            collector,
9466        );
9467        if let Some(ref val) = self.unit_of_measr
9468            && config.validate_optional_fields
9469        {
9470            val.validate(&helpers::child_path(path, "UnitOfMeasr"), config, collector);
9471        }
9472        if let Some(ref val) = self.tax_tp {
9473            helpers::validate_length(
9474                val,
9475                "TaxTp",
9476                Some(1),
9477                Some(35),
9478                &helpers::child_path(path, "TaxTp"),
9479                config,
9480                collector,
9481            );
9482        }
9483        if let Some(ref val) = self.tax_tp {
9484            helpers::validate_pattern(
9485                val,
9486                "TaxTp",
9487                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9488                &helpers::child_path(path, "TaxTp"),
9489                config,
9490                collector,
9491            );
9492        }
9493        if let Some(ref val) = self.addtl_pdct_inf {
9494            helpers::validate_length(
9495                val,
9496                "AddtlPdctInf",
9497                Some(1),
9498                Some(35),
9499                &helpers::child_path(path, "AddtlPdctInf"),
9500                config,
9501                collector,
9502            );
9503        }
9504        if let Some(ref val) = self.addtl_pdct_inf {
9505            helpers::validate_pattern(
9506                val,
9507                "AddtlPdctInf",
9508                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9509                &helpers::child_path(path, "AddtlPdctInf"),
9510                config,
9511                collector,
9512            );
9513        }
9514    }
9515}
9516
9517// ProprietaryAgent41: Organisation established primarily to provide financial services.
9518#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9519pub struct ProprietaryAgent41 {
9520    #[serde(rename = "Tp")]
9521    pub tp: String,
9522    #[serde(rename = "Agt")]
9523    pub agt: BranchAndFinancialInstitutionIdentification65,
9524}
9525
9526impl Validate for ProprietaryAgent41 {
9527    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9528        helpers::validate_length(
9529            &self.tp,
9530            "Tp",
9531            Some(1),
9532            Some(35),
9533            &helpers::child_path(path, "Tp"),
9534            config,
9535            collector,
9536        );
9537        helpers::validate_pattern(
9538            &self.tp,
9539            "Tp",
9540            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9541            &helpers::child_path(path, "Tp"),
9542            config,
9543            collector,
9544        );
9545        self.agt
9546            .validate(&helpers::child_path(path, "Agt"), config, collector);
9547    }
9548}
9549
9550// ProprietaryBankTransactionCodeStructure11: Identification of the issuer of the proprietary bank transaction code.
9551#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9552pub struct ProprietaryBankTransactionCodeStructure11 {
9553    #[serde(rename = "Cd")]
9554    pub cd: String,
9555    #[serde(rename = "Issr")]
9556    pub issr: String,
9557}
9558
9559impl Validate for ProprietaryBankTransactionCodeStructure11 {
9560    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9561        helpers::validate_length(
9562            &self.cd,
9563            "Cd",
9564            Some(1),
9565            Some(35),
9566            &helpers::child_path(path, "Cd"),
9567            config,
9568            collector,
9569        );
9570        helpers::validate_pattern(
9571            &self.cd,
9572            "Cd",
9573            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9574            &helpers::child_path(path, "Cd"),
9575            config,
9576            collector,
9577        );
9578        helpers::validate_length(
9579            &self.issr,
9580            "Issr",
9581            Some(1),
9582            Some(35),
9583            &helpers::child_path(path, "Issr"),
9584            config,
9585            collector,
9586        );
9587        helpers::validate_pattern(
9588            &self.issr,
9589            "Issr",
9590            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9591            &helpers::child_path(path, "Issr"),
9592            config,
9593            collector,
9594        );
9595    }
9596}
9597
9598// ProprietaryDate31: Date in ISO format.
9599#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9600pub struct ProprietaryDate31 {
9601    #[serde(rename = "Tp")]
9602    pub tp: String,
9603    #[serde(rename = "Dt")]
9604    pub dt: DateAndDateTime2Choice1,
9605}
9606
9607impl Validate for ProprietaryDate31 {
9608    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9609        helpers::validate_length(
9610            &self.tp,
9611            "Tp",
9612            Some(1),
9613            Some(35),
9614            &helpers::child_path(path, "Tp"),
9615            config,
9616            collector,
9617        );
9618        helpers::validate_pattern(
9619            &self.tp,
9620            "Tp",
9621            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9622            &helpers::child_path(path, "Tp"),
9623            config,
9624            collector,
9625        );
9626        self.dt
9627            .validate(&helpers::child_path(path, "Dt"), config, collector);
9628    }
9629}
9630
9631// ProprietaryParty51: Proprietary party.
9632#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9633pub struct ProprietaryParty51 {
9634    #[serde(rename = "Tp")]
9635    pub tp: String,
9636    #[serde(rename = "Pty")]
9637    pub pty: Party40Choice5,
9638}
9639
9640impl Validate for ProprietaryParty51 {
9641    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9642        helpers::validate_length(
9643            &self.tp,
9644            "Tp",
9645            Some(1),
9646            Some(35),
9647            &helpers::child_path(path, "Tp"),
9648            config,
9649            collector,
9650        );
9651        helpers::validate_pattern(
9652            &self.tp,
9653            "Tp",
9654            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9655            &helpers::child_path(path, "Tp"),
9656            config,
9657            collector,
9658        );
9659        self.pty
9660            .validate(&helpers::child_path(path, "Pty"), config, collector);
9661    }
9662}
9663
9664// ProprietaryPrice21: Proprietary price specification related to the underlying transaction.
9665#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9666pub struct ProprietaryPrice21 {
9667    #[serde(rename = "Tp")]
9668    pub tp: String,
9669    #[serde(rename = "Pric")]
9670    pub pric: ActiveOrHistoricCurrencyAndAmount,
9671}
9672
9673impl Validate for ProprietaryPrice21 {
9674    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9675        helpers::validate_length(
9676            &self.tp,
9677            "Tp",
9678            Some(1),
9679            Some(35),
9680            &helpers::child_path(path, "Tp"),
9681            config,
9682            collector,
9683        );
9684        helpers::validate_pattern(
9685            &self.tp,
9686            "Tp",
9687            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9688            &helpers::child_path(path, "Tp"),
9689            config,
9690            collector,
9691        );
9692        self.pric
9693            .validate(&helpers::child_path(path, "Pric"), config, collector);
9694    }
9695}
9696
9697// ProprietaryQuantity11: Provides the proprietary quantity in free format.
9698#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9699pub struct ProprietaryQuantity11 {
9700    #[serde(rename = "Tp")]
9701    pub tp: String,
9702    #[serde(rename = "Qty")]
9703    pub qty: String,
9704}
9705
9706impl Validate for ProprietaryQuantity11 {
9707    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9708        helpers::validate_length(
9709            &self.tp,
9710            "Tp",
9711            Some(1),
9712            Some(35),
9713            &helpers::child_path(path, "Tp"),
9714            config,
9715            collector,
9716        );
9717        helpers::validate_pattern(
9718            &self.tp,
9719            "Tp",
9720            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9721            &helpers::child_path(path, "Tp"),
9722            config,
9723            collector,
9724        );
9725        helpers::validate_length(
9726            &self.qty,
9727            "Qty",
9728            Some(1),
9729            Some(35),
9730            &helpers::child_path(path, "Qty"),
9731            config,
9732            collector,
9733        );
9734        helpers::validate_pattern(
9735            &self.qty,
9736            "Qty",
9737            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9738            &helpers::child_path(path, "Qty"),
9739            config,
9740            collector,
9741        );
9742    }
9743}
9744
9745// ProprietaryReference11: Proprietary reference specification related to the underlying transaction.
9746#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9747pub struct ProprietaryReference11 {
9748    #[serde(rename = "Tp")]
9749    pub tp: String,
9750    #[serde(rename = "Ref")]
9751    pub ref_attr: String,
9752}
9753
9754impl Validate for ProprietaryReference11 {
9755    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9756        helpers::validate_length(
9757            &self.tp,
9758            "Tp",
9759            Some(1),
9760            Some(35),
9761            &helpers::child_path(path, "Tp"),
9762            config,
9763            collector,
9764        );
9765        helpers::validate_pattern(
9766            &self.tp,
9767            "Tp",
9768            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9769            &helpers::child_path(path, "Tp"),
9770            config,
9771            collector,
9772        );
9773        helpers::validate_length(
9774            &self.ref_attr,
9775            "Ref",
9776            Some(1),
9777            Some(35),
9778            &helpers::child_path(path, "Ref"),
9779            config,
9780            collector,
9781        );
9782        helpers::validate_pattern(
9783            &self.ref_attr,
9784            "Ref",
9785            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9786            &helpers::child_path(path, "Ref"),
9787            config,
9788            collector,
9789        );
9790    }
9791}
9792
9793// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
9794#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9795pub struct ProxyAccountIdentification11 {
9796    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9797    pub tp: Option<ProxyAccountType1Choice1>,
9798    #[serde(rename = "Id")]
9799    pub id: String,
9800}
9801
9802impl Validate for ProxyAccountIdentification11 {
9803    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9804        if let Some(ref val) = self.tp
9805            && config.validate_optional_fields
9806        {
9807            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9808        }
9809        helpers::validate_length(
9810            &self.id,
9811            "Id",
9812            Some(1),
9813            Some(320),
9814            &helpers::child_path(path, "Id"),
9815            config,
9816            collector,
9817        );
9818        helpers::validate_pattern(
9819            &self.id,
9820            "Id",
9821            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9822            &helpers::child_path(path, "Id"),
9823            config,
9824            collector,
9825        );
9826    }
9827}
9828
9829// ProxyAccountIdentification12: Identification used to indicate the account identification under another specified name.
9830#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9831pub struct ProxyAccountIdentification12 {
9832    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9833    pub tp: Option<ProxyAccountType1Choice1>,
9834    #[serde(rename = "Id")]
9835    pub id: String,
9836}
9837
9838impl Validate for ProxyAccountIdentification12 {
9839    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9840        if let Some(ref val) = self.tp
9841            && config.validate_optional_fields
9842        {
9843            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9844        }
9845        helpers::validate_length(
9846            &self.id,
9847            "Id",
9848            Some(1),
9849            Some(2048),
9850            &helpers::child_path(path, "Id"),
9851            config,
9852            collector,
9853        );
9854    }
9855}
9856
9857// ProxyAccountIdentification13: Identification used to indicate the account identification under another specified name.
9858#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9859pub struct ProxyAccountIdentification13 {
9860    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9861    pub tp: Option<ProxyAccountType1Choice>,
9862    #[serde(rename = "Id")]
9863    pub id: String,
9864}
9865
9866impl Validate for ProxyAccountIdentification13 {
9867    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9868        if let Some(ref val) = self.tp
9869            && config.validate_optional_fields
9870        {
9871            val.validate(&helpers::child_path(path, "Tp"), config, collector);
9872        }
9873        helpers::validate_length(
9874            &self.id,
9875            "Id",
9876            Some(1),
9877            Some(320),
9878            &helpers::child_path(path, "Id"),
9879            config,
9880            collector,
9881        );
9882        helpers::validate_pattern(
9883            &self.id,
9884            "Id",
9885            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9886            &helpers::child_path(path, "Id"),
9887            config,
9888            collector,
9889        );
9890    }
9891}
9892
9893// ProxyAccountType1Choice: Name of the identification scheme, in a free text form.
9894#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9895pub struct ProxyAccountType1Choice {
9896    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9897    pub cd: Option<String>,
9898    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9899    pub prtry: Option<String>,
9900}
9901
9902impl Validate for ProxyAccountType1Choice {
9903    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9904        if let Some(ref val) = self.cd {
9905            helpers::validate_length(
9906                val,
9907                "Cd",
9908                Some(1),
9909                Some(4),
9910                &helpers::child_path(path, "Cd"),
9911                config,
9912                collector,
9913            );
9914        }
9915        if let Some(ref val) = self.prtry {
9916            helpers::validate_length(
9917                val,
9918                "Prtry",
9919                Some(1),
9920                Some(35),
9921                &helpers::child_path(path, "Prtry"),
9922                config,
9923                collector,
9924            );
9925        }
9926    }
9927}
9928
9929// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
9930#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9931pub struct ProxyAccountType1Choice1 {
9932    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9933    pub cd: Option<String>,
9934    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9935    pub prtry: Option<String>,
9936}
9937
9938impl Validate for ProxyAccountType1Choice1 {
9939    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9940        if let Some(ref val) = self.cd {
9941            helpers::validate_length(
9942                val,
9943                "Cd",
9944                Some(1),
9945                Some(4),
9946                &helpers::child_path(path, "Cd"),
9947                config,
9948                collector,
9949            );
9950        }
9951        if let Some(ref val) = self.prtry {
9952            helpers::validate_length(
9953                val,
9954                "Prtry",
9955                Some(1),
9956                Some(35),
9957                &helpers::child_path(path, "Prtry"),
9958                config,
9959                collector,
9960            );
9961        }
9962        if let Some(ref val) = self.prtry {
9963            helpers::validate_pattern(
9964                val,
9965                "Prtry",
9966                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
9967                &helpers::child_path(path, "Prtry"),
9968                config,
9969                collector,
9970            );
9971        }
9972    }
9973}
9974
9975// Purpose2Choice1: Purpose, in a proprietary form.
9976#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9977pub struct Purpose2Choice1 {
9978    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9979    pub cd: Option<String>,
9980    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9981    pub prtry: Option<String>,
9982}
9983
9984impl Validate for Purpose2Choice1 {
9985    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
9986        if let Some(ref val) = self.cd {
9987            helpers::validate_length(
9988                val,
9989                "Cd",
9990                Some(1),
9991                Some(4),
9992                &helpers::child_path(path, "Cd"),
9993                config,
9994                collector,
9995            );
9996        }
9997        if let Some(ref val) = self.prtry {
9998            helpers::validate_length(
9999                val,
10000                "Prtry",
10001                Some(1),
10002                Some(35),
10003                &helpers::child_path(path, "Prtry"),
10004                config,
10005                collector,
10006            );
10007        }
10008        if let Some(ref val) = self.prtry {
10009            helpers::validate_pattern(
10010                val,
10011                "Prtry",
10012                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10013                &helpers::child_path(path, "Prtry"),
10014                config,
10015                collector,
10016            );
10017        }
10018    }
10019}
10020
10021// Rate41: An amount range where the interest rate is applicable.
10022#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10023pub struct Rate41 {
10024    #[serde(rename = "Tp")]
10025    pub tp: RateType4Choice1,
10026    #[serde(rename = "VldtyRg", skip_serializing_if = "Option::is_none")]
10027    pub vldty_rg: Option<ActiveOrHistoricCurrencyAndAmountRange2>,
10028}
10029
10030impl Validate for Rate41 {
10031    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10032        self.tp
10033            .validate(&helpers::child_path(path, "Tp"), config, collector);
10034        if let Some(ref val) = self.vldty_rg
10035            && config.validate_optional_fields
10036        {
10037            val.validate(&helpers::child_path(path, "VldtyRg"), config, collector);
10038        }
10039    }
10040}
10041
10042// RateType4Choice1: Rate type expressed, in an other form.
10043#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10044pub struct RateType4Choice1 {
10045    #[serde(rename = "Pctg", skip_serializing_if = "Option::is_none")]
10046    pub pctg: Option<f64>,
10047    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
10048    pub othr: Option<String>,
10049}
10050
10051impl Validate for RateType4Choice1 {
10052    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10053        if let Some(ref val) = self.othr {
10054            helpers::validate_length(
10055                val,
10056                "Othr",
10057                Some(1),
10058                Some(35),
10059                &helpers::child_path(path, "Othr"),
10060                config,
10061                collector,
10062            );
10063        }
10064        if let Some(ref val) = self.othr {
10065            helpers::validate_pattern(
10066                val,
10067                "Othr",
10068                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10069                &helpers::child_path(path, "Othr"),
10070                config,
10071                collector,
10072            );
10073        }
10074    }
10075}
10076
10077// ReferredDocumentInformation71: Set of elements used to provide the content of the referred document line.
10078#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10079pub struct ReferredDocumentInformation71 {
10080    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10081    pub tp: Option<ReferredDocumentType41>,
10082    #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
10083    pub nb: Option<String>,
10084    #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
10085    pub rltd_dt: Option<String>,
10086    #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
10087    pub line_dtls: Option<Vec<DocumentLineInformation11>>,
10088}
10089
10090impl Validate for ReferredDocumentInformation71 {
10091    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10092        if let Some(ref val) = self.tp
10093            && config.validate_optional_fields
10094        {
10095            val.validate(&helpers::child_path(path, "Tp"), config, collector);
10096        }
10097        if let Some(ref val) = self.nb {
10098            helpers::validate_length(
10099                val,
10100                "Nb",
10101                Some(1),
10102                Some(35),
10103                &helpers::child_path(path, "Nb"),
10104                config,
10105                collector,
10106            );
10107        }
10108        if let Some(ref val) = self.nb {
10109            helpers::validate_pattern(
10110                val,
10111                "Nb",
10112                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10113                &helpers::child_path(path, "Nb"),
10114                config,
10115                collector,
10116            );
10117        }
10118        if let Some(ref vec) = self.line_dtls
10119            && config.validate_optional_fields
10120        {
10121            for item in vec {
10122                item.validate(&helpers::child_path(path, "LineDtls"), config, collector);
10123            }
10124        }
10125    }
10126}
10127
10128// ReferredDocumentType3Choice1: Proprietary identification of the type of the remittance document.
10129#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10130pub struct ReferredDocumentType3Choice1 {
10131    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10132    pub cd: Option<DocumentType6Code>,
10133    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10134    pub prtry: Option<String>,
10135}
10136
10137impl Validate for ReferredDocumentType3Choice1 {
10138    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10139        if let Some(ref val) = self.cd
10140            && config.validate_optional_fields
10141        {
10142            val.validate(&helpers::child_path(path, "Cd"), config, collector);
10143        }
10144        if let Some(ref val) = self.prtry {
10145            helpers::validate_length(
10146                val,
10147                "Prtry",
10148                Some(1),
10149                Some(35),
10150                &helpers::child_path(path, "Prtry"),
10151                config,
10152                collector,
10153            );
10154        }
10155        if let Some(ref val) = self.prtry {
10156            helpers::validate_pattern(
10157                val,
10158                "Prtry",
10159                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10160                &helpers::child_path(path, "Prtry"),
10161                config,
10162                collector,
10163            );
10164        }
10165    }
10166}
10167
10168// ReferredDocumentType41: Identification of the issuer of the reference document type.
10169#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10170pub struct ReferredDocumentType41 {
10171    #[serde(rename = "CdOrPrtry")]
10172    pub cd_or_prtry: ReferredDocumentType3Choice1,
10173    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
10174    pub issr: Option<String>,
10175}
10176
10177impl Validate for ReferredDocumentType41 {
10178    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10179        self.cd_or_prtry
10180            .validate(&helpers::child_path(path, "CdOrPrtry"), config, collector);
10181        if let Some(ref val) = self.issr {
10182            helpers::validate_length(
10183                val,
10184                "Issr",
10185                Some(1),
10186                Some(35),
10187                &helpers::child_path(path, "Issr"),
10188                config,
10189                collector,
10190            );
10191        }
10192        if let Some(ref val) = self.issr {
10193            helpers::validate_pattern(
10194                val,
10195                "Issr",
10196                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10197                &helpers::child_path(path, "Issr"),
10198                config,
10199                collector,
10200            );
10201        }
10202    }
10203}
10204
10205// RemittanceAmount21: Amount of money remitted for the referred document.
10206#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10207pub struct RemittanceAmount21 {
10208    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
10209    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10210    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
10211    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType12>>,
10212    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
10213    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10214    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10215    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
10216    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
10217    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
10218    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
10219    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10220}
10221
10222impl Validate for RemittanceAmount21 {
10223    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10224        if let Some(ref val) = self.due_pybl_amt
10225            && config.validate_optional_fields
10226        {
10227            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
10228        }
10229        if let Some(ref vec) = self.dscnt_apld_amt
10230            && config.validate_optional_fields
10231        {
10232            for item in vec {
10233                item.validate(
10234                    &helpers::child_path(path, "DscntApldAmt"),
10235                    config,
10236                    collector,
10237                );
10238            }
10239        }
10240        if let Some(ref val) = self.cdt_note_amt
10241            && config.validate_optional_fields
10242        {
10243            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
10244        }
10245        if let Some(ref vec) = self.tax_amt
10246            && config.validate_optional_fields
10247        {
10248            for item in vec {
10249                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
10250            }
10251        }
10252        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
10253            && config.validate_optional_fields
10254        {
10255            for item in vec {
10256                item.validate(
10257                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
10258                    config,
10259                    collector,
10260                );
10261            }
10262        }
10263        if let Some(ref val) = self.rmtd_amt
10264            && config.validate_optional_fields
10265        {
10266            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
10267        }
10268    }
10269}
10270
10271// RemittanceAmount31: Amount of money remitted.
10272#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10273pub struct RemittanceAmount31 {
10274    #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
10275    pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10276    #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
10277    pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
10278    #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
10279    pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10280    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10281    pub tax_amt: Option<Vec<TaxAmountAndType11>>,
10282    #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
10283    pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
10284    #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
10285    pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10286}
10287
10288impl Validate for RemittanceAmount31 {
10289    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10290        if let Some(ref val) = self.due_pybl_amt
10291            && config.validate_optional_fields
10292        {
10293            val.validate(&helpers::child_path(path, "DuePyblAmt"), config, collector);
10294        }
10295        if let Some(ref vec) = self.dscnt_apld_amt
10296            && config.validate_optional_fields
10297        {
10298            for item in vec {
10299                item.validate(
10300                    &helpers::child_path(path, "DscntApldAmt"),
10301                    config,
10302                    collector,
10303                );
10304            }
10305        }
10306        if let Some(ref val) = self.cdt_note_amt
10307            && config.validate_optional_fields
10308        {
10309            val.validate(&helpers::child_path(path, "CdtNoteAmt"), config, collector);
10310        }
10311        if let Some(ref vec) = self.tax_amt
10312            && config.validate_optional_fields
10313        {
10314            for item in vec {
10315                item.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
10316            }
10317        }
10318        if let Some(ref vec) = self.adjstmnt_amt_and_rsn
10319            && config.validate_optional_fields
10320        {
10321            for item in vec {
10322                item.validate(
10323                    &helpers::child_path(path, "AdjstmntAmtAndRsn"),
10324                    config,
10325                    collector,
10326                );
10327            }
10328        }
10329        if let Some(ref val) = self.rmtd_amt
10330            && config.validate_optional_fields
10331        {
10332            val.validate(&helpers::child_path(path, "RmtdAmt"), config, collector);
10333        }
10334    }
10335}
10336
10337// 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.
10338#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10339pub struct RemittanceInformation161 {
10340    #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
10341    pub ustrd: Option<String>,
10342    #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
10343    pub strd: Option<Vec<StructuredRemittanceInformation161>>,
10344}
10345
10346impl Validate for RemittanceInformation161 {
10347    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10348        if let Some(ref val) = self.ustrd {
10349            helpers::validate_length(
10350                val,
10351                "Ustrd",
10352                Some(1),
10353                Some(140),
10354                &helpers::child_path(path, "Ustrd"),
10355                config,
10356                collector,
10357            );
10358        }
10359        if let Some(ref val) = self.ustrd {
10360            helpers::validate_pattern(
10361                val,
10362                "Ustrd",
10363                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10364                &helpers::child_path(path, "Ustrd"),
10365                config,
10366                collector,
10367            );
10368        }
10369        if let Some(ref vec) = self.strd
10370            && config.validate_optional_fields
10371        {
10372            for item in vec {
10373                item.validate(&helpers::child_path(path, "Strd"), config, collector);
10374            }
10375        }
10376    }
10377}
10378
10379// RemittanceLocation71: Set of elements used to provide information on the location and/or delivery of the remittance information.
10380#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10381pub struct RemittanceLocation71 {
10382    #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
10383    pub rmt_id: Option<String>,
10384    #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
10385    pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
10386}
10387
10388impl Validate for RemittanceLocation71 {
10389    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10390        if let Some(ref val) = self.rmt_id {
10391            helpers::validate_length(
10392                val,
10393                "RmtId",
10394                Some(1),
10395                Some(35),
10396                &helpers::child_path(path, "RmtId"),
10397                config,
10398                collector,
10399            );
10400        }
10401        if let Some(ref val) = self.rmt_id {
10402            helpers::validate_pattern(
10403                val,
10404                "RmtId",
10405                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10406                &helpers::child_path(path, "RmtId"),
10407                config,
10408                collector,
10409            );
10410        }
10411        if let Some(ref vec) = self.rmt_lctn_dtls
10412            && config.validate_optional_fields
10413        {
10414            for item in vec {
10415                item.validate(&helpers::child_path(path, "RmtLctnDtls"), config, collector);
10416            }
10417        }
10418    }
10419}
10420
10421// RemittanceLocationData11: Postal address to which an agent is to send the remittance information.
10422#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10423pub struct RemittanceLocationData11 {
10424    #[serde(rename = "Mtd")]
10425    pub mtd: RemittanceLocationMethod2Code,
10426    #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
10427    pub elctrnc_adr: Option<String>,
10428    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
10429    pub pstl_adr: Option<NameAndAddress161>,
10430}
10431
10432impl Validate for RemittanceLocationData11 {
10433    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10434        self.mtd
10435            .validate(&helpers::child_path(path, "Mtd"), config, collector);
10436        if let Some(ref val) = self.elctrnc_adr {
10437            helpers::validate_length(
10438                val,
10439                "ElctrncAdr",
10440                Some(1),
10441                Some(2048),
10442                &helpers::child_path(path, "ElctrncAdr"),
10443                config,
10444                collector,
10445            );
10446        }
10447        if let Some(ref val) = self.elctrnc_adr {
10448            helpers::validate_pattern(
10449                val,
10450                "ElctrncAdr",
10451                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10452                &helpers::child_path(path, "ElctrncAdr"),
10453                config,
10454                collector,
10455            );
10456        }
10457        if let Some(ref val) = self.pstl_adr
10458            && config.validate_optional_fields
10459        {
10460            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
10461        }
10462    }
10463}
10464
10465// RemittanceLocationMethod2Code: Remittance advice information must be sent through by phone as a short message service (SMS).
10466#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10467pub enum RemittanceLocationMethod2Code {
10468    #[default]
10469    #[serde(rename = "FAXI")]
10470    CodeFAXI,
10471    #[serde(rename = "EDIC")]
10472    CodeEDIC,
10473    #[serde(rename = "URID")]
10474    CodeURID,
10475    #[serde(rename = "EMAL")]
10476    CodeEMAL,
10477    #[serde(rename = "POST")]
10478    CodePOST,
10479    #[serde(rename = "SMSM")]
10480    CodeSMSM,
10481}
10482
10483impl Validate for RemittanceLocationMethod2Code {
10484    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
10485        // Enum validation is typically empty
10486    }
10487}
10488
10489// ReportEntry101: Further details of the entry.
10490#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10491pub struct ReportEntry101 {
10492    #[serde(rename = "NtryRef")]
10493    pub ntry_ref: String,
10494    #[serde(rename = "Amt")]
10495    pub amt: ActiveOrHistoricCurrencyAndAmount,
10496    #[serde(rename = "CdtDbtInd")]
10497    pub cdt_dbt_ind: CreditDebitCode,
10498    #[serde(rename = "RvslInd", skip_serializing_if = "Option::is_none")]
10499    pub rvsl_ind: Option<bool>,
10500    #[serde(rename = "Sts")]
10501    pub sts: EntryStatus1Choice1,
10502    #[serde(rename = "BookgDt", skip_serializing_if = "Option::is_none")]
10503    pub bookg_dt: Option<DateAndDateTime2Choice2>,
10504    #[serde(rename = "ValDt", skip_serializing_if = "Option::is_none")]
10505    pub val_dt: Option<DateAndDateTime2Choice1>,
10506    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
10507    pub acct_svcr_ref: Option<String>,
10508    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
10509    pub avlbty: Option<Vec<CashAvailability1>>,
10510    #[serde(rename = "BkTxCd")]
10511    pub bk_tx_cd: BankTransactionCodeStructure41,
10512    #[serde(rename = "ComssnWvrInd", skip_serializing_if = "Option::is_none")]
10513    pub comssn_wvr_ind: Option<bool>,
10514    #[serde(rename = "AddtlInfInd", skip_serializing_if = "Option::is_none")]
10515    pub addtl_inf_ind: Option<MessageIdentification21>,
10516    #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
10517    pub amt_dtls: Option<AmountAndCurrencyExchange31>,
10518    #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
10519    pub chrgs: Option<Charges61>,
10520    #[serde(rename = "TechInptChanl", skip_serializing_if = "Option::is_none")]
10521    pub tech_inpt_chanl: Option<TechnicalInputChannel1Choice1>,
10522    #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
10523    pub intrst: Option<TransactionInterest41>,
10524    #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
10525    pub card_tx: Option<CardEntry41>,
10526    #[serde(rename = "NtryDtls", skip_serializing_if = "Option::is_none")]
10527    pub ntry_dtls: Option<Vec<Box<EntryDetails91>>>,
10528    #[serde(rename = "AddtlNtryInf", skip_serializing_if = "Option::is_none")]
10529    pub addtl_ntry_inf: Option<String>,
10530}
10531
10532impl Validate for ReportEntry101 {
10533    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10534        helpers::validate_length(
10535            &self.ntry_ref,
10536            "NtryRef",
10537            Some(1),
10538            Some(16),
10539            &helpers::child_path(path, "NtryRef"),
10540            config,
10541            collector,
10542        );
10543        helpers::validate_pattern(
10544            &self.ntry_ref,
10545            "NtryRef",
10546            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]+|[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]+/)*[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]",
10547            &helpers::child_path(path, "NtryRef"),
10548            config,
10549            collector,
10550        );
10551        self.amt
10552            .validate(&helpers::child_path(path, "Amt"), config, collector);
10553        self.cdt_dbt_ind
10554            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
10555        self.sts
10556            .validate(&helpers::child_path(path, "Sts"), config, collector);
10557        if let Some(ref val) = self.bookg_dt
10558            && config.validate_optional_fields
10559        {
10560            val.validate(&helpers::child_path(path, "BookgDt"), config, collector);
10561        }
10562        if let Some(ref val) = self.val_dt
10563            && config.validate_optional_fields
10564        {
10565            val.validate(&helpers::child_path(path, "ValDt"), config, collector);
10566        }
10567        if let Some(ref val) = self.acct_svcr_ref {
10568            helpers::validate_length(
10569                val,
10570                "AcctSvcrRef",
10571                Some(1),
10572                Some(35),
10573                &helpers::child_path(path, "AcctSvcrRef"),
10574                config,
10575                collector,
10576            );
10577        }
10578        if let Some(ref vec) = self.avlbty
10579            && config.validate_optional_fields
10580        {
10581            for item in vec {
10582                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
10583            }
10584        }
10585        self.bk_tx_cd
10586            .validate(&helpers::child_path(path, "BkTxCd"), config, collector);
10587        if let Some(ref val) = self.addtl_inf_ind
10588            && config.validate_optional_fields
10589        {
10590            val.validate(&helpers::child_path(path, "AddtlInfInd"), config, collector);
10591        }
10592        if let Some(ref val) = self.amt_dtls
10593            && config.validate_optional_fields
10594        {
10595            val.validate(&helpers::child_path(path, "AmtDtls"), config, collector);
10596        }
10597        if let Some(ref val) = self.chrgs
10598            && config.validate_optional_fields
10599        {
10600            val.validate(&helpers::child_path(path, "Chrgs"), config, collector);
10601        }
10602        if let Some(ref val) = self.tech_inpt_chanl
10603            && config.validate_optional_fields
10604        {
10605            val.validate(
10606                &helpers::child_path(path, "TechInptChanl"),
10607                config,
10608                collector,
10609            );
10610        }
10611        if let Some(ref val) = self.intrst
10612            && config.validate_optional_fields
10613        {
10614            val.validate(&helpers::child_path(path, "Intrst"), config, collector);
10615        }
10616        if let Some(ref val) = self.card_tx
10617            && config.validate_optional_fields
10618        {
10619            val.validate(&helpers::child_path(path, "CardTx"), config, collector);
10620        }
10621        if let Some(ref vec) = self.ntry_dtls
10622            && config.validate_optional_fields
10623        {
10624            for item in vec {
10625                item.validate(&helpers::child_path(path, "NtryDtls"), config, collector);
10626            }
10627        }
10628        if let Some(ref val) = self.addtl_ntry_inf {
10629            helpers::validate_length(
10630                val,
10631                "AddtlNtryInf",
10632                Some(1),
10633                Some(500),
10634                &helpers::child_path(path, "AddtlNtryInf"),
10635                config,
10636                collector,
10637            );
10638        }
10639        if let Some(ref val) = self.addtl_ntry_inf {
10640            helpers::validate_pattern(
10641                val,
10642                "AddtlNtryInf",
10643                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10644                &helpers::child_path(path, "AddtlNtryInf"),
10645                config,
10646                collector,
10647            );
10648        }
10649    }
10650}
10651
10652// ReportingSource1Choice1: Reporting source, in a proprietary form.
10653#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10654pub struct ReportingSource1Choice1 {
10655    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10656    pub cd: Option<String>,
10657    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10658    pub prtry: Option<String>,
10659}
10660
10661impl Validate for ReportingSource1Choice1 {
10662    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10663        if let Some(ref val) = self.cd {
10664            helpers::validate_length(
10665                val,
10666                "Cd",
10667                Some(1),
10668                Some(4),
10669                &helpers::child_path(path, "Cd"),
10670                config,
10671                collector,
10672            );
10673        }
10674        if let Some(ref val) = self.prtry {
10675            helpers::validate_length(
10676                val,
10677                "Prtry",
10678                Some(1),
10679                Some(35),
10680                &helpers::child_path(path, "Prtry"),
10681                config,
10682                collector,
10683            );
10684        }
10685        if let Some(ref val) = self.prtry {
10686            helpers::validate_pattern(
10687                val,
10688                "Prtry",
10689                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10690                &helpers::child_path(path, "Prtry"),
10691                config,
10692                collector,
10693            );
10694        }
10695    }
10696}
10697
10698// ReturnReason5Choice1: Reason for the return, in a proprietary form.
10699#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10700pub struct ReturnReason5Choice1 {
10701    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10702    pub cd: Option<String>,
10703    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10704    pub prtry: Option<String>,
10705}
10706
10707impl Validate for ReturnReason5Choice1 {
10708    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10709        if let Some(ref val) = self.cd {
10710            helpers::validate_length(
10711                val,
10712                "Cd",
10713                Some(1),
10714                Some(4),
10715                &helpers::child_path(path, "Cd"),
10716                config,
10717                collector,
10718            );
10719        }
10720        if let Some(ref val) = self.prtry {
10721            helpers::validate_length(
10722                val,
10723                "Prtry",
10724                Some(1),
10725                Some(35),
10726                &helpers::child_path(path, "Prtry"),
10727                config,
10728                collector,
10729            );
10730        }
10731        if let Some(ref val) = self.prtry {
10732            helpers::validate_pattern(
10733                val,
10734                "Prtry",
10735                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10736                &helpers::child_path(path, "Prtry"),
10737                config,
10738                collector,
10739            );
10740        }
10741    }
10742}
10743
10744// SecuritiesAccount191: Description of the account.
10745#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10746pub struct SecuritiesAccount191 {
10747    #[serde(rename = "Id")]
10748    pub id: String,
10749    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10750    pub tp: Option<GenericIdentification302>,
10751    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
10752    pub nm: Option<String>,
10753}
10754
10755impl Validate for SecuritiesAccount191 {
10756    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10757        helpers::validate_length(
10758            &self.id,
10759            "Id",
10760            Some(1),
10761            Some(35),
10762            &helpers::child_path(path, "Id"),
10763            config,
10764            collector,
10765        );
10766        helpers::validate_pattern(
10767            &self.id,
10768            "Id",
10769            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10770            &helpers::child_path(path, "Id"),
10771            config,
10772            collector,
10773        );
10774        if let Some(ref val) = self.tp
10775            && config.validate_optional_fields
10776        {
10777            val.validate(&helpers::child_path(path, "Tp"), config, collector);
10778        }
10779        if let Some(ref val) = self.nm {
10780            helpers::validate_length(
10781                val,
10782                "Nm",
10783                Some(1),
10784                Some(70),
10785                &helpers::child_path(path, "Nm"),
10786                config,
10787                collector,
10788            );
10789        }
10790        if let Some(ref val) = self.nm {
10791            helpers::validate_pattern(
10792                val,
10793                "Nm",
10794                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10795                &helpers::child_path(path, "Nm"),
10796                config,
10797                collector,
10798            );
10799        }
10800    }
10801}
10802
10803// SecurityIdentification191: Textual description of a security instrument.
10804#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10805pub struct SecurityIdentification191 {
10806    #[serde(rename = "ISIN", skip_serializing_if = "Option::is_none")]
10807    pub isin: Option<String>,
10808    #[serde(rename = "OthrId", skip_serializing_if = "Option::is_none")]
10809    pub othr_id: Option<Vec<OtherIdentification11>>,
10810    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
10811    pub desc: Option<String>,
10812}
10813
10814impl Validate for SecurityIdentification191 {
10815    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10816        if let Some(ref val) = self.isin {
10817            helpers::validate_pattern(
10818                val,
10819                "ISIN",
10820                "[A-Z]{2,2}[A-Z0-9]{9,9}[0-9]{1,1}",
10821                &helpers::child_path(path, "ISIN"),
10822                config,
10823                collector,
10824            );
10825        }
10826        if let Some(ref vec) = self.othr_id
10827            && config.validate_optional_fields
10828        {
10829            for item in vec {
10830                item.validate(&helpers::child_path(path, "OthrId"), config, collector);
10831            }
10832        }
10833        if let Some(ref val) = self.desc {
10834            helpers::validate_length(
10835                val,
10836                "Desc",
10837                Some(1),
10838                Some(140),
10839                &helpers::child_path(path, "Desc"),
10840                config,
10841                collector,
10842            );
10843        }
10844        if let Some(ref val) = self.desc {
10845            helpers::validate_pattern(
10846                val,
10847                "Desc",
10848                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10849                &helpers::child_path(path, "Desc"),
10850                config,
10851                collector,
10852            );
10853        }
10854    }
10855}
10856
10857// SequenceRange1Choice1: Specified sequence to be excluded.
10858#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10859pub struct SequenceRange1Choice1 {
10860    #[serde(rename = "FrSeq", skip_serializing_if = "Option::is_none")]
10861    pub fr_seq: Option<String>,
10862    #[serde(rename = "ToSeq", skip_serializing_if = "Option::is_none")]
10863    pub to_seq: Option<String>,
10864    #[serde(rename = "FrToSeq", skip_serializing_if = "Option::is_none")]
10865    pub fr_to_seq: Option<Vec<SequenceRange11>>,
10866    #[serde(rename = "EQSeq", skip_serializing_if = "Option::is_none")]
10867    pub eq_seq: Option<Vec<String>>,
10868    #[serde(rename = "NEQSeq", skip_serializing_if = "Option::is_none")]
10869    pub neq_seq: Option<Vec<String>>,
10870}
10871
10872impl Validate for SequenceRange1Choice1 {
10873    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10874        if let Some(ref val) = self.fr_seq {
10875            helpers::validate_length(
10876                val,
10877                "FrSeq",
10878                Some(1),
10879                Some(35),
10880                &helpers::child_path(path, "FrSeq"),
10881                config,
10882                collector,
10883            );
10884        }
10885        if let Some(ref val) = self.fr_seq {
10886            helpers::validate_pattern(
10887                val,
10888                "FrSeq",
10889                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10890                &helpers::child_path(path, "FrSeq"),
10891                config,
10892                collector,
10893            );
10894        }
10895        if let Some(ref val) = self.to_seq {
10896            helpers::validate_length(
10897                val,
10898                "ToSeq",
10899                Some(1),
10900                Some(35),
10901                &helpers::child_path(path, "ToSeq"),
10902                config,
10903                collector,
10904            );
10905        }
10906        if let Some(ref val) = self.to_seq {
10907            helpers::validate_pattern(
10908                val,
10909                "ToSeq",
10910                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10911                &helpers::child_path(path, "ToSeq"),
10912                config,
10913                collector,
10914            );
10915        }
10916        if let Some(ref vec) = self.fr_to_seq
10917            && config.validate_optional_fields
10918        {
10919            for item in vec {
10920                item.validate(&helpers::child_path(path, "FrToSeq"), config, collector);
10921            }
10922        }
10923        if let Some(ref vec) = self.eq_seq {
10924            for item in vec {
10925                helpers::validate_length(
10926                    item,
10927                    "EQSeq",
10928                    Some(1),
10929                    Some(35),
10930                    &helpers::child_path(path, "EQSeq"),
10931                    config,
10932                    collector,
10933                );
10934            }
10935        }
10936        if let Some(ref vec) = self.eq_seq {
10937            for item in vec {
10938                helpers::validate_pattern(
10939                    item,
10940                    "EQSeq",
10941                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10942                    &helpers::child_path(path, "EQSeq"),
10943                    config,
10944                    collector,
10945                );
10946            }
10947        }
10948        if let Some(ref vec) = self.neq_seq {
10949            for item in vec {
10950                helpers::validate_length(
10951                    item,
10952                    "NEQSeq",
10953                    Some(1),
10954                    Some(35),
10955                    &helpers::child_path(path, "NEQSeq"),
10956                    config,
10957                    collector,
10958                );
10959            }
10960        }
10961        if let Some(ref vec) = self.neq_seq {
10962            for item in vec {
10963                helpers::validate_pattern(
10964                    item,
10965                    "NEQSeq",
10966                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
10967                    &helpers::child_path(path, "NEQSeq"),
10968                    config,
10969                    collector,
10970                );
10971            }
10972        }
10973    }
10974}
10975
10976// SequenceRange11: End sequence of the range.
10977#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10978pub struct SequenceRange11 {
10979    #[serde(rename = "FrSeq")]
10980    pub fr_seq: String,
10981    #[serde(rename = "ToSeq")]
10982    pub to_seq: String,
10983}
10984
10985impl Validate for SequenceRange11 {
10986    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
10987        helpers::validate_length(
10988            &self.fr_seq,
10989            "FrSeq",
10990            Some(1),
10991            Some(35),
10992            &helpers::child_path(path, "FrSeq"),
10993            config,
10994            collector,
10995        );
10996        helpers::validate_pattern(
10997            &self.fr_seq,
10998            "FrSeq",
10999            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11000            &helpers::child_path(path, "FrSeq"),
11001            config,
11002            collector,
11003        );
11004        helpers::validate_length(
11005            &self.to_seq,
11006            "ToSeq",
11007            Some(1),
11008            Some(35),
11009            &helpers::child_path(path, "ToSeq"),
11010            config,
11011            collector,
11012        );
11013        helpers::validate_pattern(
11014            &self.to_seq,
11015            "ToSeq",
11016            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11017            &helpers::child_path(path, "ToSeq"),
11018            config,
11019            collector,
11020        );
11021    }
11022}
11023
11024// StructuredRemittanceInformation161: Additional information, in free text form, to complement the structured remittance information.
11025#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11026pub struct StructuredRemittanceInformation161 {
11027    #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
11028    pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
11029    #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
11030    pub rfrd_doc_amt: Option<RemittanceAmount21>,
11031    #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
11032    pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
11033    #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
11034    pub invcr: Option<PartyIdentification1358>,
11035    #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
11036    pub invcee: Option<PartyIdentification1358>,
11037    #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
11038    pub tax_rmt: Option<TaxInformation71>,
11039    #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
11040    pub grnshmt_rmt: Option<Garnishment31>,
11041    #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
11042    pub addtl_rmt_inf: Option<Vec<String>>,
11043}
11044
11045impl Validate for StructuredRemittanceInformation161 {
11046    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11047        if let Some(ref vec) = self.rfrd_doc_inf
11048            && config.validate_optional_fields
11049        {
11050            for item in vec {
11051                item.validate(&helpers::child_path(path, "RfrdDocInf"), config, collector);
11052            }
11053        }
11054        if let Some(ref val) = self.rfrd_doc_amt
11055            && config.validate_optional_fields
11056        {
11057            val.validate(&helpers::child_path(path, "RfrdDocAmt"), config, collector);
11058        }
11059        if let Some(ref val) = self.cdtr_ref_inf
11060            && config.validate_optional_fields
11061        {
11062            val.validate(&helpers::child_path(path, "CdtrRefInf"), config, collector);
11063        }
11064        if let Some(ref val) = self.invcr
11065            && config.validate_optional_fields
11066        {
11067            val.validate(&helpers::child_path(path, "Invcr"), config, collector);
11068        }
11069        if let Some(ref val) = self.invcee
11070            && config.validate_optional_fields
11071        {
11072            val.validate(&helpers::child_path(path, "Invcee"), config, collector);
11073        }
11074        if let Some(ref val) = self.tax_rmt
11075            && config.validate_optional_fields
11076        {
11077            val.validate(&helpers::child_path(path, "TaxRmt"), config, collector);
11078        }
11079        if let Some(ref val) = self.grnshmt_rmt
11080            && config.validate_optional_fields
11081        {
11082            val.validate(&helpers::child_path(path, "GrnshmtRmt"), config, collector);
11083        }
11084        if let Some(ref vec) = self.addtl_rmt_inf {
11085            for item in vec {
11086                helpers::validate_length(
11087                    item,
11088                    "AddtlRmtInf",
11089                    Some(1),
11090                    Some(140),
11091                    &helpers::child_path(path, "AddtlRmtInf"),
11092                    config,
11093                    collector,
11094                );
11095            }
11096        }
11097        if let Some(ref vec) = self.addtl_rmt_inf {
11098            for item in vec {
11099                helpers::validate_pattern(
11100                    item,
11101                    "AddtlRmtInf",
11102                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11103                    &helpers::child_path(path, "AddtlRmtInf"),
11104                    config,
11105                    collector,
11106                );
11107            }
11108        }
11109    }
11110}
11111
11112// TaxAmount2: Set of elements used to provide details on the tax period and amount.
11113#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11114pub struct TaxAmount2 {
11115    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
11116    pub rate: Option<f64>,
11117    #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11118    pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11119    #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
11120    pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11121    #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
11122    pub dtls: Option<Vec<TaxRecordDetails2>>,
11123}
11124
11125impl Validate for TaxAmount2 {
11126    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11127        if let Some(ref val) = self.taxbl_base_amt
11128            && config.validate_optional_fields
11129        {
11130            val.validate(
11131                &helpers::child_path(path, "TaxblBaseAmt"),
11132                config,
11133                collector,
11134            );
11135        }
11136        if let Some(ref val) = self.ttl_amt
11137            && config.validate_optional_fields
11138        {
11139            val.validate(&helpers::child_path(path, "TtlAmt"), config, collector);
11140        }
11141        if let Some(ref vec) = self.dtls
11142            && config.validate_optional_fields
11143        {
11144            for item in vec {
11145                item.validate(&helpers::child_path(path, "Dtls"), config, collector);
11146            }
11147        }
11148    }
11149}
11150
11151// TaxAmountAndType11: Amount of money, which has been typed.
11152#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11153pub struct TaxAmountAndType11 {
11154    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11155    pub tp: Option<TaxAmountType1Choice1>,
11156    #[serde(rename = "Amt")]
11157    pub amt: ActiveOrHistoricCurrencyAndAmount,
11158}
11159
11160impl Validate for TaxAmountAndType11 {
11161    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11162        if let Some(ref val) = self.tp
11163            && config.validate_optional_fields
11164        {
11165            val.validate(&helpers::child_path(path, "Tp"), config, collector);
11166        }
11167        self.amt
11168            .validate(&helpers::child_path(path, "Amt"), config, collector);
11169    }
11170}
11171
11172// TaxAmountType1Choice1: Specifies the amount type, in a free-text form.
11173#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11174pub struct TaxAmountType1Choice1 {
11175    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
11176    pub cd: Option<String>,
11177    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11178    pub prtry: Option<String>,
11179}
11180
11181impl Validate for TaxAmountType1Choice1 {
11182    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11183        if let Some(ref val) = self.cd {
11184            helpers::validate_length(
11185                val,
11186                "Cd",
11187                Some(1),
11188                Some(4),
11189                &helpers::child_path(path, "Cd"),
11190                config,
11191                collector,
11192            );
11193        }
11194        if let Some(ref val) = self.prtry {
11195            helpers::validate_length(
11196                val,
11197                "Prtry",
11198                Some(1),
11199                Some(35),
11200                &helpers::child_path(path, "Prtry"),
11201                config,
11202                collector,
11203            );
11204        }
11205        if let Some(ref val) = self.prtry {
11206            helpers::validate_pattern(
11207                val,
11208                "Prtry",
11209                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11210                &helpers::child_path(path, "Prtry"),
11211                config,
11212                collector,
11213            );
11214        }
11215    }
11216}
11217
11218// TaxAuthorisation11: Name of the debtor or the debtor's authorised representative.
11219#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11220pub struct TaxAuthorisation11 {
11221    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
11222    pub titl: Option<String>,
11223    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
11224    pub nm: Option<String>,
11225}
11226
11227impl Validate for TaxAuthorisation11 {
11228    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11229        if let Some(ref val) = self.titl {
11230            helpers::validate_length(
11231                val,
11232                "Titl",
11233                Some(1),
11234                Some(35),
11235                &helpers::child_path(path, "Titl"),
11236                config,
11237                collector,
11238            );
11239        }
11240        if let Some(ref val) = self.titl {
11241            helpers::validate_pattern(
11242                val,
11243                "Titl",
11244                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11245                &helpers::child_path(path, "Titl"),
11246                config,
11247                collector,
11248            );
11249        }
11250        if let Some(ref val) = self.nm {
11251            helpers::validate_length(
11252                val,
11253                "Nm",
11254                Some(1),
11255                Some(140),
11256                &helpers::child_path(path, "Nm"),
11257                config,
11258                collector,
11259            );
11260        }
11261        if let Some(ref val) = self.nm {
11262            helpers::validate_pattern(
11263                val,
11264                "Nm",
11265                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11266                &helpers::child_path(path, "Nm"),
11267                config,
11268                collector,
11269            );
11270        }
11271    }
11272}
11273
11274// TaxAuthorisation12: Name of the debtor or the debtor's authorised representative.
11275#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11276pub struct TaxAuthorisation12 {
11277    #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
11278    pub titl: Option<String>,
11279    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
11280    pub nm: Option<String>,
11281}
11282
11283impl Validate for TaxAuthorisation12 {
11284    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11285        if let Some(ref val) = self.titl {
11286            helpers::validate_length(
11287                val,
11288                "Titl",
11289                Some(1),
11290                Some(35),
11291                &helpers::child_path(path, "Titl"),
11292                config,
11293                collector,
11294            );
11295        }
11296        if let Some(ref val) = self.titl {
11297            helpers::validate_pattern(
11298                val,
11299                "Titl",
11300                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11301                &helpers::child_path(path, "Titl"),
11302                config,
11303                collector,
11304            );
11305        }
11306        if let Some(ref val) = self.nm {
11307            helpers::validate_length(
11308                val,
11309                "Nm",
11310                Some(1),
11311                Some(140),
11312                &helpers::child_path(path, "Nm"),
11313                config,
11314                collector,
11315            );
11316        }
11317        if let Some(ref val) = self.nm {
11318            helpers::validate_pattern(
11319                val,
11320                "Nm",
11321                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11322                &helpers::child_path(path, "Nm"),
11323                config,
11324                collector,
11325            );
11326        }
11327    }
11328}
11329
11330// TaxCharges21: Amount of money resulting from the calculation of the tax.
11331#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11332pub struct TaxCharges21 {
11333    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
11334    pub id: Option<String>,
11335    #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
11336    pub rate: Option<f64>,
11337    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
11338    pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11339}
11340
11341impl Validate for TaxCharges21 {
11342    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11343        if let Some(ref val) = self.id {
11344            helpers::validate_length(
11345                val,
11346                "Id",
11347                Some(1),
11348                Some(35),
11349                &helpers::child_path(path, "Id"),
11350                config,
11351                collector,
11352            );
11353        }
11354        if let Some(ref val) = self.id {
11355            helpers::validate_pattern(
11356                val,
11357                "Id",
11358                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11359                &helpers::child_path(path, "Id"),
11360                config,
11361                collector,
11362            );
11363        }
11364        if let Some(ref val) = self.amt
11365            && config.validate_optional_fields
11366        {
11367            val.validate(&helpers::child_path(path, "Amt"), config, collector);
11368        }
11369    }
11370}
11371
11372// TaxInformation71: Record of tax details.
11373#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11374pub struct TaxInformation71 {
11375    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11376    pub cdtr: Option<TaxParty11>,
11377    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11378    pub dbtr: Option<TaxParty21>,
11379    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
11380    pub ultmt_dbtr: Option<TaxParty21>,
11381    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
11382    pub admstn_zone: Option<String>,
11383    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
11384    pub ref_nb: Option<String>,
11385    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
11386    pub mtd: Option<String>,
11387    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11388    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11389    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
11390    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11391    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
11392    pub dt: Option<String>,
11393    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
11394    pub seq_nb: Option<f64>,
11395    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11396    pub rcrd: Option<Vec<TaxRecord21>>,
11397}
11398
11399impl Validate for TaxInformation71 {
11400    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11401        if let Some(ref val) = self.cdtr
11402            && config.validate_optional_fields
11403        {
11404            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
11405        }
11406        if let Some(ref val) = self.dbtr
11407            && config.validate_optional_fields
11408        {
11409            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
11410        }
11411        if let Some(ref val) = self.ultmt_dbtr
11412            && config.validate_optional_fields
11413        {
11414            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
11415        }
11416        if let Some(ref val) = self.admstn_zone {
11417            helpers::validate_length(
11418                val,
11419                "AdmstnZone",
11420                Some(1),
11421                Some(35),
11422                &helpers::child_path(path, "AdmstnZone"),
11423                config,
11424                collector,
11425            );
11426        }
11427        if let Some(ref val) = self.admstn_zone {
11428            helpers::validate_pattern(
11429                val,
11430                "AdmstnZone",
11431                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11432                &helpers::child_path(path, "AdmstnZone"),
11433                config,
11434                collector,
11435            );
11436        }
11437        if let Some(ref val) = self.ref_nb {
11438            helpers::validate_length(
11439                val,
11440                "RefNb",
11441                Some(1),
11442                Some(140),
11443                &helpers::child_path(path, "RefNb"),
11444                config,
11445                collector,
11446            );
11447        }
11448        if let Some(ref val) = self.ref_nb {
11449            helpers::validate_pattern(
11450                val,
11451                "RefNb",
11452                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11453                &helpers::child_path(path, "RefNb"),
11454                config,
11455                collector,
11456            );
11457        }
11458        if let Some(ref val) = self.mtd {
11459            helpers::validate_length(
11460                val,
11461                "Mtd",
11462                Some(1),
11463                Some(35),
11464                &helpers::child_path(path, "Mtd"),
11465                config,
11466                collector,
11467            );
11468        }
11469        if let Some(ref val) = self.mtd {
11470            helpers::validate_pattern(
11471                val,
11472                "Mtd",
11473                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11474                &helpers::child_path(path, "Mtd"),
11475                config,
11476                collector,
11477            );
11478        }
11479        if let Some(ref val) = self.ttl_taxbl_base_amt
11480            && config.validate_optional_fields
11481        {
11482            val.validate(
11483                &helpers::child_path(path, "TtlTaxblBaseAmt"),
11484                config,
11485                collector,
11486            );
11487        }
11488        if let Some(ref val) = self.ttl_tax_amt
11489            && config.validate_optional_fields
11490        {
11491            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
11492        }
11493        if let Some(ref vec) = self.rcrd
11494            && config.validate_optional_fields
11495        {
11496            for item in vec {
11497                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
11498            }
11499        }
11500    }
11501}
11502
11503// TaxInformation81: Record of tax details.
11504#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11505pub struct TaxInformation81 {
11506    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11507    pub cdtr: Option<TaxParty12>,
11508    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11509    pub dbtr: Option<TaxParty22>,
11510    #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
11511    pub admstn_zone: Option<String>,
11512    #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
11513    pub ref_nb: Option<String>,
11514    #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
11515    pub mtd: Option<String>,
11516    #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11517    pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11518    #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
11519    pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11520    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
11521    pub dt: Option<String>,
11522    #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
11523    pub seq_nb: Option<f64>,
11524    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11525    pub rcrd: Option<Vec<TaxRecord22>>,
11526}
11527
11528impl Validate for TaxInformation81 {
11529    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11530        if let Some(ref val) = self.cdtr
11531            && config.validate_optional_fields
11532        {
11533            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
11534        }
11535        if let Some(ref val) = self.dbtr
11536            && config.validate_optional_fields
11537        {
11538            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
11539        }
11540        if let Some(ref val) = self.admstn_zone {
11541            helpers::validate_length(
11542                val,
11543                "AdmstnZone",
11544                Some(1),
11545                Some(35),
11546                &helpers::child_path(path, "AdmstnZone"),
11547                config,
11548                collector,
11549            );
11550        }
11551        if let Some(ref val) = self.admstn_zone {
11552            helpers::validate_pattern(
11553                val,
11554                "AdmstnZone",
11555                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11556                &helpers::child_path(path, "AdmstnZone"),
11557                config,
11558                collector,
11559            );
11560        }
11561        if let Some(ref val) = self.ref_nb {
11562            helpers::validate_length(
11563                val,
11564                "RefNb",
11565                Some(1),
11566                Some(140),
11567                &helpers::child_path(path, "RefNb"),
11568                config,
11569                collector,
11570            );
11571        }
11572        if let Some(ref val) = self.ref_nb {
11573            helpers::validate_pattern(
11574                val,
11575                "RefNb",
11576                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11577                &helpers::child_path(path, "RefNb"),
11578                config,
11579                collector,
11580            );
11581        }
11582        if let Some(ref val) = self.mtd {
11583            helpers::validate_length(
11584                val,
11585                "Mtd",
11586                Some(1),
11587                Some(35),
11588                &helpers::child_path(path, "Mtd"),
11589                config,
11590                collector,
11591            );
11592        }
11593        if let Some(ref val) = self.mtd {
11594            helpers::validate_pattern(
11595                val,
11596                "Mtd",
11597                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11598                &helpers::child_path(path, "Mtd"),
11599                config,
11600                collector,
11601            );
11602        }
11603        if let Some(ref val) = self.ttl_taxbl_base_amt
11604            && config.validate_optional_fields
11605        {
11606            val.validate(
11607                &helpers::child_path(path, "TtlTaxblBaseAmt"),
11608                config,
11609                collector,
11610            );
11611        }
11612        if let Some(ref val) = self.ttl_tax_amt
11613            && config.validate_optional_fields
11614        {
11615            val.validate(&helpers::child_path(path, "TtlTaxAmt"), config, collector);
11616        }
11617        if let Some(ref vec) = self.rcrd
11618            && config.validate_optional_fields
11619        {
11620            for item in vec {
11621                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
11622            }
11623        }
11624    }
11625}
11626
11627// TaxParty11: Type of tax payer.
11628#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11629pub struct TaxParty11 {
11630    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11631    pub tax_id: Option<String>,
11632    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11633    pub regn_id: Option<String>,
11634    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11635    pub tax_tp: Option<String>,
11636}
11637
11638impl Validate for TaxParty11 {
11639    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11640        if let Some(ref val) = self.tax_id {
11641            helpers::validate_length(
11642                val,
11643                "TaxId",
11644                Some(1),
11645                Some(35),
11646                &helpers::child_path(path, "TaxId"),
11647                config,
11648                collector,
11649            );
11650        }
11651        if let Some(ref val) = self.tax_id {
11652            helpers::validate_pattern(
11653                val,
11654                "TaxId",
11655                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11656                &helpers::child_path(path, "TaxId"),
11657                config,
11658                collector,
11659            );
11660        }
11661        if let Some(ref val) = self.regn_id {
11662            helpers::validate_length(
11663                val,
11664                "RegnId",
11665                Some(1),
11666                Some(35),
11667                &helpers::child_path(path, "RegnId"),
11668                config,
11669                collector,
11670            );
11671        }
11672        if let Some(ref val) = self.regn_id {
11673            helpers::validate_pattern(
11674                val,
11675                "RegnId",
11676                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11677                &helpers::child_path(path, "RegnId"),
11678                config,
11679                collector,
11680            );
11681        }
11682        if let Some(ref val) = self.tax_tp {
11683            helpers::validate_length(
11684                val,
11685                "TaxTp",
11686                Some(1),
11687                Some(35),
11688                &helpers::child_path(path, "TaxTp"),
11689                config,
11690                collector,
11691            );
11692        }
11693        if let Some(ref val) = self.tax_tp {
11694            helpers::validate_pattern(
11695                val,
11696                "TaxTp",
11697                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11698                &helpers::child_path(path, "TaxTp"),
11699                config,
11700                collector,
11701            );
11702        }
11703    }
11704}
11705
11706// TaxParty12: Type of tax payer.
11707#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11708pub struct TaxParty12 {
11709    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11710    pub tax_id: Option<String>,
11711    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11712    pub regn_id: Option<String>,
11713    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11714    pub tax_tp: Option<String>,
11715}
11716
11717impl Validate for TaxParty12 {
11718    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11719        if let Some(ref val) = self.tax_id {
11720            helpers::validate_length(
11721                val,
11722                "TaxId",
11723                Some(1),
11724                Some(35),
11725                &helpers::child_path(path, "TaxId"),
11726                config,
11727                collector,
11728            );
11729        }
11730        if let Some(ref val) = self.tax_id {
11731            helpers::validate_pattern(
11732                val,
11733                "TaxId",
11734                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11735                &helpers::child_path(path, "TaxId"),
11736                config,
11737                collector,
11738            );
11739        }
11740        if let Some(ref val) = self.regn_id {
11741            helpers::validate_length(
11742                val,
11743                "RegnId",
11744                Some(1),
11745                Some(35),
11746                &helpers::child_path(path, "RegnId"),
11747                config,
11748                collector,
11749            );
11750        }
11751        if let Some(ref val) = self.regn_id {
11752            helpers::validate_pattern(
11753                val,
11754                "RegnId",
11755                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11756                &helpers::child_path(path, "RegnId"),
11757                config,
11758                collector,
11759            );
11760        }
11761        if let Some(ref val) = self.tax_tp {
11762            helpers::validate_length(
11763                val,
11764                "TaxTp",
11765                Some(1),
11766                Some(35),
11767                &helpers::child_path(path, "TaxTp"),
11768                config,
11769                collector,
11770            );
11771        }
11772        if let Some(ref val) = self.tax_tp {
11773            helpers::validate_pattern(
11774                val,
11775                "TaxTp",
11776                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11777                &helpers::child_path(path, "TaxTp"),
11778                config,
11779                collector,
11780            );
11781        }
11782    }
11783}
11784
11785// TaxParty21: Details of the authorised tax paying party.
11786#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11787pub struct TaxParty21 {
11788    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11789    pub tax_id: Option<String>,
11790    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11791    pub regn_id: Option<String>,
11792    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11793    pub tax_tp: Option<String>,
11794    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
11795    pub authstn: Option<TaxAuthorisation11>,
11796}
11797
11798impl Validate for TaxParty21 {
11799    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11800        if let Some(ref val) = self.tax_id {
11801            helpers::validate_length(
11802                val,
11803                "TaxId",
11804                Some(1),
11805                Some(35),
11806                &helpers::child_path(path, "TaxId"),
11807                config,
11808                collector,
11809            );
11810        }
11811        if let Some(ref val) = self.tax_id {
11812            helpers::validate_pattern(
11813                val,
11814                "TaxId",
11815                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11816                &helpers::child_path(path, "TaxId"),
11817                config,
11818                collector,
11819            );
11820        }
11821        if let Some(ref val) = self.regn_id {
11822            helpers::validate_length(
11823                val,
11824                "RegnId",
11825                Some(1),
11826                Some(35),
11827                &helpers::child_path(path, "RegnId"),
11828                config,
11829                collector,
11830            );
11831        }
11832        if let Some(ref val) = self.regn_id {
11833            helpers::validate_pattern(
11834                val,
11835                "RegnId",
11836                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11837                &helpers::child_path(path, "RegnId"),
11838                config,
11839                collector,
11840            );
11841        }
11842        if let Some(ref val) = self.tax_tp {
11843            helpers::validate_length(
11844                val,
11845                "TaxTp",
11846                Some(1),
11847                Some(35),
11848                &helpers::child_path(path, "TaxTp"),
11849                config,
11850                collector,
11851            );
11852        }
11853        if let Some(ref val) = self.tax_tp {
11854            helpers::validate_pattern(
11855                val,
11856                "TaxTp",
11857                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11858                &helpers::child_path(path, "TaxTp"),
11859                config,
11860                collector,
11861            );
11862        }
11863        if let Some(ref val) = self.authstn
11864            && config.validate_optional_fields
11865        {
11866            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
11867        }
11868    }
11869}
11870
11871// TaxParty22: Details of the authorised tax paying party.
11872#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11873pub struct TaxParty22 {
11874    #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11875    pub tax_id: Option<String>,
11876    #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11877    pub regn_id: Option<String>,
11878    #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11879    pub tax_tp: Option<String>,
11880    #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
11881    pub authstn: Option<TaxAuthorisation12>,
11882}
11883
11884impl Validate for TaxParty22 {
11885    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11886        if let Some(ref val) = self.tax_id {
11887            helpers::validate_length(
11888                val,
11889                "TaxId",
11890                Some(1),
11891                Some(35),
11892                &helpers::child_path(path, "TaxId"),
11893                config,
11894                collector,
11895            );
11896        }
11897        if let Some(ref val) = self.tax_id {
11898            helpers::validate_pattern(
11899                val,
11900                "TaxId",
11901                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11902                &helpers::child_path(path, "TaxId"),
11903                config,
11904                collector,
11905            );
11906        }
11907        if let Some(ref val) = self.regn_id {
11908            helpers::validate_length(
11909                val,
11910                "RegnId",
11911                Some(1),
11912                Some(35),
11913                &helpers::child_path(path, "RegnId"),
11914                config,
11915                collector,
11916            );
11917        }
11918        if let Some(ref val) = self.regn_id {
11919            helpers::validate_pattern(
11920                val,
11921                "RegnId",
11922                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11923                &helpers::child_path(path, "RegnId"),
11924                config,
11925                collector,
11926            );
11927        }
11928        if let Some(ref val) = self.tax_tp {
11929            helpers::validate_length(
11930                val,
11931                "TaxTp",
11932                Some(1),
11933                Some(35),
11934                &helpers::child_path(path, "TaxTp"),
11935                config,
11936                collector,
11937            );
11938        }
11939        if let Some(ref val) = self.tax_tp {
11940            helpers::validate_pattern(
11941                val,
11942                "TaxTp",
11943                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
11944                &helpers::child_path(path, "TaxTp"),
11945                config,
11946                collector,
11947            );
11948        }
11949        if let Some(ref val) = self.authstn
11950            && config.validate_optional_fields
11951        {
11952            val.validate(&helpers::child_path(path, "Authstn"), config, collector);
11953        }
11954    }
11955}
11956
11957// TaxPeriod2: Range of time between a start date and an end date for which the tax report is provided.
11958#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11959pub struct TaxPeriod2 {
11960    #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
11961    pub yr: Option<String>,
11962    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11963    pub tp: Option<TaxRecordPeriod1Code>,
11964    #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
11965    pub fr_to_dt: Option<DatePeriod2>,
11966}
11967
11968impl Validate for TaxPeriod2 {
11969    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
11970        if let Some(ref val) = self.tp
11971            && config.validate_optional_fields
11972        {
11973            val.validate(&helpers::child_path(path, "Tp"), config, collector);
11974        }
11975        if let Some(ref val) = self.fr_to_dt
11976            && config.validate_optional_fields
11977        {
11978            val.validate(&helpers::child_path(path, "FrToDt"), config, collector);
11979        }
11980    }
11981}
11982
11983// TaxRecord21: Further details of the tax record.
11984#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11985pub struct TaxRecord21 {
11986    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11987    pub tp: Option<String>,
11988    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
11989    pub ctgy: Option<String>,
11990    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
11991    pub ctgy_dtls: Option<String>,
11992    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
11993    pub dbtr_sts: Option<String>,
11994    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
11995    pub cert_id: Option<String>,
11996    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
11997    pub frms_cd: Option<String>,
11998    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
11999    pub prd: Option<TaxPeriod2>,
12000    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
12001    pub tax_amt: Option<TaxAmount2>,
12002    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
12003    pub addtl_inf: Option<String>,
12004}
12005
12006impl Validate for TaxRecord21 {
12007    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12008        if let Some(ref val) = self.tp {
12009            helpers::validate_length(
12010                val,
12011                "Tp",
12012                Some(1),
12013                Some(35),
12014                &helpers::child_path(path, "Tp"),
12015                config,
12016                collector,
12017            );
12018        }
12019        if let Some(ref val) = self.tp {
12020            helpers::validate_pattern(
12021                val,
12022                "Tp",
12023                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12024                &helpers::child_path(path, "Tp"),
12025                config,
12026                collector,
12027            );
12028        }
12029        if let Some(ref val) = self.ctgy {
12030            helpers::validate_length(
12031                val,
12032                "Ctgy",
12033                Some(1),
12034                Some(35),
12035                &helpers::child_path(path, "Ctgy"),
12036                config,
12037                collector,
12038            );
12039        }
12040        if let Some(ref val) = self.ctgy {
12041            helpers::validate_pattern(
12042                val,
12043                "Ctgy",
12044                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12045                &helpers::child_path(path, "Ctgy"),
12046                config,
12047                collector,
12048            );
12049        }
12050        if let Some(ref val) = self.ctgy_dtls {
12051            helpers::validate_length(
12052                val,
12053                "CtgyDtls",
12054                Some(1),
12055                Some(35),
12056                &helpers::child_path(path, "CtgyDtls"),
12057                config,
12058                collector,
12059            );
12060        }
12061        if let Some(ref val) = self.ctgy_dtls {
12062            helpers::validate_pattern(
12063                val,
12064                "CtgyDtls",
12065                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12066                &helpers::child_path(path, "CtgyDtls"),
12067                config,
12068                collector,
12069            );
12070        }
12071        if let Some(ref val) = self.dbtr_sts {
12072            helpers::validate_length(
12073                val,
12074                "DbtrSts",
12075                Some(1),
12076                Some(35),
12077                &helpers::child_path(path, "DbtrSts"),
12078                config,
12079                collector,
12080            );
12081        }
12082        if let Some(ref val) = self.dbtr_sts {
12083            helpers::validate_pattern(
12084                val,
12085                "DbtrSts",
12086                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12087                &helpers::child_path(path, "DbtrSts"),
12088                config,
12089                collector,
12090            );
12091        }
12092        if let Some(ref val) = self.cert_id {
12093            helpers::validate_length(
12094                val,
12095                "CertId",
12096                Some(1),
12097                Some(35),
12098                &helpers::child_path(path, "CertId"),
12099                config,
12100                collector,
12101            );
12102        }
12103        if let Some(ref val) = self.cert_id {
12104            helpers::validate_pattern(
12105                val,
12106                "CertId",
12107                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12108                &helpers::child_path(path, "CertId"),
12109                config,
12110                collector,
12111            );
12112        }
12113        if let Some(ref val) = self.frms_cd {
12114            helpers::validate_length(
12115                val,
12116                "FrmsCd",
12117                Some(1),
12118                Some(35),
12119                &helpers::child_path(path, "FrmsCd"),
12120                config,
12121                collector,
12122            );
12123        }
12124        if let Some(ref val) = self.frms_cd {
12125            helpers::validate_pattern(
12126                val,
12127                "FrmsCd",
12128                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12129                &helpers::child_path(path, "FrmsCd"),
12130                config,
12131                collector,
12132            );
12133        }
12134        if let Some(ref val) = self.prd
12135            && config.validate_optional_fields
12136        {
12137            val.validate(&helpers::child_path(path, "Prd"), config, collector);
12138        }
12139        if let Some(ref val) = self.tax_amt
12140            && config.validate_optional_fields
12141        {
12142            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
12143        }
12144        if let Some(ref val) = self.addtl_inf {
12145            helpers::validate_length(
12146                val,
12147                "AddtlInf",
12148                Some(1),
12149                Some(140),
12150                &helpers::child_path(path, "AddtlInf"),
12151                config,
12152                collector,
12153            );
12154        }
12155        if let Some(ref val) = self.addtl_inf {
12156            helpers::validate_pattern(
12157                val,
12158                "AddtlInf",
12159                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12160                &helpers::child_path(path, "AddtlInf"),
12161                config,
12162                collector,
12163            );
12164        }
12165    }
12166}
12167
12168// TaxRecord22: Further details of the tax record.
12169#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12170pub struct TaxRecord22 {
12171    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
12172    pub tp: Option<String>,
12173    #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
12174    pub ctgy: Option<String>,
12175    #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
12176    pub ctgy_dtls: Option<String>,
12177    #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
12178    pub dbtr_sts: Option<String>,
12179    #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
12180    pub cert_id: Option<String>,
12181    #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
12182    pub frms_cd: Option<String>,
12183    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
12184    pub prd: Option<TaxPeriod2>,
12185    #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
12186    pub tax_amt: Option<TaxAmount2>,
12187    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
12188    pub addtl_inf: Option<String>,
12189}
12190
12191impl Validate for TaxRecord22 {
12192    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12193        if let Some(ref val) = self.tp {
12194            helpers::validate_length(
12195                val,
12196                "Tp",
12197                Some(1),
12198                Some(35),
12199                &helpers::child_path(path, "Tp"),
12200                config,
12201                collector,
12202            );
12203        }
12204        if let Some(ref val) = self.tp {
12205            helpers::validate_pattern(
12206                val,
12207                "Tp",
12208                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12209                &helpers::child_path(path, "Tp"),
12210                config,
12211                collector,
12212            );
12213        }
12214        if let Some(ref val) = self.ctgy {
12215            helpers::validate_length(
12216                val,
12217                "Ctgy",
12218                Some(1),
12219                Some(35),
12220                &helpers::child_path(path, "Ctgy"),
12221                config,
12222                collector,
12223            );
12224        }
12225        if let Some(ref val) = self.ctgy {
12226            helpers::validate_pattern(
12227                val,
12228                "Ctgy",
12229                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12230                &helpers::child_path(path, "Ctgy"),
12231                config,
12232                collector,
12233            );
12234        }
12235        if let Some(ref val) = self.ctgy_dtls {
12236            helpers::validate_length(
12237                val,
12238                "CtgyDtls",
12239                Some(1),
12240                Some(35),
12241                &helpers::child_path(path, "CtgyDtls"),
12242                config,
12243                collector,
12244            );
12245        }
12246        if let Some(ref val) = self.ctgy_dtls {
12247            helpers::validate_pattern(
12248                val,
12249                "CtgyDtls",
12250                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12251                &helpers::child_path(path, "CtgyDtls"),
12252                config,
12253                collector,
12254            );
12255        }
12256        if let Some(ref val) = self.dbtr_sts {
12257            helpers::validate_length(
12258                val,
12259                "DbtrSts",
12260                Some(1),
12261                Some(35),
12262                &helpers::child_path(path, "DbtrSts"),
12263                config,
12264                collector,
12265            );
12266        }
12267        if let Some(ref val) = self.dbtr_sts {
12268            helpers::validate_pattern(
12269                val,
12270                "DbtrSts",
12271                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12272                &helpers::child_path(path, "DbtrSts"),
12273                config,
12274                collector,
12275            );
12276        }
12277        if let Some(ref val) = self.cert_id {
12278            helpers::validate_length(
12279                val,
12280                "CertId",
12281                Some(1),
12282                Some(35),
12283                &helpers::child_path(path, "CertId"),
12284                config,
12285                collector,
12286            );
12287        }
12288        if let Some(ref val) = self.cert_id {
12289            helpers::validate_pattern(
12290                val,
12291                "CertId",
12292                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12293                &helpers::child_path(path, "CertId"),
12294                config,
12295                collector,
12296            );
12297        }
12298        if let Some(ref val) = self.frms_cd {
12299            helpers::validate_length(
12300                val,
12301                "FrmsCd",
12302                Some(1),
12303                Some(35),
12304                &helpers::child_path(path, "FrmsCd"),
12305                config,
12306                collector,
12307            );
12308        }
12309        if let Some(ref val) = self.frms_cd {
12310            helpers::validate_pattern(
12311                val,
12312                "FrmsCd",
12313                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12314                &helpers::child_path(path, "FrmsCd"),
12315                config,
12316                collector,
12317            );
12318        }
12319        if let Some(ref val) = self.prd
12320            && config.validate_optional_fields
12321        {
12322            val.validate(&helpers::child_path(path, "Prd"), config, collector);
12323        }
12324        if let Some(ref val) = self.tax_amt
12325            && config.validate_optional_fields
12326        {
12327            val.validate(&helpers::child_path(path, "TaxAmt"), config, collector);
12328        }
12329        if let Some(ref val) = self.addtl_inf {
12330            helpers::validate_length(
12331                val,
12332                "AddtlInf",
12333                Some(1),
12334                Some(140),
12335                &helpers::child_path(path, "AddtlInf"),
12336                config,
12337                collector,
12338            );
12339        }
12340        if let Some(ref val) = self.addtl_inf {
12341            helpers::validate_pattern(
12342                val,
12343                "AddtlInf",
12344                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12345                &helpers::child_path(path, "AddtlInf"),
12346                config,
12347                collector,
12348            );
12349        }
12350    }
12351}
12352
12353// TaxRecordDetails2: Underlying tax amount related to the specified period.
12354#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12355pub struct TaxRecordDetails2 {
12356    #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
12357    pub prd: Option<TaxPeriod2>,
12358    #[serde(rename = "Amt")]
12359    pub amt: ActiveOrHistoricCurrencyAndAmount,
12360}
12361
12362impl Validate for TaxRecordDetails2 {
12363    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12364        if let Some(ref val) = self.prd
12365            && config.validate_optional_fields
12366        {
12367            val.validate(&helpers::child_path(path, "Prd"), config, collector);
12368        }
12369        self.amt
12370            .validate(&helpers::child_path(path, "Amt"), config, collector);
12371    }
12372}
12373
12374// TaxRecordPeriod1Code: Tax is related to the second half of the period.
12375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12376pub enum TaxRecordPeriod1Code {
12377    #[default]
12378    #[serde(rename = "MM01")]
12379    CodeMM01,
12380    #[serde(rename = "MM02")]
12381    CodeMM02,
12382    #[serde(rename = "MM03")]
12383    CodeMM03,
12384    #[serde(rename = "MM04")]
12385    CodeMM04,
12386    #[serde(rename = "MM05")]
12387    CodeMM05,
12388    #[serde(rename = "MM06")]
12389    CodeMM06,
12390    #[serde(rename = "MM07")]
12391    CodeMM07,
12392    #[serde(rename = "MM08")]
12393    CodeMM08,
12394    #[serde(rename = "MM09")]
12395    CodeMM09,
12396    #[serde(rename = "MM10")]
12397    CodeMM10,
12398    #[serde(rename = "MM11")]
12399    CodeMM11,
12400    #[serde(rename = "MM12")]
12401    CodeMM12,
12402    #[serde(rename = "QTR1")]
12403    CodeQTR1,
12404    #[serde(rename = "QTR2")]
12405    CodeQTR2,
12406    #[serde(rename = "QTR3")]
12407    CodeQTR3,
12408    #[serde(rename = "QTR4")]
12409    CodeQTR4,
12410    #[serde(rename = "HLF1")]
12411    CodeHLF1,
12412    #[serde(rename = "HLF2")]
12413    CodeHLF2,
12414}
12415
12416impl Validate for TaxRecordPeriod1Code {
12417    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
12418        // Enum validation is typically empty
12419    }
12420}
12421
12422// TechnicalInputChannel1Choice1: Technical channel used to input the instruction, in a proprietary form.
12423#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12424pub struct TechnicalInputChannel1Choice1 {
12425    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
12426    pub cd: Option<String>,
12427    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12428    pub prtry: Option<String>,
12429}
12430
12431impl Validate for TechnicalInputChannel1Choice1 {
12432    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12433        if let Some(ref val) = self.cd {
12434            helpers::validate_length(
12435                val,
12436                "Cd",
12437                Some(1),
12438                Some(4),
12439                &helpers::child_path(path, "Cd"),
12440                config,
12441                collector,
12442            );
12443        }
12444        if let Some(ref val) = self.prtry {
12445            helpers::validate_length(
12446                val,
12447                "Prtry",
12448                Some(1),
12449                Some(35),
12450                &helpers::child_path(path, "Prtry"),
12451                config,
12452                collector,
12453            );
12454        }
12455        if let Some(ref val) = self.prtry {
12456            helpers::validate_pattern(
12457                val,
12458                "Prtry",
12459                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12460                &helpers::child_path(path, "Prtry"),
12461                config,
12462                collector,
12463            );
12464        }
12465    }
12466}
12467
12468// TotalTransactions61: Specifies the total number and sum of entries per bank transaction code.
12469#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12470pub struct TotalTransactions61 {
12471    #[serde(rename = "TtlNtries", skip_serializing_if = "Option::is_none")]
12472    pub ttl_ntries: Option<NumberAndSumOfTransactions4>,
12473    #[serde(rename = "TtlCdtNtries", skip_serializing_if = "Option::is_none")]
12474    pub ttl_cdt_ntries: Option<NumberAndSumOfTransactions1>,
12475    #[serde(rename = "TtlDbtNtries", skip_serializing_if = "Option::is_none")]
12476    pub ttl_dbt_ntries: Option<NumberAndSumOfTransactions1>,
12477    #[serde(rename = "TtlNtriesPerBkTxCd", skip_serializing_if = "Option::is_none")]
12478    pub ttl_ntries_per_bk_tx_cd: Option<Vec<TotalsPerBankTransactionCode51>>,
12479}
12480
12481impl Validate for TotalTransactions61 {
12482    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12483        if let Some(ref val) = self.ttl_ntries
12484            && config.validate_optional_fields
12485        {
12486            val.validate(&helpers::child_path(path, "TtlNtries"), config, collector);
12487        }
12488        if let Some(ref val) = self.ttl_cdt_ntries
12489            && config.validate_optional_fields
12490        {
12491            val.validate(
12492                &helpers::child_path(path, "TtlCdtNtries"),
12493                config,
12494                collector,
12495            );
12496        }
12497        if let Some(ref val) = self.ttl_dbt_ntries
12498            && config.validate_optional_fields
12499        {
12500            val.validate(
12501                &helpers::child_path(path, "TtlDbtNtries"),
12502                config,
12503                collector,
12504            );
12505        }
12506        if let Some(ref vec) = self.ttl_ntries_per_bk_tx_cd
12507            && config.validate_optional_fields
12508        {
12509            for item in vec {
12510                item.validate(
12511                    &helpers::child_path(path, "TtlNtriesPerBkTxCd"),
12512                    config,
12513                    collector,
12514                );
12515            }
12516        }
12517    }
12518}
12519
12520// TotalsPerBankTransactionCode51: Indicates the date (and time) of the transaction summary.
12521#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12522pub struct TotalsPerBankTransactionCode51 {
12523    #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
12524    pub nb_of_ntries: Option<String>,
12525    #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
12526    pub sum: Option<f64>,
12527    #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
12528    pub ttl_net_ntry: Option<AmountAndDirection35>,
12529    #[serde(rename = "CdtNtries", skip_serializing_if = "Option::is_none")]
12530    pub cdt_ntries: Option<NumberAndSumOfTransactions1>,
12531    #[serde(rename = "DbtNtries", skip_serializing_if = "Option::is_none")]
12532    pub dbt_ntries: Option<NumberAndSumOfTransactions1>,
12533    #[serde(rename = "FcstInd", skip_serializing_if = "Option::is_none")]
12534    pub fcst_ind: Option<bool>,
12535    #[serde(rename = "BkTxCd")]
12536    pub bk_tx_cd: BankTransactionCodeStructure41,
12537    #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
12538    pub avlbty: Option<Vec<CashAvailability1>>,
12539    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
12540    pub dt: Option<DateAndDateTime2Choice1>,
12541}
12542
12543impl Validate for TotalsPerBankTransactionCode51 {
12544    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12545        if let Some(ref val) = self.nb_of_ntries {
12546            helpers::validate_pattern(
12547                val,
12548                "NbOfNtries",
12549                "[0-9]{1,15}",
12550                &helpers::child_path(path, "NbOfNtries"),
12551                config,
12552                collector,
12553            );
12554        }
12555        if let Some(ref val) = self.ttl_net_ntry
12556            && config.validate_optional_fields
12557        {
12558            val.validate(&helpers::child_path(path, "TtlNetNtry"), config, collector);
12559        }
12560        if let Some(ref val) = self.cdt_ntries
12561            && config.validate_optional_fields
12562        {
12563            val.validate(&helpers::child_path(path, "CdtNtries"), config, collector);
12564        }
12565        if let Some(ref val) = self.dbt_ntries
12566            && config.validate_optional_fields
12567        {
12568            val.validate(&helpers::child_path(path, "DbtNtries"), config, collector);
12569        }
12570        self.bk_tx_cd
12571            .validate(&helpers::child_path(path, "BkTxCd"), config, collector);
12572        if let Some(ref vec) = self.avlbty
12573            && config.validate_optional_fields
12574        {
12575            for item in vec {
12576                item.validate(&helpers::child_path(path, "Avlbty"), config, collector);
12577            }
12578        }
12579        if let Some(ref val) = self.dt
12580            && config.validate_optional_fields
12581        {
12582            val.validate(&helpers::child_path(path, "Dt"), config, collector);
12583        }
12584    }
12585}
12586
12587// TrackData11: Card track content or equivalent.
12588#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12589pub struct TrackData11 {
12590    #[serde(rename = "TrckNb", skip_serializing_if = "Option::is_none")]
12591    pub trck_nb: Option<String>,
12592    #[serde(rename = "TrckVal")]
12593    pub trck_val: String,
12594}
12595
12596impl Validate for TrackData11 {
12597    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12598        if let Some(ref val) = self.trck_nb {
12599            helpers::validate_pattern(
12600                val,
12601                "TrckNb",
12602                "[0-9]",
12603                &helpers::child_path(path, "TrckNb"),
12604                config,
12605                collector,
12606            );
12607        }
12608        helpers::validate_length(
12609            &self.trck_val,
12610            "TrckVal",
12611            Some(1),
12612            Some(140),
12613            &helpers::child_path(path, "TrckVal"),
12614            config,
12615            collector,
12616        );
12617        helpers::validate_pattern(
12618            &self.trck_val,
12619            "TrckVal",
12620            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12621            &helpers::child_path(path, "TrckVal"),
12622            config,
12623            collector,
12624        );
12625    }
12626}
12627
12628// TransactionAgents51: Proprietary agent related to the underlying transaction.
12629#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12630pub struct TransactionAgents51 {
12631    #[serde(rename = "InstgAgt", skip_serializing_if = "Option::is_none")]
12632    pub instg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12633    #[serde(rename = "InstdAgt", skip_serializing_if = "Option::is_none")]
12634    pub instd_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12635    #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
12636    pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification67>,
12637    #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
12638    pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12639    #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
12640    pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification65>,
12641    #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
12642    pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification65>,
12643    #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
12644    pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification65>,
12645    #[serde(rename = "RcvgAgt", skip_serializing_if = "Option::is_none")]
12646    pub rcvg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12647    #[serde(rename = "DlvrgAgt", skip_serializing_if = "Option::is_none")]
12648    pub dlvrg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12649    #[serde(rename = "IssgAgt", skip_serializing_if = "Option::is_none")]
12650    pub issg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12651    #[serde(rename = "SttlmPlc", skip_serializing_if = "Option::is_none")]
12652    pub sttlm_plc: Option<BranchAndFinancialInstitutionIdentification65>,
12653    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12654    pub prtry: Option<Vec<ProprietaryAgent41>>,
12655}
12656
12657impl Validate for TransactionAgents51 {
12658    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12659        if let Some(ref val) = self.instg_agt
12660            && config.validate_optional_fields
12661        {
12662            val.validate(&helpers::child_path(path, "InstgAgt"), config, collector);
12663        }
12664        if let Some(ref val) = self.instd_agt
12665            && config.validate_optional_fields
12666        {
12667            val.validate(&helpers::child_path(path, "InstdAgt"), config, collector);
12668        }
12669        if let Some(ref val) = self.dbtr_agt
12670            && config.validate_optional_fields
12671        {
12672            val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
12673        }
12674        if let Some(ref val) = self.cdtr_agt
12675            && config.validate_optional_fields
12676        {
12677            val.validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
12678        }
12679        if let Some(ref val) = self.intrmy_agt1
12680            && config.validate_optional_fields
12681        {
12682            val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
12683        }
12684        if let Some(ref val) = self.intrmy_agt2
12685            && config.validate_optional_fields
12686        {
12687            val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
12688        }
12689        if let Some(ref val) = self.intrmy_agt3
12690            && config.validate_optional_fields
12691        {
12692            val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
12693        }
12694        if let Some(ref val) = self.rcvg_agt
12695            && config.validate_optional_fields
12696        {
12697            val.validate(&helpers::child_path(path, "RcvgAgt"), config, collector);
12698        }
12699        if let Some(ref val) = self.dlvrg_agt
12700            && config.validate_optional_fields
12701        {
12702            val.validate(&helpers::child_path(path, "DlvrgAgt"), config, collector);
12703        }
12704        if let Some(ref val) = self.issg_agt
12705            && config.validate_optional_fields
12706        {
12707            val.validate(&helpers::child_path(path, "IssgAgt"), config, collector);
12708        }
12709        if let Some(ref val) = self.sttlm_plc
12710            && config.validate_optional_fields
12711        {
12712            val.validate(&helpers::child_path(path, "SttlmPlc"), config, collector);
12713        }
12714        if let Some(ref vec) = self.prtry
12715            && config.validate_optional_fields
12716        {
12717            for item in vec {
12718                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
12719            }
12720        }
12721    }
12722}
12723
12724// TransactionChannel1Code: Payment on television.
12725#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12726pub enum TransactionChannel1Code {
12727    #[default]
12728    #[serde(rename = "MAIL")]
12729    CodeMAIL,
12730    #[serde(rename = "TLPH")]
12731    CodeTLPH,
12732    #[serde(rename = "ECOM")]
12733    CodeECOM,
12734    #[serde(rename = "TVPY")]
12735    CodeTVPY,
12736}
12737
12738impl Validate for TransactionChannel1Code {
12739    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
12740        // Enum validation is typically empty
12741    }
12742}
12743
12744// TransactionDates31: Proprietary date related to the underlying transaction.
12745#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12746pub struct TransactionDates31 {
12747    #[serde(rename = "AccptncDtTm", skip_serializing_if = "Option::is_none")]
12748    pub accptnc_dt_tm: Option<String>,
12749    #[serde(
12750        rename = "TradActvtyCtrctlSttlmDt",
12751        skip_serializing_if = "Option::is_none"
12752    )]
12753    pub trad_actvty_ctrctl_sttlm_dt: Option<String>,
12754    #[serde(rename = "TradDt", skip_serializing_if = "Option::is_none")]
12755    pub trad_dt: Option<String>,
12756    #[serde(rename = "IntrBkSttlmDt", skip_serializing_if = "Option::is_none")]
12757    pub intr_bk_sttlm_dt: Option<String>,
12758    #[serde(rename = "StartDt", skip_serializing_if = "Option::is_none")]
12759    pub start_dt: Option<String>,
12760    #[serde(rename = "EndDt", skip_serializing_if = "Option::is_none")]
12761    pub end_dt: Option<String>,
12762    #[serde(rename = "TxDtTm", skip_serializing_if = "Option::is_none")]
12763    pub tx_dt_tm: Option<String>,
12764    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12765    pub prtry: Option<Vec<ProprietaryDate31>>,
12766}
12767
12768impl Validate for TransactionDates31 {
12769    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12770        if let Some(ref val) = self.accptnc_dt_tm {
12771            helpers::validate_pattern(
12772                val,
12773                "AccptncDtTm",
12774                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
12775                &helpers::child_path(path, "AccptncDtTm"),
12776                config,
12777                collector,
12778            );
12779        }
12780        if let Some(ref val) = self.tx_dt_tm {
12781            helpers::validate_pattern(
12782                val,
12783                "TxDtTm",
12784                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
12785                &helpers::child_path(path, "TxDtTm"),
12786                config,
12787                collector,
12788            );
12789        }
12790        if let Some(ref vec) = self.prtry
12791            && config.validate_optional_fields
12792        {
12793            for item in vec {
12794                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
12795            }
12796        }
12797    }
12798}
12799
12800// TransactionEnvironment1Code: Public environment.
12801#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12802pub enum TransactionEnvironment1Code {
12803    #[default]
12804    #[serde(rename = "MERC")]
12805    CodeMERC,
12806    #[serde(rename = "PRIV")]
12807    CodePRIV,
12808    #[serde(rename = "PUBL")]
12809    CodePUBL,
12810}
12811
12812impl Validate for TransactionEnvironment1Code {
12813    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
12814        // Enum validation is typically empty
12815    }
12816}
12817
12818// TransactionIdentifier11: Identification of the transaction that has to be unique for a time period.
12819#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12820pub struct TransactionIdentifier11 {
12821    #[serde(rename = "TxDtTm")]
12822    pub tx_dt_tm: String,
12823    #[serde(rename = "TxRef")]
12824    pub tx_ref: String,
12825}
12826
12827impl Validate for TransactionIdentifier11 {
12828    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12829        helpers::validate_pattern(
12830            &self.tx_dt_tm,
12831            "TxDtTm",
12832            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
12833            &helpers::child_path(path, "TxDtTm"),
12834            config,
12835            collector,
12836        );
12837        helpers::validate_length(
12838            &self.tx_ref,
12839            "TxRef",
12840            Some(1),
12841            Some(35),
12842            &helpers::child_path(path, "TxRef"),
12843            config,
12844            collector,
12845        );
12846        helpers::validate_pattern(
12847            &self.tx_ref,
12848            "TxRef",
12849            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
12850            &helpers::child_path(path, "TxRef"),
12851            config,
12852            collector,
12853        );
12854    }
12855}
12856
12857// TransactionInterest41: Individual interest record.
12858#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12859pub struct TransactionInterest41 {
12860    #[serde(rename = "TtlIntrstAndTaxAmt", skip_serializing_if = "Option::is_none")]
12861    pub ttl_intrst_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
12862    #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
12863    pub rcrd: Option<Vec<InterestRecord21>>,
12864}
12865
12866impl Validate for TransactionInterest41 {
12867    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12868        if let Some(ref val) = self.ttl_intrst_and_tax_amt
12869            && config.validate_optional_fields
12870        {
12871            val.validate(
12872                &helpers::child_path(path, "TtlIntrstAndTaxAmt"),
12873                config,
12874                collector,
12875            );
12876        }
12877        if let Some(ref vec) = self.rcrd
12878            && config.validate_optional_fields
12879        {
12880            for item in vec {
12881                item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
12882            }
12883        }
12884    }
12885}
12886
12887// TransactionParties61: Proprietary party related to the underlying transaction.
12888#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12889pub struct TransactionParties61 {
12890    #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
12891    pub initg_pty: Option<Party40Choice1>,
12892    #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
12893    pub dbtr: Option<Party40Choice2>,
12894    #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
12895    pub dbtr_acct: Option<CashAccount383>,
12896    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
12897    pub ultmt_dbtr: Option<Party40Choice3>,
12898    #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
12899    pub cdtr: Option<Party40Choice4>,
12900    #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
12901    pub cdtr_acct: Option<CashAccount384>,
12902    #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
12903    pub ultmt_cdtr: Option<Party40Choice4>,
12904    #[serde(rename = "TradgPty", skip_serializing_if = "Option::is_none")]
12905    pub tradg_pty: Option<Party40Choice4>,
12906    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12907    pub prtry: Option<Vec<ProprietaryParty51>>,
12908}
12909
12910impl Validate for TransactionParties61 {
12911    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12912        if let Some(ref val) = self.initg_pty
12913            && config.validate_optional_fields
12914        {
12915            val.validate(&helpers::child_path(path, "InitgPty"), config, collector);
12916        }
12917        if let Some(ref val) = self.dbtr
12918            && config.validate_optional_fields
12919        {
12920            val.validate(&helpers::child_path(path, "Dbtr"), config, collector);
12921        }
12922        if let Some(ref val) = self.dbtr_acct
12923            && config.validate_optional_fields
12924        {
12925            val.validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
12926        }
12927        if let Some(ref val) = self.ultmt_dbtr
12928            && config.validate_optional_fields
12929        {
12930            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
12931        }
12932        if let Some(ref val) = self.cdtr
12933            && config.validate_optional_fields
12934        {
12935            val.validate(&helpers::child_path(path, "Cdtr"), config, collector);
12936        }
12937        if let Some(ref val) = self.cdtr_acct
12938            && config.validate_optional_fields
12939        {
12940            val.validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
12941        }
12942        if let Some(ref val) = self.ultmt_cdtr
12943            && config.validate_optional_fields
12944        {
12945            val.validate(&helpers::child_path(path, "UltmtCdtr"), config, collector);
12946        }
12947        if let Some(ref val) = self.tradg_pty
12948            && config.validate_optional_fields
12949        {
12950            val.validate(&helpers::child_path(path, "TradgPty"), config, collector);
12951        }
12952        if let Some(ref vec) = self.prtry
12953            && config.validate_optional_fields
12954        {
12955            for item in vec {
12956                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
12957            }
12958        }
12959    }
12960}
12961
12962// TransactionPrice4Choice1: Proprietary price specification related to the underlying transaction.
12963#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12964pub struct TransactionPrice4Choice1 {
12965    #[serde(rename = "DealPric", skip_serializing_if = "Option::is_none")]
12966    pub deal_pric: Option<Price7>,
12967    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12968    pub prtry: Option<Vec<ProprietaryPrice21>>,
12969}
12970
12971impl Validate for TransactionPrice4Choice1 {
12972    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
12973        if let Some(ref val) = self.deal_pric
12974            && config.validate_optional_fields
12975        {
12976            val.validate(&helpers::child_path(path, "DealPric"), config, collector);
12977        }
12978        if let Some(ref vec) = self.prtry
12979            && config.validate_optional_fields
12980        {
12981            for item in vec {
12982                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
12983            }
12984        }
12985    }
12986}
12987
12988// TransactionQuantities3Choice1: Proprietary quantities specification defined in the underlying transaction.
12989#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12990pub struct TransactionQuantities3Choice1 {
12991    #[serde(rename = "Qty", skip_serializing_if = "Option::is_none")]
12992    pub qty: Option<FinancialInstrumentQuantity1Choice>,
12993    #[serde(rename = "OrgnlAndCurFaceAmt", skip_serializing_if = "Option::is_none")]
12994    pub orgnl_and_cur_face_amt: Option<OriginalAndCurrentQuantities1>,
12995    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12996    pub prtry: Option<ProprietaryQuantity11>,
12997}
12998
12999impl Validate for TransactionQuantities3Choice1 {
13000    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
13001        if let Some(ref val) = self.qty
13002            && config.validate_optional_fields
13003        {
13004            val.validate(&helpers::child_path(path, "Qty"), config, collector);
13005        }
13006        if let Some(ref val) = self.orgnl_and_cur_face_amt
13007            && config.validate_optional_fields
13008        {
13009            val.validate(
13010                &helpers::child_path(path, "OrgnlAndCurFaceAmt"),
13011                config,
13012                collector,
13013            );
13014        }
13015        if let Some(ref val) = self.prtry
13016            && config.validate_optional_fields
13017        {
13018            val.validate(&helpers::child_path(path, "Prtry"), config, collector);
13019        }
13020    }
13021}
13022
13023// TransactionReferences61: Proprietary reference related to the underlying transaction.
13024#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13025pub struct TransactionReferences61 {
13026    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
13027    pub msg_id: Option<String>,
13028    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
13029    pub acct_svcr_ref: Option<String>,
13030    #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
13031    pub pmt_inf_id: Option<String>,
13032    #[serde(rename = "InstrId")]
13033    pub instr_id: String,
13034    #[serde(rename = "EndToEndId", skip_serializing_if = "Option::is_none")]
13035    pub end_to_end_id: Option<String>,
13036    #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
13037    pub uetr: Option<String>,
13038    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
13039    pub tx_id: Option<String>,
13040    #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
13041    pub mndt_id: Option<String>,
13042    #[serde(rename = "ChqNb", skip_serializing_if = "Option::is_none")]
13043    pub chq_nb: Option<String>,
13044    #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
13045    pub clr_sys_ref: Option<String>,
13046    #[serde(rename = "AcctOwnrTxId", skip_serializing_if = "Option::is_none")]
13047    pub acct_ownr_tx_id: Option<String>,
13048    #[serde(rename = "AcctSvcrTxId", skip_serializing_if = "Option::is_none")]
13049    pub acct_svcr_tx_id: Option<String>,
13050    #[serde(rename = "MktInfrstrctrTxId", skip_serializing_if = "Option::is_none")]
13051    pub mkt_infrstrctr_tx_id: Option<String>,
13052    #[serde(rename = "PrcgId", skip_serializing_if = "Option::is_none")]
13053    pub prcg_id: Option<String>,
13054    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
13055    pub prtry: Option<Vec<ProprietaryReference11>>,
13056}
13057
13058impl Validate for TransactionReferences61 {
13059    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
13060        if let Some(ref val) = self.msg_id {
13061            helpers::validate_length(
13062                val,
13063                "MsgId",
13064                Some(1),
13065                Some(35),
13066                &helpers::child_path(path, "MsgId"),
13067                config,
13068                collector,
13069            );
13070        }
13071        if let Some(ref val) = self.msg_id {
13072            helpers::validate_pattern(
13073                val,
13074                "MsgId",
13075                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13076                &helpers::child_path(path, "MsgId"),
13077                config,
13078                collector,
13079            );
13080        }
13081        if let Some(ref val) = self.acct_svcr_ref {
13082            helpers::validate_length(
13083                val,
13084                "AcctSvcrRef",
13085                Some(1),
13086                Some(35),
13087                &helpers::child_path(path, "AcctSvcrRef"),
13088                config,
13089                collector,
13090            );
13091        }
13092        if let Some(ref val) = self.acct_svcr_ref {
13093            helpers::validate_pattern(
13094                val,
13095                "AcctSvcrRef",
13096                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13097                &helpers::child_path(path, "AcctSvcrRef"),
13098                config,
13099                collector,
13100            );
13101        }
13102        if let Some(ref val) = self.pmt_inf_id {
13103            helpers::validate_length(
13104                val,
13105                "PmtInfId",
13106                Some(1),
13107                Some(35),
13108                &helpers::child_path(path, "PmtInfId"),
13109                config,
13110                collector,
13111            );
13112        }
13113        if let Some(ref val) = self.pmt_inf_id {
13114            helpers::validate_pattern(
13115                val,
13116                "PmtInfId",
13117                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13118                &helpers::child_path(path, "PmtInfId"),
13119                config,
13120                collector,
13121            );
13122        }
13123        helpers::validate_length(
13124            &self.instr_id,
13125            "InstrId",
13126            Some(1),
13127            Some(35),
13128            &helpers::child_path(path, "InstrId"),
13129            config,
13130            collector,
13131        );
13132        helpers::validate_pattern(
13133            &self.instr_id,
13134            "InstrId",
13135            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13136            &helpers::child_path(path, "InstrId"),
13137            config,
13138            collector,
13139        );
13140        if let Some(ref val) = self.end_to_end_id {
13141            helpers::validate_length(
13142                val,
13143                "EndToEndId",
13144                Some(1),
13145                Some(35),
13146                &helpers::child_path(path, "EndToEndId"),
13147                config,
13148                collector,
13149            );
13150        }
13151        if let Some(ref val) = self.end_to_end_id {
13152            helpers::validate_pattern(
13153                val,
13154                "EndToEndId",
13155                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13156                &helpers::child_path(path, "EndToEndId"),
13157                config,
13158                collector,
13159            );
13160        }
13161        if let Some(ref val) = self.uetr {
13162            helpers::validate_pattern(
13163                val,
13164                "UETR",
13165                "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
13166                &helpers::child_path(path, "UETR"),
13167                config,
13168                collector,
13169            );
13170        }
13171        if let Some(ref val) = self.tx_id {
13172            helpers::validate_length(
13173                val,
13174                "TxId",
13175                Some(1),
13176                Some(35),
13177                &helpers::child_path(path, "TxId"),
13178                config,
13179                collector,
13180            );
13181        }
13182        if let Some(ref val) = self.tx_id {
13183            helpers::validate_pattern(
13184                val,
13185                "TxId",
13186                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13187                &helpers::child_path(path, "TxId"),
13188                config,
13189                collector,
13190            );
13191        }
13192        if let Some(ref val) = self.mndt_id {
13193            helpers::validate_length(
13194                val,
13195                "MndtId",
13196                Some(1),
13197                Some(35),
13198                &helpers::child_path(path, "MndtId"),
13199                config,
13200                collector,
13201            );
13202        }
13203        if let Some(ref val) = self.mndt_id {
13204            helpers::validate_pattern(
13205                val,
13206                "MndtId",
13207                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13208                &helpers::child_path(path, "MndtId"),
13209                config,
13210                collector,
13211            );
13212        }
13213        if let Some(ref val) = self.chq_nb {
13214            helpers::validate_length(
13215                val,
13216                "ChqNb",
13217                Some(1),
13218                Some(35),
13219                &helpers::child_path(path, "ChqNb"),
13220                config,
13221                collector,
13222            );
13223        }
13224        if let Some(ref val) = self.chq_nb {
13225            helpers::validate_pattern(
13226                val,
13227                "ChqNb",
13228                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13229                &helpers::child_path(path, "ChqNb"),
13230                config,
13231                collector,
13232            );
13233        }
13234        if let Some(ref val) = self.clr_sys_ref {
13235            helpers::validate_length(
13236                val,
13237                "ClrSysRef",
13238                Some(1),
13239                Some(35),
13240                &helpers::child_path(path, "ClrSysRef"),
13241                config,
13242                collector,
13243            );
13244        }
13245        if let Some(ref val) = self.clr_sys_ref {
13246            helpers::validate_pattern(
13247                val,
13248                "ClrSysRef",
13249                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13250                &helpers::child_path(path, "ClrSysRef"),
13251                config,
13252                collector,
13253            );
13254        }
13255        if let Some(ref val) = self.acct_ownr_tx_id {
13256            helpers::validate_length(
13257                val,
13258                "AcctOwnrTxId",
13259                Some(1),
13260                Some(35),
13261                &helpers::child_path(path, "AcctOwnrTxId"),
13262                config,
13263                collector,
13264            );
13265        }
13266        if let Some(ref val) = self.acct_ownr_tx_id {
13267            helpers::validate_pattern(
13268                val,
13269                "AcctOwnrTxId",
13270                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13271                &helpers::child_path(path, "AcctOwnrTxId"),
13272                config,
13273                collector,
13274            );
13275        }
13276        if let Some(ref val) = self.acct_svcr_tx_id {
13277            helpers::validate_length(
13278                val,
13279                "AcctSvcrTxId",
13280                Some(1),
13281                Some(35),
13282                &helpers::child_path(path, "AcctSvcrTxId"),
13283                config,
13284                collector,
13285            );
13286        }
13287        if let Some(ref val) = self.acct_svcr_tx_id {
13288            helpers::validate_pattern(
13289                val,
13290                "AcctSvcrTxId",
13291                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13292                &helpers::child_path(path, "AcctSvcrTxId"),
13293                config,
13294                collector,
13295            );
13296        }
13297        if let Some(ref val) = self.mkt_infrstrctr_tx_id {
13298            helpers::validate_length(
13299                val,
13300                "MktInfrstrctrTxId",
13301                Some(1),
13302                Some(35),
13303                &helpers::child_path(path, "MktInfrstrctrTxId"),
13304                config,
13305                collector,
13306            );
13307        }
13308        if let Some(ref val) = self.mkt_infrstrctr_tx_id {
13309            helpers::validate_pattern(
13310                val,
13311                "MktInfrstrctrTxId",
13312                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13313                &helpers::child_path(path, "MktInfrstrctrTxId"),
13314                config,
13315                collector,
13316            );
13317        }
13318        if let Some(ref val) = self.prcg_id {
13319            helpers::validate_length(
13320                val,
13321                "PrcgId",
13322                Some(1),
13323                Some(35),
13324                &helpers::child_path(path, "PrcgId"),
13325                config,
13326                collector,
13327            );
13328        }
13329        if let Some(ref val) = self.prcg_id {
13330            helpers::validate_pattern(
13331                val,
13332                "PrcgId",
13333                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
13334                &helpers::child_path(path, "PrcgId"),
13335                config,
13336                collector,
13337            );
13338        }
13339        if let Some(ref vec) = self.prtry
13340            && config.validate_optional_fields
13341        {
13342            for item in vec {
13343                item.validate(&helpers::child_path(path, "Prtry"), config, collector);
13344            }
13345        }
13346    }
13347}
13348
13349// UnitOfMeasure1Code: Unit of measure equal to 4, 840 square yards.
13350#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13351pub enum UnitOfMeasure1Code {
13352    #[default]
13353    #[serde(rename = "PIEC")]
13354    CodePIEC,
13355    #[serde(rename = "TONS")]
13356    CodeTONS,
13357    #[serde(rename = "FOOT")]
13358    CodeFOOT,
13359    #[serde(rename = "GBGA")]
13360    CodeGBGA,
13361    #[serde(rename = "USGA")]
13362    CodeUSGA,
13363    #[serde(rename = "GRAM")]
13364    CodeGRAM,
13365    #[serde(rename = "INCH")]
13366    CodeINCH,
13367    #[serde(rename = "KILO")]
13368    CodeKILO,
13369    #[serde(rename = "PUND")]
13370    CodePUND,
13371    #[serde(rename = "METR")]
13372    CodeMETR,
13373    #[serde(rename = "CMET")]
13374    CodeCMET,
13375    #[serde(rename = "MMET")]
13376    CodeMMET,
13377    #[serde(rename = "LITR")]
13378    CodeLITR,
13379    #[serde(rename = "CELI")]
13380    CodeCELI,
13381    #[serde(rename = "MILI")]
13382    CodeMILI,
13383    #[serde(rename = "GBOU")]
13384    CodeGBOU,
13385    #[serde(rename = "USOU")]
13386    CodeUSOU,
13387    #[serde(rename = "GBQA")]
13388    CodeGBQA,
13389    #[serde(rename = "USQA")]
13390    CodeUSQA,
13391    #[serde(rename = "GBPI")]
13392    CodeGBPI,
13393    #[serde(rename = "USPI")]
13394    CodeUSPI,
13395    #[serde(rename = "MILE")]
13396    CodeMILE,
13397    #[serde(rename = "KMET")]
13398    CodeKMET,
13399    #[serde(rename = "YARD")]
13400    CodeYARD,
13401    #[serde(rename = "SQKI")]
13402    CodeSQKI,
13403    #[serde(rename = "HECT")]
13404    CodeHECT,
13405    #[serde(rename = "ARES")]
13406    CodeARES,
13407    #[serde(rename = "SMET")]
13408    CodeSMET,
13409    #[serde(rename = "SCMT")]
13410    CodeSCMT,
13411    #[serde(rename = "SMIL")]
13412    CodeSMIL,
13413    #[serde(rename = "SQMI")]
13414    CodeSQMI,
13415    #[serde(rename = "SQYA")]
13416    CodeSQYA,
13417    #[serde(rename = "SQFO")]
13418    CodeSQFO,
13419    #[serde(rename = "SQIN")]
13420    CodeSQIN,
13421    #[serde(rename = "ACRE")]
13422    CodeACRE,
13423}
13424
13425impl Validate for UnitOfMeasure1Code {
13426    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
13427        // Enum validation is typically empty
13428    }
13429}
13430
13431// UserInterface2Code: Cardholder display or interface.
13432#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13433pub enum UserInterface2Code {
13434    #[default]
13435    #[serde(rename = "MDSP")]
13436    CodeMDSP,
13437    #[serde(rename = "CDSP")]
13438    CodeCDSP,
13439}
13440
13441impl Validate for UserInterface2Code {
13442    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
13443        // Enum validation is typically empty
13444    }
13445}
13446
13447// YieldedOrValueType1Choice: Type of value in which the price is expressed.
13448#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13449pub struct YieldedOrValueType1Choice {
13450    #[serde(rename = "Yldd", skip_serializing_if = "Option::is_none")]
13451    pub yldd: Option<bool>,
13452    #[serde(rename = "ValTp", skip_serializing_if = "Option::is_none")]
13453    pub val_tp: Option<PriceValueType1Code>,
13454}
13455
13456impl Validate for YieldedOrValueType1Choice {
13457    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
13458        if let Some(ref val) = self.val_tp
13459            && config.validate_optional_fields
13460        {
13461            val.validate(&helpers::child_path(path, "ValTp"), config, collector);
13462        }
13463    }
13464}