mx_message/document/
pacs_008_001_08_stp.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// AccountSchemeName1Choice1: Name of the identification scheme, in a free text form.
53#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
54pub struct AccountSchemeName1Choice1 {
55    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
56    pub cd: Option<String>,
57    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
58    pub prtry: Option<String>,
59}
60
61impl Validate for AccountSchemeName1Choice1 {
62    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
63        if let Some(ref val) = self.cd {
64            helpers::validate_length(
65                val,
66                "Cd",
67                Some(1),
68                Some(4),
69                &helpers::child_path(path, "Cd"),
70                config,
71                collector,
72            );
73        }
74        if let Some(ref val) = self.prtry {
75            helpers::validate_length(
76                val,
77                "Prtry",
78                Some(1),
79                Some(35),
80                &helpers::child_path(path, "Prtry"),
81                config,
82                collector,
83            );
84        }
85        if let Some(ref val) = self.prtry {
86            helpers::validate_pattern(
87                val,
88                "Prtry",
89                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
90                &helpers::child_path(path, "Prtry"),
91                config,
92                collector,
93            );
94        }
95    }
96}
97
98// BranchAndFinancialInstitutionIdentification61: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
99#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
100pub struct BranchAndFinancialInstitutionIdentification61 {
101    #[serde(rename = "FinInstnId")]
102    pub fin_instn_id: FinancialInstitutionIdentification181,
103}
104
105impl Validate for BranchAndFinancialInstitutionIdentification61 {
106    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
107        self.fin_instn_id
108            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
109    }
110}
111
112// CBPRAmount1: CBPR_Amount__1
113#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
114pub struct CBPRAmount1 {
115    #[serde(rename = "@Ccy")]
116    pub ccy: String,
117    #[serde(rename = "$value")]
118    pub value: f64,
119}
120
121impl Validate for CBPRAmount1 {
122    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
123}
124
125// CashAccount381: Specifies an alternate assumed name for the identification of the account.
126#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
127pub struct CashAccount381 {
128    #[serde(rename = "Id")]
129    pub id: AccountIdentification4Choice1,
130    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
131    pub tp: Option<CashAccountType2Choice1>,
132    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
133    pub ccy: Option<String>,
134    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
135    pub nm: Option<String>,
136    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
137    pub prxy: Option<ProxyAccountIdentification11>,
138}
139
140impl Validate for CashAccount381 {
141    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
142        self.id
143            .validate(&helpers::child_path(path, "Id"), config, collector);
144        if let Some(ref val) = self.tp
145            && config.validate_optional_fields
146        {
147            val.validate(&helpers::child_path(path, "Tp"), config, collector);
148        }
149        if let Some(ref val) = self.ccy {
150            helpers::validate_pattern(
151                val,
152                "Ccy",
153                "[A-Z]{3,3}",
154                &helpers::child_path(path, "Ccy"),
155                config,
156                collector,
157            );
158        }
159        if let Some(ref val) = self.nm {
160            helpers::validate_length(
161                val,
162                "Nm",
163                Some(1),
164                Some(70),
165                &helpers::child_path(path, "Nm"),
166                config,
167                collector,
168            );
169        }
170        if let Some(ref val) = self.nm {
171            helpers::validate_pattern(
172                val,
173                "Nm",
174                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
175                &helpers::child_path(path, "Nm"),
176                config,
177                collector,
178            );
179        }
180        if let Some(ref val) = self.prxy
181            && config.validate_optional_fields
182        {
183            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
184        }
185    }
186}
187
188// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
189#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
190pub struct CashAccountType2Choice1 {
191    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
192    pub cd: Option<String>,
193    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
194    pub prtry: Option<String>,
195}
196
197impl Validate for CashAccountType2Choice1 {
198    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
199        if let Some(ref val) = self.cd {
200            helpers::validate_length(
201                val,
202                "Cd",
203                Some(1),
204                Some(4),
205                &helpers::child_path(path, "Cd"),
206                config,
207                collector,
208            );
209        }
210        if let Some(ref val) = self.prtry {
211            helpers::validate_length(
212                val,
213                "Prtry",
214                Some(1),
215                Some(35),
216                &helpers::child_path(path, "Prtry"),
217                config,
218                collector,
219            );
220        }
221        if let Some(ref val) = self.prtry {
222            helpers::validate_pattern(
223                val,
224                "Prtry",
225                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
226                &helpers::child_path(path, "Prtry"),
227                config,
228                collector,
229            );
230        }
231    }
232}
233
234// CategoryPurpose1Choice1: Category purpose, as published in an external category purpose code list.
235#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
236pub struct CategoryPurpose1Choice1 {
237    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
238    pub cd: Option<String>,
239}
240
241impl Validate for CategoryPurpose1Choice1 {
242    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
243        if let Some(ref val) = self.cd {
244            helpers::validate_length(
245                val,
246                "Cd",
247                Some(1),
248                Some(4),
249                &helpers::child_path(path, "Cd"),
250                config,
251                collector,
252            );
253        }
254    }
255}
256
257// ChargeBearerType1Code__1: In a credit transfer context, means that transaction charges on the sender side are to be borne by the debtor, transaction charges on the receiver side are to be borne by the creditor. In a direct debit context, means that transaction charges on the sender side are to be borne by the creditor, transaction charges on the receiver side are to be borne by the debtor.
258#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
259pub enum ChargeBearerType1Code1 {
260    #[default]
261    #[serde(rename = "DEBT")]
262    CodeDEBT,
263    #[serde(rename = "CRED")]
264    CodeCRED,
265    #[serde(rename = "SHAR")]
266    CodeSHAR,
267}
268
269impl Validate for ChargeBearerType1Code1 {
270    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
271        // Enum validation is typically empty
272    }
273}
274
275// Charges71: Agent that takes the transaction charges or to which the transaction charges are due.
276#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
277pub struct Charges71 {
278    #[serde(rename = "Amt")]
279    pub amt: CBPRAmount1,
280    #[serde(rename = "Agt")]
281    pub agt: BranchAndFinancialInstitutionIdentification61,
282}
283
284impl Validate for Charges71 {
285    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
286        self.amt
287            .validate(&helpers::child_path(path, "Amt"), config, collector);
288        self.agt
289            .validate(&helpers::child_path(path, "Agt"), config, collector);
290    }
291}
292
293// ClearingChannel2Code: Payment through internal book transfer.
294#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
295pub enum ClearingChannel2Code {
296    #[default]
297    #[serde(rename = "RTGS")]
298    CodeRTGS,
299    #[serde(rename = "RTNS")]
300    CodeRTNS,
301    #[serde(rename = "MPNS")]
302    CodeMPNS,
303    #[serde(rename = "BOOK")]
304    CodeBOOK,
305}
306
307impl Validate for ClearingChannel2Code {
308    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
309        // Enum validation is typically empty
310    }
311}
312
313// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
314#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
315pub struct ClearingSystemIdentification2Choice1 {
316    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
317    pub cd: Option<String>,
318}
319
320impl Validate for ClearingSystemIdentification2Choice1 {
321    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
322        if let Some(ref val) = self.cd {
323            helpers::validate_length(
324                val,
325                "Cd",
326                Some(1),
327                Some(5),
328                &helpers::child_path(path, "Cd"),
329                config,
330                collector,
331            );
332        }
333    }
334}
335
336// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
337#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
338pub struct ClearingSystemMemberIdentification21 {
339    #[serde(rename = "ClrSysId")]
340    pub clr_sys_id: ClearingSystemIdentification2Choice1,
341    #[serde(rename = "MmbId")]
342    pub mmb_id: String,
343}
344
345impl Validate for ClearingSystemMemberIdentification21 {
346    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
347        self.clr_sys_id
348            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
349        helpers::validate_length(
350            &self.mmb_id,
351            "MmbId",
352            Some(1),
353            Some(28),
354            &helpers::child_path(path, "MmbId"),
355            config,
356            collector,
357        );
358        helpers::validate_pattern(
359            &self.mmb_id,
360            "MmbId",
361            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
362            &helpers::child_path(path, "MmbId"),
363            config,
364            collector,
365        );
366    }
367}
368
369// CreditTransferTransaction391: Information supplied to enable the matching of an entry with the items that the transfer is intended to settle, such as commercial invoices in an accounts' receivable system.
370#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
371pub struct CreditTransferTransaction391 {
372    #[serde(rename = "PmtId")]
373    pub pmt_id: PaymentIdentification71,
374    #[serde(rename = "PmtTpInf", skip_serializing_if = "Option::is_none")]
375    pub pmt_tp_inf: Option<PaymentTypeInformation281>,
376    #[serde(rename = "IntrBkSttlmAmt")]
377    pub intr_bk_sttlm_amt: CBPRAmount1,
378    #[serde(rename = "IntrBkSttlmDt")]
379    pub intr_bk_sttlm_dt: String,
380    #[serde(rename = "SttlmPrty", skip_serializing_if = "Option::is_none")]
381    pub sttlm_prty: Option<Priority3Code>,
382    #[serde(rename = "SttlmTmIndctn", skip_serializing_if = "Option::is_none")]
383    pub sttlm_tm_indctn: Option<SettlementDateTimeIndication11>,
384    #[serde(rename = "SttlmTmReq", skip_serializing_if = "Option::is_none")]
385    pub sttlm_tm_req: Option<SettlementTimeRequest21>,
386    #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
387    pub instd_amt: Option<CBPRAmount1>,
388    #[serde(rename = "XchgRate", skip_serializing_if = "Option::is_none")]
389    pub xchg_rate: Option<f64>,
390    #[serde(rename = "ChrgBr")]
391    pub chrg_br: ChargeBearerType1Code1,
392    #[serde(rename = "ChrgsInf", skip_serializing_if = "Option::is_none")]
393    pub chrgs_inf: Option<Vec<Charges71>>,
394    #[serde(rename = "PrvsInstgAgt1", skip_serializing_if = "Option::is_none")]
395    pub prvs_instg_agt1: Option<BranchAndFinancialInstitutionIdentification61>,
396    #[serde(rename = "PrvsInstgAgt1Acct", skip_serializing_if = "Option::is_none")]
397    pub prvs_instg_agt1_acct: Option<CashAccount381>,
398    #[serde(rename = "PrvsInstgAgt2", skip_serializing_if = "Option::is_none")]
399    pub prvs_instg_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
400    #[serde(rename = "PrvsInstgAgt2Acct", skip_serializing_if = "Option::is_none")]
401    pub prvs_instg_agt2_acct: Option<CashAccount381>,
402    #[serde(rename = "PrvsInstgAgt3", skip_serializing_if = "Option::is_none")]
403    pub prvs_instg_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
404    #[serde(rename = "PrvsInstgAgt3Acct", skip_serializing_if = "Option::is_none")]
405    pub prvs_instg_agt3_acct: Option<CashAccount381>,
406    #[serde(rename = "InstgAgt")]
407    pub instg_agt: BranchAndFinancialInstitutionIdentification61,
408    #[serde(rename = "InstdAgt")]
409    pub instd_agt: BranchAndFinancialInstitutionIdentification61,
410    #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
411    pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification61>,
412    #[serde(rename = "IntrmyAgt1Acct", skip_serializing_if = "Option::is_none")]
413    pub intrmy_agt1_acct: Option<CashAccount381>,
414    #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
415    pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
416    #[serde(rename = "IntrmyAgt2Acct", skip_serializing_if = "Option::is_none")]
417    pub intrmy_agt2_acct: Option<CashAccount381>,
418    #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
419    pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
420    #[serde(rename = "IntrmyAgt3Acct", skip_serializing_if = "Option::is_none")]
421    pub intrmy_agt3_acct: Option<CashAccount381>,
422    #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
423    pub ultmt_dbtr: Option<PartyIdentification1351>,
424    #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
425    pub initg_pty: Option<PartyIdentification1351>,
426    #[serde(rename = "Dbtr")]
427    pub dbtr: PartyIdentification1352,
428    #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
429    pub dbtr_acct: Option<CashAccount381>,
430    #[serde(rename = "DbtrAgt")]
431    pub dbtr_agt: BranchAndFinancialInstitutionIdentification61,
432    #[serde(rename = "DbtrAgtAcct", skip_serializing_if = "Option::is_none")]
433    pub dbtr_agt_acct: Option<CashAccount381>,
434    #[serde(rename = "CdtrAgt")]
435    pub cdtr_agt: BranchAndFinancialInstitutionIdentification61,
436    #[serde(rename = "CdtrAgtAcct", skip_serializing_if = "Option::is_none")]
437    pub cdtr_agt_acct: Option<CashAccount381>,
438    #[serde(rename = "Cdtr")]
439    pub cdtr: PartyIdentification1353,
440    #[serde(rename = "CdtrAcct")]
441    pub cdtr_acct: CashAccount381,
442    #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
443    pub ultmt_cdtr: Option<PartyIdentification1351>,
444    #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
445    pub purp: Option<Purpose2Choice1>,
446    #[serde(rename = "RgltryRptg", skip_serializing_if = "Option::is_none")]
447    pub rgltry_rptg: Option<Vec<RegulatoryReporting31>>,
448    #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
449    pub rltd_rmt_inf: Option<RemittanceLocation71>,
450    #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
451    pub rmt_inf: Option<RemittanceInformation161>,
452}
453
454impl Validate for CreditTransferTransaction391 {
455    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
456        self.pmt_id
457            .validate(&helpers::child_path(path, "PmtId"), config, collector);
458        if let Some(ref val) = self.pmt_tp_inf
459            && config.validate_optional_fields
460        {
461            val.validate(&helpers::child_path(path, "PmtTpInf"), config, collector);
462        }
463        self.intr_bk_sttlm_amt.validate(
464            &helpers::child_path(path, "IntrBkSttlmAmt"),
465            config,
466            collector,
467        );
468        if let Some(ref val) = self.sttlm_prty
469            && config.validate_optional_fields
470        {
471            val.validate(&helpers::child_path(path, "SttlmPrty"), config, collector);
472        }
473        if let Some(ref val) = self.sttlm_tm_indctn
474            && config.validate_optional_fields
475        {
476            val.validate(
477                &helpers::child_path(path, "SttlmTmIndctn"),
478                config,
479                collector,
480            );
481        }
482        if let Some(ref val) = self.sttlm_tm_req
483            && config.validate_optional_fields
484        {
485            val.validate(&helpers::child_path(path, "SttlmTmReq"), config, collector);
486        }
487        if let Some(ref val) = self.instd_amt
488            && config.validate_optional_fields
489        {
490            val.validate(&helpers::child_path(path, "InstdAmt"), config, collector);
491        }
492        self.chrg_br
493            .validate(&helpers::child_path(path, "ChrgBr"), config, collector);
494        if let Some(ref vec) = self.chrgs_inf
495            && config.validate_optional_fields
496        {
497            for item in vec {
498                item.validate(&helpers::child_path(path, "ChrgsInf"), config, collector);
499            }
500        }
501        if let Some(ref val) = self.prvs_instg_agt1
502            && config.validate_optional_fields
503        {
504            val.validate(
505                &helpers::child_path(path, "PrvsInstgAgt1"),
506                config,
507                collector,
508            );
509        }
510        if let Some(ref val) = self.prvs_instg_agt1_acct
511            && config.validate_optional_fields
512        {
513            val.validate(
514                &helpers::child_path(path, "PrvsInstgAgt1Acct"),
515                config,
516                collector,
517            );
518        }
519        if let Some(ref val) = self.prvs_instg_agt2
520            && config.validate_optional_fields
521        {
522            val.validate(
523                &helpers::child_path(path, "PrvsInstgAgt2"),
524                config,
525                collector,
526            );
527        }
528        if let Some(ref val) = self.prvs_instg_agt2_acct
529            && config.validate_optional_fields
530        {
531            val.validate(
532                &helpers::child_path(path, "PrvsInstgAgt2Acct"),
533                config,
534                collector,
535            );
536        }
537        if let Some(ref val) = self.prvs_instg_agt3
538            && config.validate_optional_fields
539        {
540            val.validate(
541                &helpers::child_path(path, "PrvsInstgAgt3"),
542                config,
543                collector,
544            );
545        }
546        if let Some(ref val) = self.prvs_instg_agt3_acct
547            && config.validate_optional_fields
548        {
549            val.validate(
550                &helpers::child_path(path, "PrvsInstgAgt3Acct"),
551                config,
552                collector,
553            );
554        }
555        self.instg_agt
556            .validate(&helpers::child_path(path, "InstgAgt"), config, collector);
557        self.instd_agt
558            .validate(&helpers::child_path(path, "InstdAgt"), config, collector);
559        if let Some(ref val) = self.intrmy_agt1
560            && config.validate_optional_fields
561        {
562            val.validate(&helpers::child_path(path, "IntrmyAgt1"), config, collector);
563        }
564        if let Some(ref val) = self.intrmy_agt1_acct
565            && config.validate_optional_fields
566        {
567            val.validate(
568                &helpers::child_path(path, "IntrmyAgt1Acct"),
569                config,
570                collector,
571            );
572        }
573        if let Some(ref val) = self.intrmy_agt2
574            && config.validate_optional_fields
575        {
576            val.validate(&helpers::child_path(path, "IntrmyAgt2"), config, collector);
577        }
578        if let Some(ref val) = self.intrmy_agt2_acct
579            && config.validate_optional_fields
580        {
581            val.validate(
582                &helpers::child_path(path, "IntrmyAgt2Acct"),
583                config,
584                collector,
585            );
586        }
587        if let Some(ref val) = self.intrmy_agt3
588            && config.validate_optional_fields
589        {
590            val.validate(&helpers::child_path(path, "IntrmyAgt3"), config, collector);
591        }
592        if let Some(ref val) = self.intrmy_agt3_acct
593            && config.validate_optional_fields
594        {
595            val.validate(
596                &helpers::child_path(path, "IntrmyAgt3Acct"),
597                config,
598                collector,
599            );
600        }
601        if let Some(ref val) = self.ultmt_dbtr
602            && config.validate_optional_fields
603        {
604            val.validate(&helpers::child_path(path, "UltmtDbtr"), config, collector);
605        }
606        if let Some(ref val) = self.initg_pty
607            && config.validate_optional_fields
608        {
609            val.validate(&helpers::child_path(path, "InitgPty"), config, collector);
610        }
611        self.dbtr
612            .validate(&helpers::child_path(path, "Dbtr"), config, collector);
613        if let Some(ref val) = self.dbtr_acct
614            && config.validate_optional_fields
615        {
616            val.validate(&helpers::child_path(path, "DbtrAcct"), config, collector);
617        }
618        self.dbtr_agt
619            .validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
620        if let Some(ref val) = self.dbtr_agt_acct
621            && config.validate_optional_fields
622        {
623            val.validate(&helpers::child_path(path, "DbtrAgtAcct"), config, collector);
624        }
625        self.cdtr_agt
626            .validate(&helpers::child_path(path, "CdtrAgt"), config, collector);
627        if let Some(ref val) = self.cdtr_agt_acct
628            && config.validate_optional_fields
629        {
630            val.validate(&helpers::child_path(path, "CdtrAgtAcct"), config, collector);
631        }
632        self.cdtr
633            .validate(&helpers::child_path(path, "Cdtr"), config, collector);
634        self.cdtr_acct
635            .validate(&helpers::child_path(path, "CdtrAcct"), config, collector);
636        if let Some(ref val) = self.ultmt_cdtr
637            && config.validate_optional_fields
638        {
639            val.validate(&helpers::child_path(path, "UltmtCdtr"), config, collector);
640        }
641        if let Some(ref val) = self.purp
642            && config.validate_optional_fields
643        {
644            val.validate(&helpers::child_path(path, "Purp"), config, collector);
645        }
646        if let Some(ref vec) = self.rgltry_rptg
647            && config.validate_optional_fields
648        {
649            for item in vec {
650                item.validate(&helpers::child_path(path, "RgltryRptg"), config, collector);
651            }
652        }
653        if let Some(ref val) = self.rltd_rmt_inf
654            && config.validate_optional_fields
655        {
656            val.validate(&helpers::child_path(path, "RltdRmtInf"), config, collector);
657        }
658        if let Some(ref val) = self.rmt_inf
659            && config.validate_optional_fields
660        {
661            val.validate(&helpers::child_path(path, "RmtInf"), config, collector);
662        }
663    }
664}
665
666// DateAndPlaceOfBirth11: Country where a person was born.
667#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
668pub struct DateAndPlaceOfBirth11 {
669    #[serde(rename = "BirthDt")]
670    pub birth_dt: String,
671    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
672    pub prvc_of_birth: Option<String>,
673    #[serde(rename = "CityOfBirth")]
674    pub city_of_birth: String,
675    #[serde(rename = "CtryOfBirth")]
676    pub ctry_of_birth: String,
677}
678
679impl Validate for DateAndPlaceOfBirth11 {
680    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
681        if let Some(ref val) = self.prvc_of_birth {
682            helpers::validate_length(
683                val,
684                "PrvcOfBirth",
685                Some(1),
686                Some(35),
687                &helpers::child_path(path, "PrvcOfBirth"),
688                config,
689                collector,
690            );
691        }
692        if let Some(ref val) = self.prvc_of_birth {
693            helpers::validate_pattern(
694                val,
695                "PrvcOfBirth",
696                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
697                &helpers::child_path(path, "PrvcOfBirth"),
698                config,
699                collector,
700            );
701        }
702        helpers::validate_length(
703            &self.city_of_birth,
704            "CityOfBirth",
705            Some(1),
706            Some(35),
707            &helpers::child_path(path, "CityOfBirth"),
708            config,
709            collector,
710        );
711        helpers::validate_pattern(
712            &self.city_of_birth,
713            "CityOfBirth",
714            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
715            &helpers::child_path(path, "CityOfBirth"),
716            config,
717            collector,
718        );
719        helpers::validate_pattern(
720            &self.ctry_of_birth,
721            "CtryOfBirth",
722            "[A-Z]{2,2}",
723            &helpers::child_path(path, "CtryOfBirth"),
724            config,
725            collector,
726        );
727    }
728}
729
730// FIToFICustomerCreditTransferV08: Set of elements providing information specific to the individual credit transfer(s).
731#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
732pub struct FIToFICustomerCreditTransferV08 {
733    #[serde(rename = "GrpHdr")]
734    pub grp_hdr: GroupHeader931,
735    #[serde(rename = "CdtTrfTxInf")]
736    pub cdt_trf_tx_inf: CreditTransferTransaction391,
737}
738
739impl Validate for FIToFICustomerCreditTransferV08 {
740    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
741        self.grp_hdr
742            .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
743        self.cdt_trf_tx_inf
744            .validate(&helpers::child_path(path, "CdtTrfTxInf"), config, collector);
745    }
746}
747
748// FinancialInstitutionIdentification181: Legal entity identifier of the financial institution.
749#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
750pub struct FinancialInstitutionIdentification181 {
751    #[serde(rename = "BICFI")]
752    pub bicfi: String,
753    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
754    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
755    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
756    pub lei: Option<String>,
757}
758
759impl Validate for FinancialInstitutionIdentification181 {
760    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
761        helpers::validate_pattern(
762            &self.bicfi,
763            "BICFI",
764            "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
765            &helpers::child_path(path, "BICFI"),
766            config,
767            collector,
768        );
769        if let Some(ref val) = self.clr_sys_mmb_id
770            && config.validate_optional_fields
771        {
772            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
773        }
774        if let Some(ref val) = self.lei {
775            helpers::validate_pattern(
776                val,
777                "LEI",
778                "[A-Z0-9]{18,18}[0-9]{2,2}",
779                &helpers::child_path(path, "LEI"),
780                config,
781                collector,
782            );
783        }
784    }
785}
786
787// GenericAccountIdentification11: Entity that assigns the identification.
788#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
789pub struct GenericAccountIdentification11 {
790    #[serde(rename = "Id")]
791    pub id: String,
792    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
793    pub schme_nm: Option<AccountSchemeName1Choice1>,
794    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
795    pub issr: Option<String>,
796}
797
798impl Validate for GenericAccountIdentification11 {
799    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
800        helpers::validate_length(
801            &self.id,
802            "Id",
803            Some(1),
804            Some(34),
805            &helpers::child_path(path, "Id"),
806            config,
807            collector,
808        );
809        helpers::validate_pattern(
810            &self.id,
811            "Id",
812            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
813            &helpers::child_path(path, "Id"),
814            config,
815            collector,
816        );
817        if let Some(ref val) = self.schme_nm
818            && config.validate_optional_fields
819        {
820            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
821        }
822        if let Some(ref val) = self.issr {
823            helpers::validate_length(
824                val,
825                "Issr",
826                Some(1),
827                Some(35),
828                &helpers::child_path(path, "Issr"),
829                config,
830                collector,
831            );
832        }
833        if let Some(ref val) = self.issr {
834            helpers::validate_pattern(
835                val,
836                "Issr",
837                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
838                &helpers::child_path(path, "Issr"),
839                config,
840                collector,
841            );
842        }
843    }
844}
845
846// GenericOrganisationIdentification11: Entity that assigns the identification.
847#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
848pub struct GenericOrganisationIdentification11 {
849    #[serde(rename = "Id")]
850    pub id: String,
851    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
852    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
853    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
854    pub issr: Option<String>,
855}
856
857impl Validate for GenericOrganisationIdentification11 {
858    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
859        helpers::validate_length(
860            &self.id,
861            "Id",
862            Some(1),
863            Some(35),
864            &helpers::child_path(path, "Id"),
865            config,
866            collector,
867        );
868        helpers::validate_pattern(
869            &self.id,
870            "Id",
871            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
872            &helpers::child_path(path, "Id"),
873            config,
874            collector,
875        );
876        if let Some(ref val) = self.schme_nm
877            && config.validate_optional_fields
878        {
879            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
880        }
881        if let Some(ref val) = self.issr {
882            helpers::validate_length(
883                val,
884                "Issr",
885                Some(1),
886                Some(35),
887                &helpers::child_path(path, "Issr"),
888                config,
889                collector,
890            );
891        }
892        if let Some(ref val) = self.issr {
893            helpers::validate_pattern(
894                val,
895                "Issr",
896                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
897                &helpers::child_path(path, "Issr"),
898                config,
899                collector,
900            );
901        }
902    }
903}
904
905// GenericOrganisationIdentification12: Entity that assigns the identification.
906#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
907pub struct GenericOrganisationIdentification12 {
908    #[serde(rename = "Id")]
909    pub id: String,
910    #[serde(rename = "SchmeNm")]
911    pub schme_nm: OrganisationIdentificationSchemeName1Choice2,
912    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
913    pub issr: Option<String>,
914}
915
916impl Validate for GenericOrganisationIdentification12 {
917    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
918        helpers::validate_length(
919            &self.id,
920            "Id",
921            Some(1),
922            Some(35),
923            &helpers::child_path(path, "Id"),
924            config,
925            collector,
926        );
927        helpers::validate_pattern(
928            &self.id,
929            "Id",
930            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
931            &helpers::child_path(path, "Id"),
932            config,
933            collector,
934        );
935        self.schme_nm
936            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
937        if let Some(ref val) = self.issr {
938            helpers::validate_length(
939                val,
940                "Issr",
941                Some(1),
942                Some(35),
943                &helpers::child_path(path, "Issr"),
944                config,
945                collector,
946            );
947        }
948        if let Some(ref val) = self.issr {
949            helpers::validate_pattern(
950                val,
951                "Issr",
952                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
953                &helpers::child_path(path, "Issr"),
954                config,
955                collector,
956            );
957        }
958    }
959}
960
961// GenericPersonIdentification11: Entity that assigns the identification.
962#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
963pub struct GenericPersonIdentification11 {
964    #[serde(rename = "Id")]
965    pub id: String,
966    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
967    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
968    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
969    pub issr: Option<String>,
970}
971
972impl Validate for GenericPersonIdentification11 {
973    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
974        helpers::validate_length(
975            &self.id,
976            "Id",
977            Some(1),
978            Some(35),
979            &helpers::child_path(path, "Id"),
980            config,
981            collector,
982        );
983        helpers::validate_pattern(
984            &self.id,
985            "Id",
986            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
987            &helpers::child_path(path, "Id"),
988            config,
989            collector,
990        );
991        if let Some(ref val) = self.schme_nm
992            && config.validate_optional_fields
993        {
994            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
995        }
996        if let Some(ref val) = self.issr {
997            helpers::validate_length(
998                val,
999                "Issr",
1000                Some(1),
1001                Some(35),
1002                &helpers::child_path(path, "Issr"),
1003                config,
1004                collector,
1005            );
1006        }
1007        if let Some(ref val) = self.issr {
1008            helpers::validate_pattern(
1009                val,
1010                "Issr",
1011                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1012                &helpers::child_path(path, "Issr"),
1013                config,
1014                collector,
1015            );
1016        }
1017    }
1018}
1019
1020// GenericPersonIdentification12: Entity that assigns the identification.
1021#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1022pub struct GenericPersonIdentification12 {
1023    #[serde(rename = "Id")]
1024    pub id: String,
1025    #[serde(rename = "SchmeNm")]
1026    pub schme_nm: PersonIdentificationSchemeName1Choice2,
1027    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1028    pub issr: Option<String>,
1029}
1030
1031impl Validate for GenericPersonIdentification12 {
1032    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1033        helpers::validate_length(
1034            &self.id,
1035            "Id",
1036            Some(1),
1037            Some(35),
1038            &helpers::child_path(path, "Id"),
1039            config,
1040            collector,
1041        );
1042        helpers::validate_pattern(
1043            &self.id,
1044            "Id",
1045            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1046            &helpers::child_path(path, "Id"),
1047            config,
1048            collector,
1049        );
1050        self.schme_nm
1051            .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
1052        if let Some(ref val) = self.issr {
1053            helpers::validate_length(
1054                val,
1055                "Issr",
1056                Some(1),
1057                Some(35),
1058                &helpers::child_path(path, "Issr"),
1059                config,
1060                collector,
1061            );
1062        }
1063        if let Some(ref val) = self.issr {
1064            helpers::validate_pattern(
1065                val,
1066                "Issr",
1067                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1068                &helpers::child_path(path, "Issr"),
1069                config,
1070                collector,
1071            );
1072        }
1073    }
1074}
1075
1076// GroupHeader931: Specifies the details on how the settlement of the transaction(s) between the instructing agent and the instructed agent is completed.
1077#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1078pub struct GroupHeader931 {
1079    #[serde(rename = "MsgId")]
1080    pub msg_id: String,
1081    #[serde(rename = "CreDtTm")]
1082    pub cre_dt_tm: String,
1083    #[serde(rename = "NbOfTxs")]
1084    pub nb_of_txs: Max15NumericTextfixed,
1085    #[serde(rename = "SttlmInf")]
1086    pub sttlm_inf: SettlementInstruction71,
1087}
1088
1089impl Validate for GroupHeader931 {
1090    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1091        helpers::validate_length(
1092            &self.msg_id,
1093            "MsgId",
1094            Some(1),
1095            Some(35),
1096            &helpers::child_path(path, "MsgId"),
1097            config,
1098            collector,
1099        );
1100        helpers::validate_pattern(
1101            &self.msg_id,
1102            "MsgId",
1103            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1104            &helpers::child_path(path, "MsgId"),
1105            config,
1106            collector,
1107        );
1108        helpers::validate_pattern(
1109            &self.cre_dt_tm,
1110            "CreDtTm",
1111            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
1112            &helpers::child_path(path, "CreDtTm"),
1113            config,
1114            collector,
1115        );
1116        self.nb_of_txs
1117            .validate(&helpers::child_path(path, "NbOfTxs"), config, collector);
1118        self.sttlm_inf
1119            .validate(&helpers::child_path(path, "SttlmInf"), config, collector);
1120    }
1121}
1122
1123// LocalInstrument2Choice1: Specifies the local instrument, as published in an external local instrument code list.
1124#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1125pub struct LocalInstrument2Choice1 {
1126    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1127    pub cd: Option<String>,
1128}
1129
1130impl Validate for LocalInstrument2Choice1 {
1131    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1132        if let Some(ref val) = self.cd {
1133            helpers::validate_length(
1134                val,
1135                "Cd",
1136                Some(1),
1137                Some(35),
1138                &helpers::child_path(path, "Cd"),
1139                config,
1140                collector,
1141            );
1142        }
1143    }
1144}
1145
1146// Max15NumericText_fixed: 1
1147#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1148pub enum Max15NumericTextfixed {
1149    #[default]
1150    #[serde(rename = "1")]
1151    Code1,
1152}
1153
1154impl Validate for Max15NumericTextfixed {
1155    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
1156        // Enum validation is typically empty
1157    }
1158}
1159
1160// NameAndAddress161: Postal address of a party.
1161#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1162pub struct NameAndAddress161 {
1163    #[serde(rename = "Nm")]
1164    pub nm: String,
1165    #[serde(rename = "Adr")]
1166    pub adr: PostalAddress242,
1167}
1168
1169impl Validate for NameAndAddress161 {
1170    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1171        helpers::validate_length(
1172            &self.nm,
1173            "Nm",
1174            Some(1),
1175            Some(140),
1176            &helpers::child_path(path, "Nm"),
1177            config,
1178            collector,
1179        );
1180        helpers::validate_pattern(
1181            &self.nm,
1182            "Nm",
1183            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1184            &helpers::child_path(path, "Nm"),
1185            config,
1186            collector,
1187        );
1188        self.adr
1189            .validate(&helpers::child_path(path, "Adr"), config, collector);
1190    }
1191}
1192
1193// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
1194#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1195pub struct OrganisationIdentification291 {
1196    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
1197    pub any_bic: Option<String>,
1198    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1199    pub lei: Option<String>,
1200    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1201    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
1202}
1203
1204impl Validate for OrganisationIdentification291 {
1205    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1206        if let Some(ref val) = self.any_bic {
1207            helpers::validate_pattern(
1208                val,
1209                "AnyBIC",
1210                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1211                &helpers::child_path(path, "AnyBIC"),
1212                config,
1213                collector,
1214            );
1215        }
1216        if let Some(ref val) = self.lei {
1217            helpers::validate_pattern(
1218                val,
1219                "LEI",
1220                "[A-Z0-9]{18,18}[0-9]{2,2}",
1221                &helpers::child_path(path, "LEI"),
1222                config,
1223                collector,
1224            );
1225        }
1226        if let Some(ref vec) = self.othr
1227            && config.validate_optional_fields
1228        {
1229            for item in vec {
1230                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1231            }
1232        }
1233    }
1234}
1235
1236// OrganisationIdentification292: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
1237#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1238pub struct OrganisationIdentification292 {
1239    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
1240    pub any_bic: Option<String>,
1241    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1242    pub lei: Option<String>,
1243    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1244    pub othr: Option<Vec<GenericOrganisationIdentification12>>,
1245}
1246
1247impl Validate for OrganisationIdentification292 {
1248    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1249        if let Some(ref val) = self.any_bic {
1250            helpers::validate_pattern(
1251                val,
1252                "AnyBIC",
1253                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
1254                &helpers::child_path(path, "AnyBIC"),
1255                config,
1256                collector,
1257            );
1258        }
1259        if let Some(ref val) = self.lei {
1260            helpers::validate_pattern(
1261                val,
1262                "LEI",
1263                "[A-Z0-9]{18,18}[0-9]{2,2}",
1264                &helpers::child_path(path, "LEI"),
1265                config,
1266                collector,
1267            );
1268        }
1269        if let Some(ref vec) = self.othr
1270            && config.validate_optional_fields
1271        {
1272            for item in vec {
1273                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1274            }
1275        }
1276    }
1277}
1278
1279// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
1280#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1281pub struct OrganisationIdentificationSchemeName1Choice1 {
1282    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1283    pub cd: Option<String>,
1284    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1285    pub prtry: Option<String>,
1286}
1287
1288impl Validate for OrganisationIdentificationSchemeName1Choice1 {
1289    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1290        if let Some(ref val) = self.cd {
1291            helpers::validate_length(
1292                val,
1293                "Cd",
1294                Some(1),
1295                Some(4),
1296                &helpers::child_path(path, "Cd"),
1297                config,
1298                collector,
1299            );
1300        }
1301        if let Some(ref val) = self.prtry {
1302            helpers::validate_length(
1303                val,
1304                "Prtry",
1305                Some(1),
1306                Some(35),
1307                &helpers::child_path(path, "Prtry"),
1308                config,
1309                collector,
1310            );
1311        }
1312        if let Some(ref val) = self.prtry {
1313            helpers::validate_pattern(
1314                val,
1315                "Prtry",
1316                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1317                &helpers::child_path(path, "Prtry"),
1318                config,
1319                collector,
1320            );
1321        }
1322    }
1323}
1324
1325// OrganisationIdentificationSchemeName1Choice2: Name of the identification scheme, in a coded form as published in an external list.
1326#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1327pub struct OrganisationIdentificationSchemeName1Choice2 {
1328    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1329    pub cd: Option<String>,
1330}
1331
1332impl Validate for OrganisationIdentificationSchemeName1Choice2 {
1333    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1334        if let Some(ref val) = self.cd {
1335            helpers::validate_length(
1336                val,
1337                "Cd",
1338                Some(1),
1339                Some(4),
1340                &helpers::child_path(path, "Cd"),
1341                config,
1342                collector,
1343            );
1344        }
1345    }
1346}
1347
1348// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
1349#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1350pub struct Party38Choice1 {
1351    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
1352    pub org_id: Option<OrganisationIdentification291>,
1353    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
1354    pub prvt_id: Option<PersonIdentification131>,
1355}
1356
1357impl Validate for Party38Choice1 {
1358    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1359        if let Some(ref val) = self.org_id
1360            && config.validate_optional_fields
1361        {
1362            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
1363        }
1364        if let Some(ref val) = self.prvt_id
1365            && config.validate_optional_fields
1366        {
1367            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
1368        }
1369    }
1370}
1371
1372// Party38Choice2: Unique and unambiguous identification of a person, for example a passport.
1373#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1374pub struct Party38Choice2 {
1375    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
1376    pub org_id: Option<OrganisationIdentification292>,
1377    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
1378    pub prvt_id: Option<PersonIdentification132>,
1379}
1380
1381impl Validate for Party38Choice2 {
1382    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1383        if let Some(ref val) = self.org_id
1384            && config.validate_optional_fields
1385        {
1386            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
1387        }
1388        if let Some(ref val) = self.prvt_id
1389            && config.validate_optional_fields
1390        {
1391            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
1392        }
1393    }
1394}
1395
1396// PartyIdentification1351: 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.
1397#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1398pub struct PartyIdentification1351 {
1399    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1400    pub nm: Option<String>,
1401    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1402    pub pstl_adr: Option<PostalAddress241>,
1403    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1404    pub id: Option<Party38Choice1>,
1405    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
1406    pub ctry_of_res: Option<String>,
1407}
1408
1409impl Validate for PartyIdentification1351 {
1410    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1411        if let Some(ref val) = self.nm {
1412            helpers::validate_length(
1413                val,
1414                "Nm",
1415                Some(1),
1416                Some(140),
1417                &helpers::child_path(path, "Nm"),
1418                config,
1419                collector,
1420            );
1421        }
1422        if let Some(ref val) = self.nm {
1423            helpers::validate_pattern(
1424                val,
1425                "Nm",
1426                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1427                &helpers::child_path(path, "Nm"),
1428                config,
1429                collector,
1430            );
1431        }
1432        if let Some(ref val) = self.pstl_adr
1433            && config.validate_optional_fields
1434        {
1435            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1436        }
1437        if let Some(ref val) = self.id
1438            && config.validate_optional_fields
1439        {
1440            val.validate(&helpers::child_path(path, "Id"), config, collector);
1441        }
1442        if let Some(ref val) = self.ctry_of_res {
1443            helpers::validate_pattern(
1444                val,
1445                "CtryOfRes",
1446                "[A-Z]{2,2}",
1447                &helpers::child_path(path, "CtryOfRes"),
1448                config,
1449                collector,
1450            );
1451        }
1452    }
1453}
1454
1455// 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.
1456#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1457pub struct PartyIdentification1352 {
1458    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1459    pub nm: Option<String>,
1460    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1461    pub pstl_adr: Option<PostalAddress242>,
1462    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1463    pub id: Option<Party38Choice2>,
1464    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
1465    pub ctry_of_res: Option<String>,
1466}
1467
1468impl Validate for PartyIdentification1352 {
1469    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1470        if let Some(ref val) = self.nm {
1471            helpers::validate_length(
1472                val,
1473                "Nm",
1474                Some(1),
1475                Some(140),
1476                &helpers::child_path(path, "Nm"),
1477                config,
1478                collector,
1479            );
1480        }
1481        if let Some(ref val) = self.nm {
1482            helpers::validate_pattern(
1483                val,
1484                "Nm",
1485                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1486                &helpers::child_path(path, "Nm"),
1487                config,
1488                collector,
1489            );
1490        }
1491        if let Some(ref val) = self.pstl_adr
1492            && config.validate_optional_fields
1493        {
1494            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1495        }
1496        if let Some(ref val) = self.id
1497            && config.validate_optional_fields
1498        {
1499            val.validate(&helpers::child_path(path, "Id"), config, collector);
1500        }
1501        if let Some(ref val) = self.ctry_of_res {
1502            helpers::validate_pattern(
1503                val,
1504                "CtryOfRes",
1505                "[A-Z]{2,2}",
1506                &helpers::child_path(path, "CtryOfRes"),
1507                config,
1508                collector,
1509            );
1510        }
1511    }
1512}
1513
1514// 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.
1515#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1516pub struct PartyIdentification1353 {
1517    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1518    pub nm: Option<String>,
1519    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1520    pub pstl_adr: Option<PostalAddress242>,
1521    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1522    pub id: Option<Party38Choice1>,
1523    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
1524    pub ctry_of_res: Option<String>,
1525}
1526
1527impl Validate for PartyIdentification1353 {
1528    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1529        if let Some(ref val) = self.nm {
1530            helpers::validate_length(
1531                val,
1532                "Nm",
1533                Some(1),
1534                Some(140),
1535                &helpers::child_path(path, "Nm"),
1536                config,
1537                collector,
1538            );
1539        }
1540        if let Some(ref val) = self.nm {
1541            helpers::validate_pattern(
1542                val,
1543                "Nm",
1544                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1545                &helpers::child_path(path, "Nm"),
1546                config,
1547                collector,
1548            );
1549        }
1550        if let Some(ref val) = self.pstl_adr
1551            && config.validate_optional_fields
1552        {
1553            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1554        }
1555        if let Some(ref val) = self.id
1556            && config.validate_optional_fields
1557        {
1558            val.validate(&helpers::child_path(path, "Id"), config, collector);
1559        }
1560        if let Some(ref val) = self.ctry_of_res {
1561            helpers::validate_pattern(
1562                val,
1563                "CtryOfRes",
1564                "[A-Z]{2,2}",
1565                &helpers::child_path(path, "CtryOfRes"),
1566                config,
1567                collector,
1568            );
1569        }
1570    }
1571}
1572
1573// PaymentIdentification71: Unique reference, as assigned by a clearing system, to unambiguously identify the instruction.
1574#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1575pub struct PaymentIdentification71 {
1576    #[serde(rename = "InstrId")]
1577    pub instr_id: String,
1578    #[serde(rename = "EndToEndId")]
1579    pub end_to_end_id: String,
1580    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
1581    pub tx_id: Option<String>,
1582    #[serde(rename = "UETR")]
1583    pub uetr: String,
1584    #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
1585    pub clr_sys_ref: Option<String>,
1586}
1587
1588impl Validate for PaymentIdentification71 {
1589    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1590        helpers::validate_length(
1591            &self.instr_id,
1592            "InstrId",
1593            Some(1),
1594            Some(16),
1595            &helpers::child_path(path, "InstrId"),
1596            config,
1597            collector,
1598        );
1599        helpers::validate_pattern(
1600            &self.instr_id,
1601            "InstrId",
1602            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1603            &helpers::child_path(path, "InstrId"),
1604            config,
1605            collector,
1606        );
1607        helpers::validate_length(
1608            &self.end_to_end_id,
1609            "EndToEndId",
1610            Some(1),
1611            Some(35),
1612            &helpers::child_path(path, "EndToEndId"),
1613            config,
1614            collector,
1615        );
1616        helpers::validate_pattern(
1617            &self.end_to_end_id,
1618            "EndToEndId",
1619            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1620            &helpers::child_path(path, "EndToEndId"),
1621            config,
1622            collector,
1623        );
1624        if let Some(ref val) = self.tx_id {
1625            helpers::validate_length(
1626                val,
1627                "TxId",
1628                Some(1),
1629                Some(35),
1630                &helpers::child_path(path, "TxId"),
1631                config,
1632                collector,
1633            );
1634        }
1635        if let Some(ref val) = self.tx_id {
1636            helpers::validate_pattern(
1637                val,
1638                "TxId",
1639                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1640                &helpers::child_path(path, "TxId"),
1641                config,
1642                collector,
1643            );
1644        }
1645        helpers::validate_pattern(
1646            &self.uetr,
1647            "UETR",
1648            "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
1649            &helpers::child_path(path, "UETR"),
1650            config,
1651            collector,
1652        );
1653        if let Some(ref val) = self.clr_sys_ref {
1654            helpers::validate_length(
1655                val,
1656                "ClrSysRef",
1657                Some(1),
1658                Some(35),
1659                &helpers::child_path(path, "ClrSysRef"),
1660                config,
1661                collector,
1662            );
1663        }
1664        if let Some(ref val) = self.clr_sys_ref {
1665            helpers::validate_pattern(
1666                val,
1667                "ClrSysRef",
1668                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1669                &helpers::child_path(path, "ClrSysRef"),
1670                config,
1671                collector,
1672            );
1673        }
1674    }
1675}
1676
1677// PaymentTypeInformation281: Specifies the high level purpose of the instruction based on a set of pre-defined categories.
1678// Usage: This is used by the initiating party to provide information concerning the processing of the payment. It is likely to trigger special processing by any of the agents involved in the payment chain.
1679#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1680pub struct PaymentTypeInformation281 {
1681    #[serde(rename = "InstrPrty", skip_serializing_if = "Option::is_none")]
1682    pub instr_prty: Option<Priority2Code>,
1683    #[serde(rename = "ClrChanl", skip_serializing_if = "Option::is_none")]
1684    pub clr_chanl: Option<ClearingChannel2Code>,
1685    #[serde(rename = "SvcLvl", skip_serializing_if = "Option::is_none")]
1686    pub svc_lvl: Option<Vec<ServiceLevel8Choice1>>,
1687    #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
1688    pub lcl_instrm: Option<LocalInstrument2Choice1>,
1689    #[serde(rename = "CtgyPurp", skip_serializing_if = "Option::is_none")]
1690    pub ctgy_purp: Option<CategoryPurpose1Choice1>,
1691}
1692
1693impl Validate for PaymentTypeInformation281 {
1694    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1695        if let Some(ref val) = self.instr_prty
1696            && config.validate_optional_fields
1697        {
1698            val.validate(&helpers::child_path(path, "InstrPrty"), config, collector);
1699        }
1700        if let Some(ref val) = self.clr_chanl
1701            && config.validate_optional_fields
1702        {
1703            val.validate(&helpers::child_path(path, "ClrChanl"), config, collector);
1704        }
1705        if let Some(ref vec) = self.svc_lvl
1706            && config.validate_optional_fields
1707        {
1708            for item in vec {
1709                item.validate(&helpers::child_path(path, "SvcLvl"), config, collector);
1710            }
1711        }
1712        if let Some(ref val) = self.lcl_instrm
1713            && config.validate_optional_fields
1714        {
1715            val.validate(&helpers::child_path(path, "LclInstrm"), config, collector);
1716        }
1717        if let Some(ref val) = self.ctgy_purp
1718            && config.validate_optional_fields
1719        {
1720            val.validate(&helpers::child_path(path, "CtgyPurp"), config, collector);
1721        }
1722    }
1723}
1724
1725// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
1726#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1727pub struct PersonIdentification131 {
1728    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1729    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
1730    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1731    pub othr: Option<Vec<GenericPersonIdentification11>>,
1732}
1733
1734impl Validate for PersonIdentification131 {
1735    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1736        if let Some(ref val) = self.dt_and_plc_of_birth
1737            && config.validate_optional_fields
1738        {
1739            val.validate(
1740                &helpers::child_path(path, "DtAndPlcOfBirth"),
1741                config,
1742                collector,
1743            );
1744        }
1745        if let Some(ref vec) = self.othr
1746            && config.validate_optional_fields
1747        {
1748            for item in vec {
1749                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1750            }
1751        }
1752    }
1753}
1754
1755// PersonIdentification132: Unique identification of a person, as assigned by an institution, using an identification scheme.
1756#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1757pub struct PersonIdentification132 {
1758    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1759    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
1760    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1761    pub othr: Option<Vec<GenericPersonIdentification12>>,
1762}
1763
1764impl Validate for PersonIdentification132 {
1765    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1766        if let Some(ref val) = self.dt_and_plc_of_birth
1767            && config.validate_optional_fields
1768        {
1769            val.validate(
1770                &helpers::child_path(path, "DtAndPlcOfBirth"),
1771                config,
1772                collector,
1773            );
1774        }
1775        if let Some(ref vec) = self.othr
1776            && config.validate_optional_fields
1777        {
1778            for item in vec {
1779                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1780            }
1781        }
1782    }
1783}
1784
1785// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
1786#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1787pub struct PersonIdentificationSchemeName1Choice1 {
1788    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1789    pub cd: Option<String>,
1790    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1791    pub prtry: Option<String>,
1792}
1793
1794impl Validate for PersonIdentificationSchemeName1Choice1 {
1795    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1796        if let Some(ref val) = self.cd {
1797            helpers::validate_length(
1798                val,
1799                "Cd",
1800                Some(1),
1801                Some(4),
1802                &helpers::child_path(path, "Cd"),
1803                config,
1804                collector,
1805            );
1806        }
1807        if let Some(ref val) = self.prtry {
1808            helpers::validate_length(
1809                val,
1810                "Prtry",
1811                Some(1),
1812                Some(35),
1813                &helpers::child_path(path, "Prtry"),
1814                config,
1815                collector,
1816            );
1817        }
1818        if let Some(ref val) = self.prtry {
1819            helpers::validate_pattern(
1820                val,
1821                "Prtry",
1822                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1823                &helpers::child_path(path, "Prtry"),
1824                config,
1825                collector,
1826            );
1827        }
1828    }
1829}
1830
1831// PersonIdentificationSchemeName1Choice2: Name of the identification scheme, in a coded form as published in an external list.
1832#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1833pub struct PersonIdentificationSchemeName1Choice2 {
1834    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1835    pub cd: Option<String>,
1836}
1837
1838impl Validate for PersonIdentificationSchemeName1Choice2 {
1839    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1840        if let Some(ref val) = self.cd {
1841            helpers::validate_length(
1842                val,
1843                "Cd",
1844                Some(1),
1845                Some(4),
1846                &helpers::child_path(path, "Cd"),
1847                config,
1848                collector,
1849            );
1850        }
1851    }
1852}
1853
1854// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
1855#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1856pub struct PostalAddress241 {
1857    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
1858    pub dept: Option<String>,
1859    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
1860    pub sub_dept: Option<String>,
1861    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
1862    pub strt_nm: Option<String>,
1863    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
1864    pub bldg_nb: Option<String>,
1865    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
1866    pub bldg_nm: Option<String>,
1867    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
1868    pub flr: Option<String>,
1869    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
1870    pub pst_bx: Option<String>,
1871    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
1872    pub room: Option<String>,
1873    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
1874    pub pst_cd: Option<String>,
1875    #[serde(rename = "TwnNm")]
1876    pub twn_nm: String,
1877    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1878    pub twn_lctn_nm: Option<String>,
1879    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1880    pub dstrct_nm: Option<String>,
1881    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1882    pub ctry_sub_dvsn: Option<String>,
1883    #[serde(rename = "Ctry")]
1884    pub ctry: String,
1885    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1886    pub adr_line: Option<Vec<String>>,
1887}
1888
1889impl Validate for PostalAddress241 {
1890    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1891        if let Some(ref val) = self.dept {
1892            helpers::validate_length(
1893                val,
1894                "Dept",
1895                Some(1),
1896                Some(70),
1897                &helpers::child_path(path, "Dept"),
1898                config,
1899                collector,
1900            );
1901        }
1902        if let Some(ref val) = self.dept {
1903            helpers::validate_pattern(
1904                val,
1905                "Dept",
1906                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1907                &helpers::child_path(path, "Dept"),
1908                config,
1909                collector,
1910            );
1911        }
1912        if let Some(ref val) = self.sub_dept {
1913            helpers::validate_length(
1914                val,
1915                "SubDept",
1916                Some(1),
1917                Some(70),
1918                &helpers::child_path(path, "SubDept"),
1919                config,
1920                collector,
1921            );
1922        }
1923        if let Some(ref val) = self.sub_dept {
1924            helpers::validate_pattern(
1925                val,
1926                "SubDept",
1927                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1928                &helpers::child_path(path, "SubDept"),
1929                config,
1930                collector,
1931            );
1932        }
1933        if let Some(ref val) = self.strt_nm {
1934            helpers::validate_length(
1935                val,
1936                "StrtNm",
1937                Some(1),
1938                Some(70),
1939                &helpers::child_path(path, "StrtNm"),
1940                config,
1941                collector,
1942            );
1943        }
1944        if let Some(ref val) = self.strt_nm {
1945            helpers::validate_pattern(
1946                val,
1947                "StrtNm",
1948                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1949                &helpers::child_path(path, "StrtNm"),
1950                config,
1951                collector,
1952            );
1953        }
1954        if let Some(ref val) = self.bldg_nb {
1955            helpers::validate_length(
1956                val,
1957                "BldgNb",
1958                Some(1),
1959                Some(16),
1960                &helpers::child_path(path, "BldgNb"),
1961                config,
1962                collector,
1963            );
1964        }
1965        if let Some(ref val) = self.bldg_nb {
1966            helpers::validate_pattern(
1967                val,
1968                "BldgNb",
1969                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1970                &helpers::child_path(path, "BldgNb"),
1971                config,
1972                collector,
1973            );
1974        }
1975        if let Some(ref val) = self.bldg_nm {
1976            helpers::validate_length(
1977                val,
1978                "BldgNm",
1979                Some(1),
1980                Some(35),
1981                &helpers::child_path(path, "BldgNm"),
1982                config,
1983                collector,
1984            );
1985        }
1986        if let Some(ref val) = self.bldg_nm {
1987            helpers::validate_pattern(
1988                val,
1989                "BldgNm",
1990                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1991                &helpers::child_path(path, "BldgNm"),
1992                config,
1993                collector,
1994            );
1995        }
1996        if let Some(ref val) = self.flr {
1997            helpers::validate_length(
1998                val,
1999                "Flr",
2000                Some(1),
2001                Some(70),
2002                &helpers::child_path(path, "Flr"),
2003                config,
2004                collector,
2005            );
2006        }
2007        if let Some(ref val) = self.flr {
2008            helpers::validate_pattern(
2009                val,
2010                "Flr",
2011                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2012                &helpers::child_path(path, "Flr"),
2013                config,
2014                collector,
2015            );
2016        }
2017        if let Some(ref val) = self.pst_bx {
2018            helpers::validate_length(
2019                val,
2020                "PstBx",
2021                Some(1),
2022                Some(16),
2023                &helpers::child_path(path, "PstBx"),
2024                config,
2025                collector,
2026            );
2027        }
2028        if let Some(ref val) = self.pst_bx {
2029            helpers::validate_pattern(
2030                val,
2031                "PstBx",
2032                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2033                &helpers::child_path(path, "PstBx"),
2034                config,
2035                collector,
2036            );
2037        }
2038        if let Some(ref val) = self.room {
2039            helpers::validate_length(
2040                val,
2041                "Room",
2042                Some(1),
2043                Some(70),
2044                &helpers::child_path(path, "Room"),
2045                config,
2046                collector,
2047            );
2048        }
2049        if let Some(ref val) = self.room {
2050            helpers::validate_pattern(
2051                val,
2052                "Room",
2053                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2054                &helpers::child_path(path, "Room"),
2055                config,
2056                collector,
2057            );
2058        }
2059        if let Some(ref val) = self.pst_cd {
2060            helpers::validate_length(
2061                val,
2062                "PstCd",
2063                Some(1),
2064                Some(16),
2065                &helpers::child_path(path, "PstCd"),
2066                config,
2067                collector,
2068            );
2069        }
2070        if let Some(ref val) = self.pst_cd {
2071            helpers::validate_pattern(
2072                val,
2073                "PstCd",
2074                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2075                &helpers::child_path(path, "PstCd"),
2076                config,
2077                collector,
2078            );
2079        }
2080        helpers::validate_length(
2081            &self.twn_nm,
2082            "TwnNm",
2083            Some(1),
2084            Some(35),
2085            &helpers::child_path(path, "TwnNm"),
2086            config,
2087            collector,
2088        );
2089        helpers::validate_pattern(
2090            &self.twn_nm,
2091            "TwnNm",
2092            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2093            &helpers::child_path(path, "TwnNm"),
2094            config,
2095            collector,
2096        );
2097        if let Some(ref val) = self.twn_lctn_nm {
2098            helpers::validate_length(
2099                val,
2100                "TwnLctnNm",
2101                Some(1),
2102                Some(35),
2103                &helpers::child_path(path, "TwnLctnNm"),
2104                config,
2105                collector,
2106            );
2107        }
2108        if let Some(ref val) = self.twn_lctn_nm {
2109            helpers::validate_pattern(
2110                val,
2111                "TwnLctnNm",
2112                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2113                &helpers::child_path(path, "TwnLctnNm"),
2114                config,
2115                collector,
2116            );
2117        }
2118        if let Some(ref val) = self.dstrct_nm {
2119            helpers::validate_length(
2120                val,
2121                "DstrctNm",
2122                Some(1),
2123                Some(35),
2124                &helpers::child_path(path, "DstrctNm"),
2125                config,
2126                collector,
2127            );
2128        }
2129        if let Some(ref val) = self.dstrct_nm {
2130            helpers::validate_pattern(
2131                val,
2132                "DstrctNm",
2133                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2134                &helpers::child_path(path, "DstrctNm"),
2135                config,
2136                collector,
2137            );
2138        }
2139        if let Some(ref val) = self.ctry_sub_dvsn {
2140            helpers::validate_length(
2141                val,
2142                "CtrySubDvsn",
2143                Some(1),
2144                Some(35),
2145                &helpers::child_path(path, "CtrySubDvsn"),
2146                config,
2147                collector,
2148            );
2149        }
2150        if let Some(ref val) = self.ctry_sub_dvsn {
2151            helpers::validate_pattern(
2152                val,
2153                "CtrySubDvsn",
2154                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2155                &helpers::child_path(path, "CtrySubDvsn"),
2156                config,
2157                collector,
2158            );
2159        }
2160        helpers::validate_pattern(
2161            &self.ctry,
2162            "Ctry",
2163            "[A-Z]{2,2}",
2164            &helpers::child_path(path, "Ctry"),
2165            config,
2166            collector,
2167        );
2168        if let Some(ref vec) = self.adr_line {
2169            for item in vec {
2170                helpers::validate_length(
2171                    item,
2172                    "AdrLine",
2173                    Some(1),
2174                    Some(70),
2175                    &helpers::child_path(path, "AdrLine"),
2176                    config,
2177                    collector,
2178                );
2179            }
2180        }
2181        if let Some(ref vec) = self.adr_line {
2182            for item in vec {
2183                helpers::validate_pattern(
2184                    item,
2185                    "AdrLine",
2186                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2187                    &helpers::child_path(path, "AdrLine"),
2188                    config,
2189                    collector,
2190                );
2191            }
2192        }
2193    }
2194}
2195
2196// PostalAddress242: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
2197#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2198pub struct PostalAddress242 {
2199    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
2200    pub dept: Option<String>,
2201    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
2202    pub sub_dept: Option<String>,
2203    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
2204    pub strt_nm: Option<String>,
2205    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
2206    pub bldg_nb: Option<String>,
2207    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
2208    pub bldg_nm: Option<String>,
2209    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
2210    pub flr: Option<String>,
2211    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
2212    pub pst_bx: Option<String>,
2213    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
2214    pub room: Option<String>,
2215    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
2216    pub pst_cd: Option<String>,
2217    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
2218    pub twn_nm: Option<String>,
2219    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
2220    pub twn_lctn_nm: Option<String>,
2221    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
2222    pub dstrct_nm: Option<String>,
2223    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
2224    pub ctry_sub_dvsn: Option<String>,
2225    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
2226    pub ctry: Option<String>,
2227    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
2228    pub adr_line: Option<Vec<String>>,
2229}
2230
2231impl Validate for PostalAddress242 {
2232    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2233        if let Some(ref val) = self.dept {
2234            helpers::validate_length(
2235                val,
2236                "Dept",
2237                Some(1),
2238                Some(70),
2239                &helpers::child_path(path, "Dept"),
2240                config,
2241                collector,
2242            );
2243        }
2244        if let Some(ref val) = self.dept {
2245            helpers::validate_pattern(
2246                val,
2247                "Dept",
2248                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2249                &helpers::child_path(path, "Dept"),
2250                config,
2251                collector,
2252            );
2253        }
2254        if let Some(ref val) = self.sub_dept {
2255            helpers::validate_length(
2256                val,
2257                "SubDept",
2258                Some(1),
2259                Some(70),
2260                &helpers::child_path(path, "SubDept"),
2261                config,
2262                collector,
2263            );
2264        }
2265        if let Some(ref val) = self.sub_dept {
2266            helpers::validate_pattern(
2267                val,
2268                "SubDept",
2269                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2270                &helpers::child_path(path, "SubDept"),
2271                config,
2272                collector,
2273            );
2274        }
2275        if let Some(ref val) = self.strt_nm {
2276            helpers::validate_length(
2277                val,
2278                "StrtNm",
2279                Some(1),
2280                Some(70),
2281                &helpers::child_path(path, "StrtNm"),
2282                config,
2283                collector,
2284            );
2285        }
2286        if let Some(ref val) = self.strt_nm {
2287            helpers::validate_pattern(
2288                val,
2289                "StrtNm",
2290                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2291                &helpers::child_path(path, "StrtNm"),
2292                config,
2293                collector,
2294            );
2295        }
2296        if let Some(ref val) = self.bldg_nb {
2297            helpers::validate_length(
2298                val,
2299                "BldgNb",
2300                Some(1),
2301                Some(16),
2302                &helpers::child_path(path, "BldgNb"),
2303                config,
2304                collector,
2305            );
2306        }
2307        if let Some(ref val) = self.bldg_nb {
2308            helpers::validate_pattern(
2309                val,
2310                "BldgNb",
2311                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2312                &helpers::child_path(path, "BldgNb"),
2313                config,
2314                collector,
2315            );
2316        }
2317        if let Some(ref val) = self.bldg_nm {
2318            helpers::validate_length(
2319                val,
2320                "BldgNm",
2321                Some(1),
2322                Some(35),
2323                &helpers::child_path(path, "BldgNm"),
2324                config,
2325                collector,
2326            );
2327        }
2328        if let Some(ref val) = self.bldg_nm {
2329            helpers::validate_pattern(
2330                val,
2331                "BldgNm",
2332                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2333                &helpers::child_path(path, "BldgNm"),
2334                config,
2335                collector,
2336            );
2337        }
2338        if let Some(ref val) = self.flr {
2339            helpers::validate_length(
2340                val,
2341                "Flr",
2342                Some(1),
2343                Some(70),
2344                &helpers::child_path(path, "Flr"),
2345                config,
2346                collector,
2347            );
2348        }
2349        if let Some(ref val) = self.flr {
2350            helpers::validate_pattern(
2351                val,
2352                "Flr",
2353                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2354                &helpers::child_path(path, "Flr"),
2355                config,
2356                collector,
2357            );
2358        }
2359        if let Some(ref val) = self.pst_bx {
2360            helpers::validate_length(
2361                val,
2362                "PstBx",
2363                Some(1),
2364                Some(16),
2365                &helpers::child_path(path, "PstBx"),
2366                config,
2367                collector,
2368            );
2369        }
2370        if let Some(ref val) = self.pst_bx {
2371            helpers::validate_pattern(
2372                val,
2373                "PstBx",
2374                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2375                &helpers::child_path(path, "PstBx"),
2376                config,
2377                collector,
2378            );
2379        }
2380        if let Some(ref val) = self.room {
2381            helpers::validate_length(
2382                val,
2383                "Room",
2384                Some(1),
2385                Some(70),
2386                &helpers::child_path(path, "Room"),
2387                config,
2388                collector,
2389            );
2390        }
2391        if let Some(ref val) = self.room {
2392            helpers::validate_pattern(
2393                val,
2394                "Room",
2395                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2396                &helpers::child_path(path, "Room"),
2397                config,
2398                collector,
2399            );
2400        }
2401        if let Some(ref val) = self.pst_cd {
2402            helpers::validate_length(
2403                val,
2404                "PstCd",
2405                Some(1),
2406                Some(16),
2407                &helpers::child_path(path, "PstCd"),
2408                config,
2409                collector,
2410            );
2411        }
2412        if let Some(ref val) = self.pst_cd {
2413            helpers::validate_pattern(
2414                val,
2415                "PstCd",
2416                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2417                &helpers::child_path(path, "PstCd"),
2418                config,
2419                collector,
2420            );
2421        }
2422        if let Some(ref val) = self.twn_nm {
2423            helpers::validate_length(
2424                val,
2425                "TwnNm",
2426                Some(1),
2427                Some(35),
2428                &helpers::child_path(path, "TwnNm"),
2429                config,
2430                collector,
2431            );
2432        }
2433        if let Some(ref val) = self.twn_nm {
2434            helpers::validate_pattern(
2435                val,
2436                "TwnNm",
2437                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2438                &helpers::child_path(path, "TwnNm"),
2439                config,
2440                collector,
2441            );
2442        }
2443        if let Some(ref val) = self.twn_lctn_nm {
2444            helpers::validate_length(
2445                val,
2446                "TwnLctnNm",
2447                Some(1),
2448                Some(35),
2449                &helpers::child_path(path, "TwnLctnNm"),
2450                config,
2451                collector,
2452            );
2453        }
2454        if let Some(ref val) = self.twn_lctn_nm {
2455            helpers::validate_pattern(
2456                val,
2457                "TwnLctnNm",
2458                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2459                &helpers::child_path(path, "TwnLctnNm"),
2460                config,
2461                collector,
2462            );
2463        }
2464        if let Some(ref val) = self.dstrct_nm {
2465            helpers::validate_length(
2466                val,
2467                "DstrctNm",
2468                Some(1),
2469                Some(35),
2470                &helpers::child_path(path, "DstrctNm"),
2471                config,
2472                collector,
2473            );
2474        }
2475        if let Some(ref val) = self.dstrct_nm {
2476            helpers::validate_pattern(
2477                val,
2478                "DstrctNm",
2479                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2480                &helpers::child_path(path, "DstrctNm"),
2481                config,
2482                collector,
2483            );
2484        }
2485        if let Some(ref val) = self.ctry_sub_dvsn {
2486            helpers::validate_length(
2487                val,
2488                "CtrySubDvsn",
2489                Some(1),
2490                Some(35),
2491                &helpers::child_path(path, "CtrySubDvsn"),
2492                config,
2493                collector,
2494            );
2495        }
2496        if let Some(ref val) = self.ctry_sub_dvsn {
2497            helpers::validate_pattern(
2498                val,
2499                "CtrySubDvsn",
2500                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2501                &helpers::child_path(path, "CtrySubDvsn"),
2502                config,
2503                collector,
2504            );
2505        }
2506        if let Some(ref val) = self.ctry {
2507            helpers::validate_pattern(
2508                val,
2509                "Ctry",
2510                "[A-Z]{2,2}",
2511                &helpers::child_path(path, "Ctry"),
2512                config,
2513                collector,
2514            );
2515        }
2516        if let Some(ref vec) = self.adr_line {
2517            for item in vec {
2518                helpers::validate_length(
2519                    item,
2520                    "AdrLine",
2521                    Some(1),
2522                    Some(70),
2523                    &helpers::child_path(path, "AdrLine"),
2524                    config,
2525                    collector,
2526                );
2527            }
2528        }
2529        if let Some(ref vec) = self.adr_line {
2530            for item in vec {
2531                helpers::validate_pattern(
2532                    item,
2533                    "AdrLine",
2534                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2535                    &helpers::child_path(path, "AdrLine"),
2536                    config,
2537                    collector,
2538                );
2539            }
2540        }
2541    }
2542}
2543
2544// Priority2Code: Priority level is normal.
2545#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2546pub enum Priority2Code {
2547    #[default]
2548    #[serde(rename = "HIGH")]
2549    CodeHIGH,
2550    #[serde(rename = "NORM")]
2551    CodeNORM,
2552}
2553
2554impl Validate for Priority2Code {
2555    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2556        // Enum validation is typically empty
2557    }
2558}
2559
2560// Priority3Code: Priority level is normal.
2561#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2562pub enum Priority3Code {
2563    #[default]
2564    #[serde(rename = "URGT")]
2565    CodeURGT,
2566    #[serde(rename = "HIGH")]
2567    CodeHIGH,
2568    #[serde(rename = "NORM")]
2569    CodeNORM,
2570}
2571
2572impl Validate for Priority3Code {
2573    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2574        // Enum validation is typically empty
2575    }
2576}
2577
2578// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
2579#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2580pub struct ProxyAccountIdentification11 {
2581    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2582    pub tp: Option<ProxyAccountType1Choice1>,
2583    #[serde(rename = "Id")]
2584    pub id: String,
2585}
2586
2587impl Validate for ProxyAccountIdentification11 {
2588    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2589        if let Some(ref val) = self.tp
2590            && config.validate_optional_fields
2591        {
2592            val.validate(&helpers::child_path(path, "Tp"), config, collector);
2593        }
2594        helpers::validate_length(
2595            &self.id,
2596            "Id",
2597            Some(1),
2598            Some(320),
2599            &helpers::child_path(path, "Id"),
2600            config,
2601            collector,
2602        );
2603        helpers::validate_pattern(
2604            &self.id,
2605            "Id",
2606            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2607            &helpers::child_path(path, "Id"),
2608            config,
2609            collector,
2610        );
2611    }
2612}
2613
2614// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
2615#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2616pub struct ProxyAccountType1Choice1 {
2617    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2618    pub cd: Option<String>,
2619    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2620    pub prtry: Option<String>,
2621}
2622
2623impl Validate for ProxyAccountType1Choice1 {
2624    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2625        if let Some(ref val) = self.cd {
2626            helpers::validate_length(
2627                val,
2628                "Cd",
2629                Some(1),
2630                Some(4),
2631                &helpers::child_path(path, "Cd"),
2632                config,
2633                collector,
2634            );
2635        }
2636        if let Some(ref val) = self.prtry {
2637            helpers::validate_length(
2638                val,
2639                "Prtry",
2640                Some(1),
2641                Some(35),
2642                &helpers::child_path(path, "Prtry"),
2643                config,
2644                collector,
2645            );
2646        }
2647        if let Some(ref val) = self.prtry {
2648            helpers::validate_pattern(
2649                val,
2650                "Prtry",
2651                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2652                &helpers::child_path(path, "Prtry"),
2653                config,
2654                collector,
2655            );
2656        }
2657    }
2658}
2659
2660// Purpose2Choice1: Underlying reason for the payment transaction, as published in an external purpose code list.
2661#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2662pub struct Purpose2Choice1 {
2663    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2664    pub cd: Option<String>,
2665}
2666
2667impl Validate for Purpose2Choice1 {
2668    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2669        if let Some(ref val) = self.cd {
2670            helpers::validate_length(
2671                val,
2672                "Cd",
2673                Some(1),
2674                Some(4),
2675                &helpers::child_path(path, "Cd"),
2676                config,
2677                collector,
2678            );
2679        }
2680    }
2681}
2682
2683// RegulatoryAuthority21: Country of the entity that requires the regulatory reporting information.
2684#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2685pub struct RegulatoryAuthority21 {
2686    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2687    pub nm: Option<String>,
2688    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
2689    pub ctry: Option<String>,
2690}
2691
2692impl Validate for RegulatoryAuthority21 {
2693    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2694        if let Some(ref val) = self.nm {
2695            helpers::validate_length(
2696                val,
2697                "Nm",
2698                Some(1),
2699                Some(140),
2700                &helpers::child_path(path, "Nm"),
2701                config,
2702                collector,
2703            );
2704        }
2705        if let Some(ref val) = self.nm {
2706            helpers::validate_pattern(
2707                val,
2708                "Nm",
2709                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
2710                &helpers::child_path(path, "Nm"),
2711                config,
2712                collector,
2713            );
2714        }
2715        if let Some(ref val) = self.ctry {
2716            helpers::validate_pattern(
2717                val,
2718                "Ctry",
2719                "[A-Z]{2,2}",
2720                &helpers::child_path(path, "Ctry"),
2721                config,
2722                collector,
2723            );
2724        }
2725    }
2726}
2727
2728// RegulatoryReporting31: Set of elements used to provide details on the regulatory reporting information.
2729#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2730pub struct RegulatoryReporting31 {
2731    #[serde(rename = "DbtCdtRptgInd", skip_serializing_if = "Option::is_none")]
2732    pub dbt_cdt_rptg_ind: Option<RegulatoryReportingType1Code>,
2733    #[serde(rename = "Authrty", skip_serializing_if = "Option::is_none")]
2734    pub authrty: Option<RegulatoryAuthority21>,
2735    #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
2736    pub dtls: Option<Vec<StructuredRegulatoryReporting31>>,
2737}
2738
2739impl Validate for RegulatoryReporting31 {
2740    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2741        if let Some(ref val) = self.dbt_cdt_rptg_ind
2742            && config.validate_optional_fields
2743        {
2744            val.validate(
2745                &helpers::child_path(path, "DbtCdtRptgInd"),
2746                config,
2747                collector,
2748            );
2749        }
2750        if let Some(ref val) = self.authrty
2751            && config.validate_optional_fields
2752        {
2753            val.validate(&helpers::child_path(path, "Authrty"), config, collector);
2754        }
2755        if let Some(ref vec) = self.dtls
2756            && config.validate_optional_fields
2757        {
2758            for item in vec {
2759                item.validate(&helpers::child_path(path, "Dtls"), config, collector);
2760            }
2761        }
2762    }
2763}
2764
2765// RegulatoryReportingType1Code: Regulatory information applies to both credit and debit sides.
2766#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2767pub enum RegulatoryReportingType1Code {
2768    #[default]
2769    #[serde(rename = "CRED")]
2770    CodeCRED,
2771    #[serde(rename = "DEBT")]
2772    CodeDEBT,
2773    #[serde(rename = "BOTH")]
2774    CodeBOTH,
2775}
2776
2777impl Validate for RegulatoryReportingType1Code {
2778    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2779        // Enum validation is typically empty
2780    }
2781}
2782
2783// 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 an unstructured form.
2784#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2785pub struct RemittanceInformation161 {
2786    #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
2787    pub ustrd: Option<String>,
2788}
2789
2790impl Validate for RemittanceInformation161 {
2791    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2792        if let Some(ref val) = self.ustrd {
2793            helpers::validate_length(
2794                val,
2795                "Ustrd",
2796                Some(1),
2797                Some(140),
2798                &helpers::child_path(path, "Ustrd"),
2799                config,
2800                collector,
2801            );
2802        }
2803        if let Some(ref val) = self.ustrd {
2804            helpers::validate_pattern(
2805                val,
2806                "Ustrd",
2807                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2808                &helpers::child_path(path, "Ustrd"),
2809                config,
2810                collector,
2811            );
2812        }
2813    }
2814}
2815
2816// RemittanceLocation71: Set of elements used to provide information on the location and/or delivery of the remittance information.
2817#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2818pub struct RemittanceLocation71 {
2819    #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
2820    pub rmt_id: Option<String>,
2821    #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
2822    pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
2823}
2824
2825impl Validate for RemittanceLocation71 {
2826    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2827        if let Some(ref val) = self.rmt_id {
2828            helpers::validate_length(
2829                val,
2830                "RmtId",
2831                Some(1),
2832                Some(35),
2833                &helpers::child_path(path, "RmtId"),
2834                config,
2835                collector,
2836            );
2837        }
2838        if let Some(ref val) = self.rmt_id {
2839            helpers::validate_pattern(
2840                val,
2841                "RmtId",
2842                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2843                &helpers::child_path(path, "RmtId"),
2844                config,
2845                collector,
2846            );
2847        }
2848        if let Some(ref vec) = self.rmt_lctn_dtls
2849            && config.validate_optional_fields
2850        {
2851            for item in vec {
2852                item.validate(&helpers::child_path(path, "RmtLctnDtls"), config, collector);
2853            }
2854        }
2855    }
2856}
2857
2858// RemittanceLocationData11: Postal address to which an agent is to send the remittance information.
2859#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2860pub struct RemittanceLocationData11 {
2861    #[serde(rename = "Mtd")]
2862    pub mtd: RemittanceLocationMethod2Code,
2863    #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
2864    pub elctrnc_adr: Option<String>,
2865    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2866    pub pstl_adr: Option<NameAndAddress161>,
2867}
2868
2869impl Validate for RemittanceLocationData11 {
2870    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2871        self.mtd
2872            .validate(&helpers::child_path(path, "Mtd"), config, collector);
2873        if let Some(ref val) = self.elctrnc_adr {
2874            helpers::validate_length(
2875                val,
2876                "ElctrncAdr",
2877                Some(1),
2878                Some(2048),
2879                &helpers::child_path(path, "ElctrncAdr"),
2880                config,
2881                collector,
2882            );
2883        }
2884        if let Some(ref val) = self.elctrnc_adr {
2885            helpers::validate_pattern(
2886                val,
2887                "ElctrncAdr",
2888                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2889                &helpers::child_path(path, "ElctrncAdr"),
2890                config,
2891                collector,
2892            );
2893        }
2894        if let Some(ref val) = self.pstl_adr
2895            && config.validate_optional_fields
2896        {
2897            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
2898        }
2899    }
2900}
2901
2902// RemittanceLocationMethod2Code: Remittance advice information must be sent through by phone as a short message service (SMS).
2903#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2904pub enum RemittanceLocationMethod2Code {
2905    #[default]
2906    #[serde(rename = "FAXI")]
2907    CodeFAXI,
2908    #[serde(rename = "EDIC")]
2909    CodeEDIC,
2910    #[serde(rename = "URID")]
2911    CodeURID,
2912    #[serde(rename = "EMAL")]
2913    CodeEMAL,
2914    #[serde(rename = "POST")]
2915    CodePOST,
2916    #[serde(rename = "SMSM")]
2917    CodeSMSM,
2918}
2919
2920impl Validate for RemittanceLocationMethod2Code {
2921    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
2922        // Enum validation is typically empty
2923    }
2924}
2925
2926// ServiceLevel8Choice1: Specifies a pre-agreed service or level of service between the parties, as published in an external service level code list.
2927#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2928pub struct ServiceLevel8Choice1 {
2929    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2930    pub cd: Option<String>,
2931}
2932
2933impl Validate for ServiceLevel8Choice1 {
2934    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2935        if let Some(ref val) = self.cd {
2936            helpers::validate_length(
2937                val,
2938                "Cd",
2939                Some(1),
2940                Some(4),
2941                &helpers::child_path(path, "Cd"),
2942                config,
2943                collector,
2944            );
2945        }
2946    }
2947}
2948
2949// SettlementDateTimeIndication11: Date and time at which a payment has been credited at the transaction administrator. In the case of TARGET, the date and time at which the payment has been credited at the receiving central bank, expressed in Central European Time (CET).
2950#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2951pub struct SettlementDateTimeIndication11 {
2952    #[serde(rename = "DbtDtTm", skip_serializing_if = "Option::is_none")]
2953    pub dbt_dt_tm: Option<String>,
2954    #[serde(rename = "CdtDtTm", skip_serializing_if = "Option::is_none")]
2955    pub cdt_dt_tm: Option<String>,
2956}
2957
2958impl Validate for SettlementDateTimeIndication11 {
2959    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
2960        if let Some(ref val) = self.dbt_dt_tm {
2961            helpers::validate_pattern(
2962                val,
2963                "DbtDtTm",
2964                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
2965                &helpers::child_path(path, "DbtDtTm"),
2966                config,
2967                collector,
2968            );
2969        }
2970        if let Some(ref val) = self.cdt_dt_tm {
2971            helpers::validate_pattern(
2972                val,
2973                "CdtDtTm",
2974                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
2975                &helpers::child_path(path, "CdtDtTm"),
2976                config,
2977                collector,
2978            );
2979        }
2980    }
2981}
2982
2983// SettlementInstruction71: Unambiguous identification of the account of the third reimbursement agent account at its servicing agent in the payment chain.
2984#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2985pub struct SettlementInstruction71 {
2986    #[serde(rename = "SttlmMtd")]
2987    pub sttlm_mtd: SettlementMethod1Code1,
2988    #[serde(rename = "SttlmAcct", skip_serializing_if = "Option::is_none")]
2989    pub sttlm_acct: Option<CashAccount381>,
2990    #[serde(rename = "InstgRmbrsmntAgt", skip_serializing_if = "Option::is_none")]
2991    pub instg_rmbrsmnt_agt: Option<BranchAndFinancialInstitutionIdentification61>,
2992    #[serde(
2993        rename = "InstgRmbrsmntAgtAcct",
2994        skip_serializing_if = "Option::is_none"
2995    )]
2996    pub instg_rmbrsmnt_agt_acct: Option<CashAccount381>,
2997    #[serde(rename = "InstdRmbrsmntAgt", skip_serializing_if = "Option::is_none")]
2998    pub instd_rmbrsmnt_agt: Option<BranchAndFinancialInstitutionIdentification61>,
2999    #[serde(
3000        rename = "InstdRmbrsmntAgtAcct",
3001        skip_serializing_if = "Option::is_none"
3002    )]
3003    pub instd_rmbrsmnt_agt_acct: Option<CashAccount381>,
3004    #[serde(rename = "ThrdRmbrsmntAgt", skip_serializing_if = "Option::is_none")]
3005    pub thrd_rmbrsmnt_agt: Option<BranchAndFinancialInstitutionIdentification61>,
3006    #[serde(
3007        rename = "ThrdRmbrsmntAgtAcct",
3008        skip_serializing_if = "Option::is_none"
3009    )]
3010    pub thrd_rmbrsmnt_agt_acct: Option<CashAccount381>,
3011}
3012
3013impl Validate for SettlementInstruction71 {
3014    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3015        self.sttlm_mtd
3016            .validate(&helpers::child_path(path, "SttlmMtd"), config, collector);
3017        if let Some(ref val) = self.sttlm_acct
3018            && config.validate_optional_fields
3019        {
3020            val.validate(&helpers::child_path(path, "SttlmAcct"), config, collector);
3021        }
3022        if let Some(ref val) = self.instg_rmbrsmnt_agt
3023            && config.validate_optional_fields
3024        {
3025            val.validate(
3026                &helpers::child_path(path, "InstgRmbrsmntAgt"),
3027                config,
3028                collector,
3029            );
3030        }
3031        if let Some(ref val) = self.instg_rmbrsmnt_agt_acct
3032            && config.validate_optional_fields
3033        {
3034            val.validate(
3035                &helpers::child_path(path, "InstgRmbrsmntAgtAcct"),
3036                config,
3037                collector,
3038            );
3039        }
3040        if let Some(ref val) = self.instd_rmbrsmnt_agt
3041            && config.validate_optional_fields
3042        {
3043            val.validate(
3044                &helpers::child_path(path, "InstdRmbrsmntAgt"),
3045                config,
3046                collector,
3047            );
3048        }
3049        if let Some(ref val) = self.instd_rmbrsmnt_agt_acct
3050            && config.validate_optional_fields
3051        {
3052            val.validate(
3053                &helpers::child_path(path, "InstdRmbrsmntAgtAcct"),
3054                config,
3055                collector,
3056            );
3057        }
3058        if let Some(ref val) = self.thrd_rmbrsmnt_agt
3059            && config.validate_optional_fields
3060        {
3061            val.validate(
3062                &helpers::child_path(path, "ThrdRmbrsmntAgt"),
3063                config,
3064                collector,
3065            );
3066        }
3067        if let Some(ref val) = self.thrd_rmbrsmnt_agt_acct
3068            && config.validate_optional_fields
3069        {
3070            val.validate(
3071                &helpers::child_path(path, "ThrdRmbrsmntAgtAcct"),
3072                config,
3073                collector,
3074            );
3075        }
3076    }
3077}
3078
3079// SettlementMethod1Code__1: Settlement is done through a cover payment.
3080#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3081pub enum SettlementMethod1Code1 {
3082    #[default]
3083    #[serde(rename = "INDA")]
3084    CodeINDA,
3085    #[serde(rename = "INGA")]
3086    CodeINGA,
3087    #[serde(rename = "COVE")]
3088    CodeCOVE,
3089}
3090
3091impl Validate for SettlementMethod1Code1 {
3092    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
3093        // Enum validation is typically empty
3094    }
3095}
3096
3097// SettlementTimeRequest21: Time by when the payment must be settled to avoid rejection.
3098#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3099pub struct SettlementTimeRequest21 {
3100    #[serde(rename = "CLSTm", skip_serializing_if = "Option::is_none")]
3101    pub cls_tm: Option<String>,
3102    #[serde(rename = "TillTm", skip_serializing_if = "Option::is_none")]
3103    pub till_tm: Option<String>,
3104    #[serde(rename = "FrTm", skip_serializing_if = "Option::is_none")]
3105    pub fr_tm: Option<String>,
3106    #[serde(rename = "RjctTm", skip_serializing_if = "Option::is_none")]
3107    pub rjct_tm: Option<String>,
3108}
3109
3110impl Validate for SettlementTimeRequest21 {
3111    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3112        if let Some(ref val) = self.cls_tm {
3113            helpers::validate_pattern(
3114                val,
3115                "CLSTm",
3116                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3117                &helpers::child_path(path, "CLSTm"),
3118                config,
3119                collector,
3120            );
3121        }
3122        if let Some(ref val) = self.till_tm {
3123            helpers::validate_pattern(
3124                val,
3125                "TillTm",
3126                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3127                &helpers::child_path(path, "TillTm"),
3128                config,
3129                collector,
3130            );
3131        }
3132        if let Some(ref val) = self.fr_tm {
3133            helpers::validate_pattern(
3134                val,
3135                "FrTm",
3136                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3137                &helpers::child_path(path, "FrTm"),
3138                config,
3139                collector,
3140            );
3141        }
3142        if let Some(ref val) = self.rjct_tm {
3143            helpers::validate_pattern(
3144                val,
3145                "RjctTm",
3146                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
3147                &helpers::child_path(path, "RjctTm"),
3148                config,
3149                collector,
3150            );
3151        }
3152    }
3153}
3154
3155// StructuredRegulatoryReporting31: Additional details that cater for specific domestic regulatory requirements.
3156#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3157pub struct StructuredRegulatoryReporting31 {
3158    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3159    pub tp: Option<String>,
3160    #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3161    pub dt: Option<String>,
3162    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
3163    pub ctry: Option<String>,
3164    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3165    pub cd: Option<String>,
3166    #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
3167    pub amt: Option<CBPRAmount1>,
3168    #[serde(rename = "Inf", skip_serializing_if = "Option::is_none")]
3169    pub inf: Option<Vec<String>>,
3170}
3171
3172impl Validate for StructuredRegulatoryReporting31 {
3173    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
3174        if let Some(ref val) = self.tp {
3175            helpers::validate_length(
3176                val,
3177                "Tp",
3178                Some(1),
3179                Some(35),
3180                &helpers::child_path(path, "Tp"),
3181                config,
3182                collector,
3183            );
3184        }
3185        if let Some(ref val) = self.tp {
3186            helpers::validate_pattern(
3187                val,
3188                "Tp",
3189                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3190                &helpers::child_path(path, "Tp"),
3191                config,
3192                collector,
3193            );
3194        }
3195        if let Some(ref val) = self.ctry {
3196            helpers::validate_pattern(
3197                val,
3198                "Ctry",
3199                "[A-Z]{2,2}",
3200                &helpers::child_path(path, "Ctry"),
3201                config,
3202                collector,
3203            );
3204        }
3205        if let Some(ref val) = self.cd {
3206            helpers::validate_length(
3207                val,
3208                "Cd",
3209                Some(1),
3210                Some(10),
3211                &helpers::child_path(path, "Cd"),
3212                config,
3213                collector,
3214            );
3215        }
3216        if let Some(ref val) = self.cd {
3217            helpers::validate_pattern(
3218                val,
3219                "Cd",
3220                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3221                &helpers::child_path(path, "Cd"),
3222                config,
3223                collector,
3224            );
3225        }
3226        if let Some(ref val) = self.amt
3227            && config.validate_optional_fields
3228        {
3229            val.validate(&helpers::child_path(path, "Amt"), config, collector);
3230        }
3231        if let Some(ref vec) = self.inf {
3232            for item in vec {
3233                helpers::validate_length(
3234                    item,
3235                    "Inf",
3236                    Some(1),
3237                    Some(35),
3238                    &helpers::child_path(path, "Inf"),
3239                    config,
3240                    collector,
3241                );
3242            }
3243        }
3244        if let Some(ref vec) = self.inf {
3245            for item in vec {
3246                helpers::validate_pattern(
3247                    item,
3248                    "Inf",
3249                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
3250                    &helpers::child_path(path, "Inf"),
3251                    config,
3252                    collector,
3253                );
3254            }
3255        }
3256    }
3257}