1use crate::error::*;
21use regex::Regex;
22use serde::{Deserialize, Serialize};
23
24#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
26pub struct AccountIdentification4Choice1 {
27 #[serde(rename = "IBAN", skip_serializing_if = "Option::is_none")]
28 pub iban: Option<String>,
29 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
30 pub othr: Option<GenericAccountIdentification11>,
31}
32
33impl AccountIdentification4Choice1 {
34 pub fn validate(&self) -> Result<(), ValidationError> {
35 if let Some(ref val) = self.iban {
36 let pattern = Regex::new("[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}").unwrap();
37 if !pattern.is_match(val) {
38 return Err(ValidationError::new(
39 1005,
40 "iban does not match the required pattern".to_string(),
41 ));
42 }
43 }
44 if let Some(ref val) = self.othr {
45 val.validate()?
46 }
47 Ok(())
48 }
49}
50
51#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
53pub struct AccountInterest41 {
54 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
55 pub tp: Option<InterestType1Choice1>,
56 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
57 pub rate: Option<Vec<Rate41>>,
58 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
59 pub fr_to_dt: Option<DateTimePeriod11>,
60 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
61 pub rsn: Option<String>,
62 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
63 pub tax: Option<TaxCharges21>,
64}
65
66impl AccountInterest41 {
67 pub fn validate(&self) -> Result<(), ValidationError> {
68 if let Some(ref val) = self.tp {
69 val.validate()?
70 }
71 if let Some(ref vec) = self.rate {
72 for item in vec {
73 item.validate()?
74 }
75 }
76 if let Some(ref val) = self.fr_to_dt {
77 val.validate()?
78 }
79 if let Some(ref val) = self.rsn {
80 if val.chars().count() < 1 {
81 return Err(ValidationError::new(
82 1001,
83 "rsn is shorter than the minimum length of 1".to_string(),
84 ));
85 }
86 if val.chars().count() > 35 {
87 return Err(ValidationError::new(
88 1002,
89 "rsn exceeds the maximum length of 35".to_string(),
90 ));
91 }
92 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
93 if !pattern.is_match(val) {
94 return Err(ValidationError::new(
95 1005,
96 "rsn does not match the required pattern".to_string(),
97 ));
98 }
99 }
100 if let Some(ref val) = self.tax {
101 val.validate()?
102 }
103 Ok(())
104 }
105}
106
107#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
109pub struct AccountNotification171 {
110 #[serde(rename = "Id")]
111 pub id: String,
112 #[serde(rename = "NtfctnPgntn", skip_serializing_if = "Option::is_none")]
113 pub ntfctn_pgntn: Option<Pagination1>,
114 #[serde(rename = "ElctrncSeqNb", skip_serializing_if = "Option::is_none")]
115 pub elctrnc_seq_nb: Option<f64>,
116 #[serde(rename = "RptgSeq", skip_serializing_if = "Option::is_none")]
117 pub rptg_seq: Option<SequenceRange1Choice1>,
118 #[serde(rename = "LglSeqNb", skip_serializing_if = "Option::is_none")]
119 pub lgl_seq_nb: Option<f64>,
120 #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
121 pub cre_dt_tm: Option<String>,
122 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
123 pub fr_to_dt: Option<DateTimePeriod11>,
124 #[serde(rename = "CpyDplctInd", skip_serializing_if = "Option::is_none")]
125 pub cpy_dplct_ind: Option<CopyDuplicate1Code>,
126 #[serde(rename = "RptgSrc", skip_serializing_if = "Option::is_none")]
127 pub rptg_src: Option<ReportingSource1Choice1>,
128 #[serde(rename = "Acct")]
129 pub acct: CashAccount391,
130 #[serde(rename = "RltdAcct", skip_serializing_if = "Option::is_none")]
131 pub rltd_acct: Option<CashAccount381>,
132 #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
133 pub intrst: Option<Vec<AccountInterest41>>,
134 #[serde(rename = "TxsSummry", skip_serializing_if = "Option::is_none")]
135 pub txs_summry: Option<TotalTransactions61>,
136 #[serde(rename = "Ntry")]
137 pub ntry: Vec<ReportEntry101>,
138 #[serde(rename = "AddtlNtfctnInf", skip_serializing_if = "Option::is_none")]
139 pub addtl_ntfctn_inf: Option<String>,
140}
141
142impl AccountNotification171 {
143 pub fn validate(&self) -> Result<(), ValidationError> {
144 if self.id.chars().count() < 1 {
145 return Err(ValidationError::new(
146 1001,
147 "id is shorter than the minimum length of 1".to_string(),
148 ));
149 }
150 if self.id.chars().count() > 35 {
151 return Err(ValidationError::new(
152 1002,
153 "id exceeds the maximum length of 35".to_string(),
154 ));
155 }
156 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
157 if !pattern.is_match(&self.id) {
158 return Err(ValidationError::new(
159 1005,
160 "id does not match the required pattern".to_string(),
161 ));
162 }
163 if let Some(ref val) = self.ntfctn_pgntn {
164 val.validate()?
165 }
166 if let Some(ref val) = self.rptg_seq {
167 val.validate()?
168 }
169 if let Some(ref val) = self.cre_dt_tm {
170 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
171 if !pattern.is_match(val) {
172 return Err(ValidationError::new(
173 1005,
174 "cre_dt_tm does not match the required pattern".to_string(),
175 ));
176 }
177 }
178 if let Some(ref val) = self.fr_to_dt {
179 val.validate()?
180 }
181 if let Some(ref val) = self.cpy_dplct_ind {
182 val.validate()?
183 }
184 if let Some(ref val) = self.rptg_src {
185 val.validate()?
186 }
187 self.acct.validate()?;
188 if let Some(ref val) = self.rltd_acct {
189 val.validate()?
190 }
191 if let Some(ref vec) = self.intrst {
192 for item in vec {
193 item.validate()?
194 }
195 }
196 if let Some(ref val) = self.txs_summry {
197 val.validate()?
198 }
199 for item in &self.ntry {
200 item.validate()?
201 }
202 if let Some(ref val) = self.addtl_ntfctn_inf {
203 if val.chars().count() < 1 {
204 return Err(ValidationError::new(
205 1001,
206 "addtl_ntfctn_inf is shorter than the minimum length of 1".to_string(),
207 ));
208 }
209 if val.chars().count() > 500 {
210 return Err(ValidationError::new(
211 1002,
212 "addtl_ntfctn_inf exceeds the maximum length of 500".to_string(),
213 ));
214 }
215 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
216 if !pattern.is_match(val) {
217 return Err(ValidationError::new(
218 1005,
219 "addtl_ntfctn_inf does not match the required pattern".to_string(),
220 ));
221 }
222 }
223 Ok(())
224 }
225}
226
227#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
229pub struct AccountSchemeName1Choice1 {
230 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
231 pub cd: Option<String>,
232 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
233 pub prtry: Option<String>,
234}
235
236impl AccountSchemeName1Choice1 {
237 pub fn validate(&self) -> Result<(), ValidationError> {
238 if let Some(ref val) = self.cd {
239 if val.chars().count() < 1 {
240 return Err(ValidationError::new(
241 1001,
242 "cd is shorter than the minimum length of 1".to_string(),
243 ));
244 }
245 if val.chars().count() > 4 {
246 return Err(ValidationError::new(
247 1002,
248 "cd exceeds the maximum length of 4".to_string(),
249 ));
250 }
251 }
252 if let Some(ref val) = self.prtry {
253 if val.chars().count() < 1 {
254 return Err(ValidationError::new(
255 1001,
256 "prtry is shorter than the minimum length of 1".to_string(),
257 ));
258 }
259 if val.chars().count() > 35 {
260 return Err(ValidationError::new(
261 1002,
262 "prtry exceeds the maximum length of 35".to_string(),
263 ));
264 }
265 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
266 if !pattern.is_match(val) {
267 return Err(ValidationError::new(
268 1005,
269 "prtry does not match the required pattern".to_string(),
270 ));
271 }
272 }
273 Ok(())
274 }
275}
276
277#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
279pub struct ActiveCurrencyAndAmount {
280 #[serde(rename = "@Ccy")]
281 pub ccy: String,
282 #[serde(rename = "$value")]
283 pub value: f64,
284}
285
286impl ActiveCurrencyAndAmount {
287 pub fn validate(&self) -> Result<(), ValidationError> {
288 Ok(())
289 }
290}
291
292#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
295pub struct ActiveOrHistoricCurrencyAnd13DecimalAmount {
296 #[serde(rename = "@Ccy")]
297 pub ccy: String,
298 #[serde(rename = "$value")]
299 pub value: f64,
300}
301
302impl ActiveOrHistoricCurrencyAnd13DecimalAmount {
303 pub fn validate(&self) -> Result<(), ValidationError> {
304 Ok(())
305 }
306}
307
308#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
310pub struct ActiveOrHistoricCurrencyAndAmount {
311 #[serde(rename = "@Ccy")]
312 pub ccy: String,
313 #[serde(rename = "$value")]
314 pub value: f64,
315}
316
317impl ActiveOrHistoricCurrencyAndAmount {
318 pub fn validate(&self) -> Result<(), ValidationError> {
319 Ok(())
320 }
321}
322
323#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
325pub struct ActiveOrHistoricCurrencyAndAmountRange2 {
326 #[serde(rename = "Amt")]
327 pub amt: ImpliedCurrencyAmountRange1Choice,
328 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
329 pub cdt_dbt_ind: Option<CreditDebitCode>,
330 #[serde(rename = "Ccy")]
331 pub ccy: String,
332}
333
334impl ActiveOrHistoricCurrencyAndAmountRange2 {
335 pub fn validate(&self) -> Result<(), ValidationError> {
336 self.amt.validate()?;
337 if let Some(ref val) = self.cdt_dbt_ind {
338 val.validate()?
339 }
340 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
341 if !pattern.is_match(&self.ccy) {
342 return Err(ValidationError::new(
343 1005,
344 "ccy does not match the required pattern".to_string(),
345 ));
346 }
347 Ok(())
348 }
349}
350
351#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
353pub enum AddressType2Code {
354 #[default]
355 #[serde(rename = "ADDR")]
356 CodeADDR,
357 #[serde(rename = "PBOX")]
358 CodePBOX,
359 #[serde(rename = "HOME")]
360 CodeHOME,
361 #[serde(rename = "BIZZ")]
362 CodeBIZZ,
363 #[serde(rename = "MLTO")]
364 CodeMLTO,
365 #[serde(rename = "DLVY")]
366 CodeDLVY,
367}
368
369impl AddressType2Code {
370 pub fn validate(&self) -> Result<(), ValidationError> {
371 Ok(())
372 }
373}
374
375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
377pub struct AddressType3Choice {
378 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
379 pub cd: Option<AddressType2Code>,
380 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
381 pub prtry: Option<GenericIdentification30>,
382}
383
384impl AddressType3Choice {
385 pub fn validate(&self) -> Result<(), ValidationError> {
386 if let Some(ref val) = self.cd {
387 val.validate()?
388 }
389 if let Some(ref val) = self.prtry {
390 val.validate()?
391 }
392 Ok(())
393 }
394}
395
396#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
398pub struct AddressType3Choice1 {
399 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
400 pub cd: Option<AddressType2Code>,
401 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
402 pub prtry: Option<GenericIdentification301>,
403}
404
405impl AddressType3Choice1 {
406 pub fn validate(&self) -> Result<(), ValidationError> {
407 if let Some(ref val) = self.cd {
408 val.validate()?
409 }
410 if let Some(ref val) = self.prtry {
411 val.validate()?
412 }
413 Ok(())
414 }
415}
416
417#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
419pub struct AmountAndCurrencyExchange31 {
420 #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
421 pub instd_amt: Option<AmountAndCurrencyExchangeDetails31>,
422 #[serde(rename = "TxAmt", skip_serializing_if = "Option::is_none")]
423 pub tx_amt: Option<AmountAndCurrencyExchangeDetails31>,
424 #[serde(rename = "CntrValAmt", skip_serializing_if = "Option::is_none")]
425 pub cntr_val_amt: Option<AmountAndCurrencyExchangeDetails31>,
426 #[serde(rename = "AnncdPstngAmt", skip_serializing_if = "Option::is_none")]
427 pub anncd_pstng_amt: Option<AmountAndCurrencyExchangeDetails31>,
428 #[serde(rename = "PrtryAmt", skip_serializing_if = "Option::is_none")]
429 pub prtry_amt: Option<Vec<AmountAndCurrencyExchangeDetails41>>,
430}
431
432impl AmountAndCurrencyExchange31 {
433 pub fn validate(&self) -> Result<(), ValidationError> {
434 if let Some(ref val) = self.instd_amt {
435 val.validate()?
436 }
437 if let Some(ref val) = self.tx_amt {
438 val.validate()?
439 }
440 if let Some(ref val) = self.cntr_val_amt {
441 val.validate()?
442 }
443 if let Some(ref val) = self.anncd_pstng_amt {
444 val.validate()?
445 }
446 if let Some(ref vec) = self.prtry_amt {
447 for item in vec {
448 item.validate()?
449 }
450 }
451 Ok(())
452 }
453}
454
455#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
457pub struct AmountAndCurrencyExchangeDetails31 {
458 #[serde(rename = "Amt")]
459 pub amt: ActiveOrHistoricCurrencyAndAmount,
460 #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
461 pub ccy_xchg: Option<CurrencyExchange51>,
462}
463
464impl AmountAndCurrencyExchangeDetails31 {
465 pub fn validate(&self) -> Result<(), ValidationError> {
466 self.amt.validate()?;
467 if let Some(ref val) = self.ccy_xchg {
468 val.validate()?
469 }
470 Ok(())
471 }
472}
473
474#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
476pub struct AmountAndCurrencyExchangeDetails41 {
477 #[serde(rename = "Tp")]
478 pub tp: String,
479 #[serde(rename = "Amt")]
480 pub amt: ActiveOrHistoricCurrencyAndAmount,
481 #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
482 pub ccy_xchg: Option<CurrencyExchange51>,
483}
484
485impl AmountAndCurrencyExchangeDetails41 {
486 pub fn validate(&self) -> Result<(), ValidationError> {
487 if self.tp.chars().count() < 1 {
488 return Err(ValidationError::new(
489 1001,
490 "tp is shorter than the minimum length of 1".to_string(),
491 ));
492 }
493 if self.tp.chars().count() > 35 {
494 return Err(ValidationError::new(
495 1002,
496 "tp exceeds the maximum length of 35".to_string(),
497 ));
498 }
499 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
500 if !pattern.is_match(&self.tp) {
501 return Err(ValidationError::new(
502 1005,
503 "tp does not match the required pattern".to_string(),
504 ));
505 }
506 self.amt.validate()?;
507 if let Some(ref val) = self.ccy_xchg {
508 val.validate()?
509 }
510 Ok(())
511 }
512}
513
514#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
516pub struct AmountAndDirection35 {
517 #[serde(rename = "Amt")]
518 pub amt: f64,
519 #[serde(rename = "CdtDbtInd")]
520 pub cdt_dbt_ind: CreditDebitCode,
521}
522
523impl AmountAndDirection35 {
524 pub fn validate(&self) -> Result<(), ValidationError> {
525 if self.amt < 0.000000 {
526 return Err(ValidationError::new(
527 1003,
528 "amt is less than the minimum value of 0.000000".to_string(),
529 ));
530 }
531 self.cdt_dbt_ind.validate()?;
532 Ok(())
533 }
534}
535
536#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
538pub struct AmountRangeBoundary1 {
539 #[serde(rename = "BdryAmt")]
540 pub bdry_amt: f64,
541 #[serde(rename = "Incl")]
542 pub incl: bool,
543}
544
545impl AmountRangeBoundary1 {
546 pub fn validate(&self) -> Result<(), ValidationError> {
547 if self.bdry_amt < 0.000000 {
548 return Err(ValidationError::new(
549 1003,
550 "bdry_amt is less than the minimum value of 0.000000".to_string(),
551 ));
552 }
553 Ok(())
554 }
555}
556
557#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
559pub enum AttendanceContext1Code {
560 #[default]
561 #[serde(rename = "ATTD")]
562 CodeATTD,
563 #[serde(rename = "SATT")]
564 CodeSATT,
565 #[serde(rename = "UATT")]
566 CodeUATT,
567}
568
569impl AttendanceContext1Code {
570 pub fn validate(&self) -> Result<(), ValidationError> {
571 Ok(())
572 }
573}
574
575#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
577pub enum AuthenticationEntity1Code {
578 #[default]
579 #[serde(rename = "ICCD")]
580 CodeICCD,
581 #[serde(rename = "AGNT")]
582 CodeAGNT,
583 #[serde(rename = "MERC")]
584 CodeMERC,
585}
586
587impl AuthenticationEntity1Code {
588 pub fn validate(&self) -> Result<(), ValidationError> {
589 Ok(())
590 }
591}
592
593#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
595pub enum AuthenticationMethod1Code {
596 #[default]
597 #[serde(rename = "UKNW")]
598 CodeUKNW,
599 #[serde(rename = "BYPS")]
600 CodeBYPS,
601 #[serde(rename = "NPIN")]
602 CodeNPIN,
603 #[serde(rename = "FPIN")]
604 CodeFPIN,
605 #[serde(rename = "CPSG")]
606 CodeCPSG,
607 #[serde(rename = "PPSG")]
608 CodePPSG,
609 #[serde(rename = "MANU")]
610 CodeMANU,
611 #[serde(rename = "MERC")]
612 CodeMERC,
613 #[serde(rename = "SCRT")]
614 CodeSCRT,
615 #[serde(rename = "SNCT")]
616 CodeSNCT,
617 #[serde(rename = "SCNL")]
618 CodeSCNL,
619}
620
621impl AuthenticationMethod1Code {
622 pub fn validate(&self) -> Result<(), ValidationError> {
623 Ok(())
624 }
625}
626
627#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
629pub struct BankToCustomerDebitCreditNotificationV08 {
630 #[serde(rename = "GrpHdr")]
631 pub grp_hdr: GroupHeader811,
632 #[serde(rename = "Ntfctn")]
633 pub ntfctn: Vec<AccountNotification171>,
634}
635
636impl BankToCustomerDebitCreditNotificationV08 {
637 pub fn validate(&self) -> Result<(), ValidationError> {
638 self.grp_hdr.validate()?;
639 for item in &self.ntfctn {
640 item.validate()?
641 }
642 Ok(())
643 }
644}
645
646#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
648pub struct BankTransactionCodeStructure41 {
649 #[serde(rename = "Domn", skip_serializing_if = "Option::is_none")]
650 pub domn: Option<BankTransactionCodeStructure5>,
651 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
652 pub prtry: Option<ProprietaryBankTransactionCodeStructure11>,
653}
654
655impl BankTransactionCodeStructure41 {
656 pub fn validate(&self) -> Result<(), ValidationError> {
657 if let Some(ref val) = self.domn {
658 val.validate()?
659 }
660 if let Some(ref val) = self.prtry {
661 val.validate()?
662 }
663 Ok(())
664 }
665}
666
667#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
669pub struct BankTransactionCodeStructure5 {
670 #[serde(rename = "Cd")]
671 pub cd: String,
672 #[serde(rename = "Fmly")]
673 pub fmly: BankTransactionCodeStructure6,
674}
675
676impl BankTransactionCodeStructure5 {
677 pub fn validate(&self) -> Result<(), ValidationError> {
678 if self.cd.chars().count() < 1 {
679 return Err(ValidationError::new(
680 1001,
681 "cd is shorter than the minimum length of 1".to_string(),
682 ));
683 }
684 if self.cd.chars().count() > 4 {
685 return Err(ValidationError::new(
686 1002,
687 "cd exceeds the maximum length of 4".to_string(),
688 ));
689 }
690 self.fmly.validate()?;
691 Ok(())
692 }
693}
694
695#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
697pub struct BankTransactionCodeStructure6 {
698 #[serde(rename = "Cd")]
699 pub cd: String,
700 #[serde(rename = "SubFmlyCd")]
701 pub sub_fmly_cd: String,
702}
703
704impl BankTransactionCodeStructure6 {
705 pub fn validate(&self) -> Result<(), ValidationError> {
706 if self.cd.chars().count() < 1 {
707 return Err(ValidationError::new(
708 1001,
709 "cd is shorter than the minimum length of 1".to_string(),
710 ));
711 }
712 if self.cd.chars().count() > 4 {
713 return Err(ValidationError::new(
714 1002,
715 "cd exceeds the maximum length of 4".to_string(),
716 ));
717 }
718 if self.sub_fmly_cd.chars().count() < 1 {
719 return Err(ValidationError::new(
720 1001,
721 "sub_fmly_cd is shorter than the minimum length of 1".to_string(),
722 ));
723 }
724 if self.sub_fmly_cd.chars().count() > 4 {
725 return Err(ValidationError::new(
726 1002,
727 "sub_fmly_cd exceeds the maximum length of 4".to_string(),
728 ));
729 }
730 Ok(())
731 }
732}
733
734#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
736pub struct BatchInformation21 {
737 #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
738 pub msg_id: Option<String>,
739 #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
740 pub pmt_inf_id: Option<String>,
741 #[serde(rename = "NbOfTxs", skip_serializing_if = "Option::is_none")]
742 pub nb_of_txs: Option<String>,
743 #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
744 pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
745 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
746 pub cdt_dbt_ind: Option<CreditDebitCode>,
747}
748
749impl BatchInformation21 {
750 pub fn validate(&self) -> Result<(), ValidationError> {
751 if let Some(ref val) = self.msg_id {
752 if val.chars().count() < 1 {
753 return Err(ValidationError::new(
754 1001,
755 "msg_id is shorter than the minimum length of 1".to_string(),
756 ));
757 }
758 if val.chars().count() > 35 {
759 return Err(ValidationError::new(
760 1002,
761 "msg_id exceeds the maximum length of 35".to_string(),
762 ));
763 }
764 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
765 if !pattern.is_match(val) {
766 return Err(ValidationError::new(
767 1005,
768 "msg_id does not match the required pattern".to_string(),
769 ));
770 }
771 }
772 if let Some(ref val) = self.pmt_inf_id {
773 if val.chars().count() < 1 {
774 return Err(ValidationError::new(
775 1001,
776 "pmt_inf_id is shorter than the minimum length of 1".to_string(),
777 ));
778 }
779 if val.chars().count() > 35 {
780 return Err(ValidationError::new(
781 1002,
782 "pmt_inf_id exceeds the maximum length of 35".to_string(),
783 ));
784 }
785 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
786 if !pattern.is_match(val) {
787 return Err(ValidationError::new(
788 1005,
789 "pmt_inf_id does not match the required pattern".to_string(),
790 ));
791 }
792 }
793 if let Some(ref val) = self.nb_of_txs {
794 let pattern = Regex::new("[0-9]{1,15}").unwrap();
795 if !pattern.is_match(val) {
796 return Err(ValidationError::new(
797 1005,
798 "nb_of_txs does not match the required pattern".to_string(),
799 ));
800 }
801 }
802 if let Some(ref val) = self.ttl_amt {
803 val.validate()?
804 }
805 if let Some(ref val) = self.cdt_dbt_ind {
806 val.validate()?
807 }
808 Ok(())
809 }
810}
811
812#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
816pub struct BranchAndFinancialInstitutionIdentification61 {
817 #[serde(rename = "FinInstnId")]
818 pub fin_instn_id: FinancialInstitutionIdentification181,
819 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
820 pub brnch_id: Option<BranchData31>,
821}
822
823impl BranchAndFinancialInstitutionIdentification61 {
824 pub fn validate(&self) -> Result<(), ValidationError> {
825 self.fin_instn_id.validate()?;
826 if let Some(ref val) = self.brnch_id {
827 val.validate()?
828 }
829 Ok(())
830 }
831}
832
833#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
837pub struct BranchAndFinancialInstitutionIdentification62 {
838 #[serde(rename = "FinInstnId")]
839 pub fin_instn_id: FinancialInstitutionIdentification182,
840 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
841 pub brnch_id: Option<BranchData32>,
842}
843
844impl BranchAndFinancialInstitutionIdentification62 {
845 pub fn validate(&self) -> Result<(), ValidationError> {
846 self.fin_instn_id.validate()?;
847 if let Some(ref val) = self.brnch_id {
848 val.validate()?
849 }
850 Ok(())
851 }
852}
853
854#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
856pub struct BranchAndFinancialInstitutionIdentification63 {
857 #[serde(rename = "FinInstnId")]
858 pub fin_instn_id: FinancialInstitutionIdentification183,
859}
860
861impl BranchAndFinancialInstitutionIdentification63 {
862 pub fn validate(&self) -> Result<(), ValidationError> {
863 self.fin_instn_id.validate()?;
864 Ok(())
865 }
866}
867
868#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
872pub struct BranchAndFinancialInstitutionIdentification64 {
873 #[serde(rename = "FinInstnId")]
874 pub fin_instn_id: FinancialInstitutionIdentification184,
875 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
876 pub brnch_id: Option<BranchData33>,
877}
878
879impl BranchAndFinancialInstitutionIdentification64 {
880 pub fn validate(&self) -> Result<(), ValidationError> {
881 self.fin_instn_id.validate()?;
882 if let Some(ref val) = self.brnch_id {
883 val.validate()?
884 }
885 Ok(())
886 }
887}
888
889#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
893pub struct BranchAndFinancialInstitutionIdentification65 {
894 #[serde(rename = "FinInstnId")]
895 pub fin_instn_id: FinancialInstitutionIdentification184,
896 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
897 pub brnch_id: Option<BranchData32>,
898}
899
900impl BranchAndFinancialInstitutionIdentification65 {
901 pub fn validate(&self) -> Result<(), ValidationError> {
902 self.fin_instn_id.validate()?;
903 if let Some(ref val) = self.brnch_id {
904 val.validate()?
905 }
906 Ok(())
907 }
908}
909
910#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
914pub struct BranchAndFinancialInstitutionIdentification66 {
915 #[serde(rename = "FinInstnId")]
916 pub fin_instn_id: FinancialInstitutionIdentification185,
917 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
918 pub brnch_id: Option<BranchData34>,
919}
920
921impl BranchAndFinancialInstitutionIdentification66 {
922 pub fn validate(&self) -> Result<(), ValidationError> {
923 self.fin_instn_id.validate()?;
924 if let Some(ref val) = self.brnch_id {
925 val.validate()?
926 }
927 Ok(())
928 }
929}
930
931#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
935pub struct BranchAndFinancialInstitutionIdentification67 {
936 #[serde(rename = "FinInstnId")]
937 pub fin_instn_id: FinancialInstitutionIdentification186,
938 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
939 pub brnch_id: Option<BranchData32>,
940}
941
942impl BranchAndFinancialInstitutionIdentification67 {
943 pub fn validate(&self) -> Result<(), ValidationError> {
944 self.fin_instn_id.validate()?;
945 if let Some(ref val) = self.brnch_id {
946 val.validate()?
947 }
948 Ok(())
949 }
950}
951
952#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
954pub struct BranchData31 {
955 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
956 pub id: Option<String>,
957 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
958 pub lei: Option<String>,
959 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
960 pub nm: Option<String>,
961 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
962 pub pstl_adr: Option<PostalAddress243>,
963}
964
965impl BranchData31 {
966 pub fn validate(&self) -> Result<(), ValidationError> {
967 if let Some(ref val) = self.id {
968 if val.chars().count() < 1 {
969 return Err(ValidationError::new(
970 1001,
971 "id is shorter than the minimum length of 1".to_string(),
972 ));
973 }
974 if val.chars().count() > 35 {
975 return Err(ValidationError::new(
976 1002,
977 "id exceeds the maximum length of 35".to_string(),
978 ));
979 }
980 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
981 if !pattern.is_match(val) {
982 return Err(ValidationError::new(
983 1005,
984 "id does not match the required pattern".to_string(),
985 ));
986 }
987 }
988 if let Some(ref val) = self.lei {
989 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
990 if !pattern.is_match(val) {
991 return Err(ValidationError::new(
992 1005,
993 "lei does not match the required pattern".to_string(),
994 ));
995 }
996 }
997 if let Some(ref val) = self.nm {
998 if val.chars().count() < 1 {
999 return Err(ValidationError::new(
1000 1001,
1001 "nm is shorter than the minimum length of 1".to_string(),
1002 ));
1003 }
1004 if val.chars().count() > 140 {
1005 return Err(ValidationError::new(
1006 1002,
1007 "nm exceeds the maximum length of 140".to_string(),
1008 ));
1009 }
1010 let pattern = Regex::new(
1011 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1012 )
1013 .unwrap();
1014 if !pattern.is_match(val) {
1015 return Err(ValidationError::new(
1016 1005,
1017 "nm does not match the required pattern".to_string(),
1018 ));
1019 }
1020 }
1021 if let Some(ref val) = self.pstl_adr {
1022 val.validate()?
1023 }
1024 Ok(())
1025 }
1026}
1027
1028#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1030pub struct BranchData32 {
1031 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1032 pub id: Option<String>,
1033 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1034 pub lei: Option<String>,
1035 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1036 pub nm: Option<String>,
1037 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1038 pub pstl_adr: Option<PostalAddress241>,
1039}
1040
1041impl BranchData32 {
1042 pub fn validate(&self) -> Result<(), ValidationError> {
1043 if let Some(ref val) = self.id {
1044 if val.chars().count() < 1 {
1045 return Err(ValidationError::new(
1046 1001,
1047 "id is shorter than the minimum length of 1".to_string(),
1048 ));
1049 }
1050 if val.chars().count() > 35 {
1051 return Err(ValidationError::new(
1052 1002,
1053 "id exceeds the maximum length of 35".to_string(),
1054 ));
1055 }
1056 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1057 if !pattern.is_match(val) {
1058 return Err(ValidationError::new(
1059 1005,
1060 "id does not match the required pattern".to_string(),
1061 ));
1062 }
1063 }
1064 if let Some(ref val) = self.lei {
1065 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1066 if !pattern.is_match(val) {
1067 return Err(ValidationError::new(
1068 1005,
1069 "lei does not match the required pattern".to_string(),
1070 ));
1071 }
1072 }
1073 if let Some(ref val) = self.nm {
1074 if val.chars().count() < 1 {
1075 return Err(ValidationError::new(
1076 1001,
1077 "nm is shorter than the minimum length of 1".to_string(),
1078 ));
1079 }
1080 if val.chars().count() > 140 {
1081 return Err(ValidationError::new(
1082 1002,
1083 "nm exceeds the maximum length of 140".to_string(),
1084 ));
1085 }
1086 let pattern = Regex::new(
1087 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1088 )
1089 .unwrap();
1090 if !pattern.is_match(val) {
1091 return Err(ValidationError::new(
1092 1005,
1093 "nm does not match the required pattern".to_string(),
1094 ));
1095 }
1096 }
1097 if let Some(ref val) = self.pstl_adr {
1098 val.validate()?
1099 }
1100 Ok(())
1101 }
1102}
1103
1104#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1106pub struct BranchData33 {
1107 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1108 pub id: Option<String>,
1109 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1110 pub lei: Option<String>,
1111 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1112 pub nm: Option<String>,
1113 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1114 pub pstl_adr: Option<PostalAddress244>,
1115}
1116
1117impl BranchData33 {
1118 pub fn validate(&self) -> Result<(), ValidationError> {
1119 if let Some(ref val) = self.id {
1120 if val.chars().count() < 1 {
1121 return Err(ValidationError::new(
1122 1001,
1123 "id is shorter than the minimum length of 1".to_string(),
1124 ));
1125 }
1126 if val.chars().count() > 35 {
1127 return Err(ValidationError::new(
1128 1002,
1129 "id exceeds the maximum length of 35".to_string(),
1130 ));
1131 }
1132 }
1133 if let Some(ref val) = self.lei {
1134 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1135 if !pattern.is_match(val) {
1136 return Err(ValidationError::new(
1137 1005,
1138 "lei does not match the required pattern".to_string(),
1139 ));
1140 }
1141 }
1142 if let Some(ref val) = self.nm {
1143 if val.chars().count() < 1 {
1144 return Err(ValidationError::new(
1145 1001,
1146 "nm is shorter than the minimum length of 1".to_string(),
1147 ));
1148 }
1149 if val.chars().count() > 140 {
1150 return Err(ValidationError::new(
1151 1002,
1152 "nm exceeds the maximum length of 140".to_string(),
1153 ));
1154 }
1155 }
1156 if let Some(ref val) = self.pstl_adr {
1157 val.validate()?
1158 }
1159 Ok(())
1160 }
1161}
1162
1163#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1165pub struct BranchData34 {
1166 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1167 pub id: Option<String>,
1168 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1169 pub lei: Option<String>,
1170 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1171 pub nm: Option<String>,
1172 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1173 pub pstl_adr: Option<PostalAddress241>,
1174}
1175
1176impl BranchData34 {
1177 pub fn validate(&self) -> Result<(), ValidationError> {
1178 if let Some(ref val) = self.id {
1179 if val.chars().count() < 1 {
1180 return Err(ValidationError::new(
1181 1001,
1182 "id is shorter than the minimum length of 1".to_string(),
1183 ));
1184 }
1185 if val.chars().count() > 35 {
1186 return Err(ValidationError::new(
1187 1002,
1188 "id exceeds the maximum length of 35".to_string(),
1189 ));
1190 }
1191 }
1192 if let Some(ref val) = self.lei {
1193 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1194 if !pattern.is_match(val) {
1195 return Err(ValidationError::new(
1196 1005,
1197 "lei does not match the required pattern".to_string(),
1198 ));
1199 }
1200 }
1201 if let Some(ref val) = self.nm {
1202 if val.chars().count() < 1 {
1203 return Err(ValidationError::new(
1204 1001,
1205 "nm is shorter than the minimum length of 1".to_string(),
1206 ));
1207 }
1208 if val.chars().count() > 140 {
1209 return Err(ValidationError::new(
1210 1002,
1211 "nm exceeds the maximum length of 140".to_string(),
1212 ));
1213 }
1214 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1215 if !pattern.is_match(val) {
1216 return Err(ValidationError::new(
1217 1005,
1218 "nm does not match the required pattern".to_string(),
1219 ));
1220 }
1221 }
1222 if let Some(ref val) = self.pstl_adr {
1223 val.validate()?
1224 }
1225 Ok(())
1226 }
1227}
1228
1229#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1231pub enum CSCManagement1Code {
1232 #[default]
1233 #[serde(rename = "PRST")]
1234 CodePRST,
1235 #[serde(rename = "BYPS")]
1236 CodeBYPS,
1237 #[serde(rename = "UNRD")]
1238 CodeUNRD,
1239 #[serde(rename = "NCSC")]
1240 CodeNCSC,
1241}
1242
1243impl CSCManagement1Code {
1244 pub fn validate(&self) -> Result<(), ValidationError> {
1245 Ok(())
1246 }
1247}
1248
1249#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1251pub struct CardAggregated21 {
1252 #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1253 pub addtl_svc: Option<CardPaymentServiceType2Code>,
1254 #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1255 pub tx_ctgy: Option<String>,
1256 #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1257 pub sale_rcncltn_id: Option<String>,
1258 #[serde(rename = "SeqNbRg", skip_serializing_if = "Option::is_none")]
1259 pub seq_nb_rg: Option<CardSequenceNumberRange11>,
1260 #[serde(rename = "TxDtRg", skip_serializing_if = "Option::is_none")]
1261 pub tx_dt_rg: Option<DateOrDateTimePeriod1Choice1>,
1262}
1263
1264impl CardAggregated21 {
1265 pub fn validate(&self) -> Result<(), ValidationError> {
1266 if let Some(ref val) = self.addtl_svc {
1267 val.validate()?
1268 }
1269 if let Some(ref val) = self.tx_ctgy {
1270 if val.chars().count() < 1 {
1271 return Err(ValidationError::new(
1272 1001,
1273 "tx_ctgy is shorter than the minimum length of 1".to_string(),
1274 ));
1275 }
1276 if val.chars().count() > 4 {
1277 return Err(ValidationError::new(
1278 1002,
1279 "tx_ctgy exceeds the maximum length of 4".to_string(),
1280 ));
1281 }
1282 }
1283 if let Some(ref val) = self.sale_rcncltn_id {
1284 if val.chars().count() < 1 {
1285 return Err(ValidationError::new(
1286 1001,
1287 "sale_rcncltn_id is shorter than the minimum length of 1".to_string(),
1288 ));
1289 }
1290 if val.chars().count() > 35 {
1291 return Err(ValidationError::new(
1292 1002,
1293 "sale_rcncltn_id exceeds the maximum length of 35".to_string(),
1294 ));
1295 }
1296 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1297 if !pattern.is_match(val) {
1298 return Err(ValidationError::new(
1299 1005,
1300 "sale_rcncltn_id does not match the required pattern".to_string(),
1301 ));
1302 }
1303 }
1304 if let Some(ref val) = self.seq_nb_rg {
1305 val.validate()?
1306 }
1307 if let Some(ref val) = self.tx_dt_rg {
1308 val.validate()?
1309 }
1310 Ok(())
1311 }
1312}
1313
1314#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1316pub enum CardDataReading1Code {
1317 #[default]
1318 #[serde(rename = "TAGC")]
1319 CodeTAGC,
1320 #[serde(rename = "PHYS")]
1321 CodePHYS,
1322 #[serde(rename = "BRCD")]
1323 CodeBRCD,
1324 #[serde(rename = "MGST")]
1325 CodeMGST,
1326 #[serde(rename = "CICC")]
1327 CodeCICC,
1328 #[serde(rename = "DFLE")]
1329 CodeDFLE,
1330 #[serde(rename = "CTLS")]
1331 CodeCTLS,
1332 #[serde(rename = "ECTL")]
1333 CodeECTL,
1334}
1335
1336impl CardDataReading1Code {
1337 pub fn validate(&self) -> Result<(), ValidationError> {
1338 Ok(())
1339 }
1340}
1341
1342#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1344pub struct CardEntry41 {
1345 #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1346 pub card: Option<PaymentCard41>,
1347 #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1348 pub poi: Option<PointOfInteraction11>,
1349 #[serde(rename = "AggtdNtry", skip_serializing_if = "Option::is_none")]
1350 pub aggtd_ntry: Option<CardAggregated21>,
1351 #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1352 pub pre_pd_acct: Option<CashAccount382>,
1353}
1354
1355impl CardEntry41 {
1356 pub fn validate(&self) -> Result<(), ValidationError> {
1357 if let Some(ref val) = self.card {
1358 val.validate()?
1359 }
1360 if let Some(ref val) = self.poi {
1361 val.validate()?
1362 }
1363 if let Some(ref val) = self.aggtd_ntry {
1364 val.validate()?
1365 }
1366 if let Some(ref val) = self.pre_pd_acct {
1367 val.validate()?
1368 }
1369 Ok(())
1370 }
1371}
1372
1373#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1376pub struct CardIndividualTransaction21 {
1377 #[serde(rename = "ICCRltdData", skip_serializing_if = "Option::is_none")]
1378 pub icc_rltd_data: Option<String>,
1379 #[serde(rename = "PmtCntxt", skip_serializing_if = "Option::is_none")]
1380 pub pmt_cntxt: Option<PaymentContext3>,
1381 #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1382 pub addtl_svc: Option<CardPaymentServiceType2Code>,
1383 #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1384 pub tx_ctgy: Option<String>,
1385 #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1386 pub sale_rcncltn_id: Option<String>,
1387 #[serde(rename = "SaleRefNb", skip_serializing_if = "Option::is_none")]
1388 pub sale_ref_nb: Option<String>,
1389 #[serde(rename = "RePresntmntRsn", skip_serializing_if = "Option::is_none")]
1390 pub re_presntmnt_rsn: Option<String>,
1391 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
1392 pub seq_nb: Option<String>,
1393 #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
1394 pub tx_id: Option<TransactionIdentifier11>,
1395 #[serde(rename = "Pdct", skip_serializing_if = "Option::is_none")]
1396 pub pdct: Option<Product21>,
1397 #[serde(rename = "VldtnDt", skip_serializing_if = "Option::is_none")]
1398 pub vldtn_dt: Option<String>,
1399 #[serde(rename = "VldtnSeqNb", skip_serializing_if = "Option::is_none")]
1400 pub vldtn_seq_nb: Option<String>,
1401}
1402
1403impl CardIndividualTransaction21 {
1404 pub fn validate(&self) -> Result<(), ValidationError> {
1405 if let Some(ref val) = self.icc_rltd_data {
1406 if val.chars().count() < 1 {
1407 return Err(ValidationError::new(
1408 1001,
1409 "icc_rltd_data is shorter than the minimum length of 1".to_string(),
1410 ));
1411 }
1412 if val.chars().count() > 1025 {
1413 return Err(ValidationError::new(
1414 1002,
1415 "icc_rltd_data exceeds the maximum length of 1025".to_string(),
1416 ));
1417 }
1418 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1419 if !pattern.is_match(val) {
1420 return Err(ValidationError::new(
1421 1005,
1422 "icc_rltd_data does not match the required pattern".to_string(),
1423 ));
1424 }
1425 }
1426 if let Some(ref val) = self.pmt_cntxt {
1427 val.validate()?
1428 }
1429 if let Some(ref val) = self.addtl_svc {
1430 val.validate()?
1431 }
1432 if let Some(ref val) = self.tx_ctgy {
1433 if val.chars().count() < 1 {
1434 return Err(ValidationError::new(
1435 1001,
1436 "tx_ctgy is shorter than the minimum length of 1".to_string(),
1437 ));
1438 }
1439 if val.chars().count() > 4 {
1440 return Err(ValidationError::new(
1441 1002,
1442 "tx_ctgy exceeds the maximum length of 4".to_string(),
1443 ));
1444 }
1445 }
1446 if let Some(ref val) = self.sale_rcncltn_id {
1447 if val.chars().count() < 1 {
1448 return Err(ValidationError::new(
1449 1001,
1450 "sale_rcncltn_id is shorter than the minimum length of 1".to_string(),
1451 ));
1452 }
1453 if val.chars().count() > 35 {
1454 return Err(ValidationError::new(
1455 1002,
1456 "sale_rcncltn_id exceeds the maximum length of 35".to_string(),
1457 ));
1458 }
1459 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1460 if !pattern.is_match(val) {
1461 return Err(ValidationError::new(
1462 1005,
1463 "sale_rcncltn_id does not match the required pattern".to_string(),
1464 ));
1465 }
1466 }
1467 if let Some(ref val) = self.sale_ref_nb {
1468 if val.chars().count() < 1 {
1469 return Err(ValidationError::new(
1470 1001,
1471 "sale_ref_nb is shorter than the minimum length of 1".to_string(),
1472 ));
1473 }
1474 if val.chars().count() > 35 {
1475 return Err(ValidationError::new(
1476 1002,
1477 "sale_ref_nb exceeds the maximum length of 35".to_string(),
1478 ));
1479 }
1480 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1481 if !pattern.is_match(val) {
1482 return Err(ValidationError::new(
1483 1005,
1484 "sale_ref_nb does not match the required pattern".to_string(),
1485 ));
1486 }
1487 }
1488 if let Some(ref val) = self.re_presntmnt_rsn {
1489 if val.chars().count() < 1 {
1490 return Err(ValidationError::new(
1491 1001,
1492 "re_presntmnt_rsn is shorter than the minimum length of 1".to_string(),
1493 ));
1494 }
1495 if val.chars().count() > 4 {
1496 return Err(ValidationError::new(
1497 1002,
1498 "re_presntmnt_rsn exceeds the maximum length of 4".to_string(),
1499 ));
1500 }
1501 }
1502 if let Some(ref val) = self.seq_nb {
1503 if val.chars().count() < 1 {
1504 return Err(ValidationError::new(
1505 1001,
1506 "seq_nb is shorter than the minimum length of 1".to_string(),
1507 ));
1508 }
1509 if val.chars().count() > 35 {
1510 return Err(ValidationError::new(
1511 1002,
1512 "seq_nb exceeds the maximum length of 35".to_string(),
1513 ));
1514 }
1515 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1516 if !pattern.is_match(val) {
1517 return Err(ValidationError::new(
1518 1005,
1519 "seq_nb does not match the required pattern".to_string(),
1520 ));
1521 }
1522 }
1523 if let Some(ref val) = self.tx_id {
1524 val.validate()?
1525 }
1526 if let Some(ref val) = self.pdct {
1527 val.validate()?
1528 }
1529 if let Some(ref val) = self.vldtn_seq_nb {
1530 if val.chars().count() < 1 {
1531 return Err(ValidationError::new(
1532 1001,
1533 "vldtn_seq_nb is shorter than the minimum length of 1".to_string(),
1534 ));
1535 }
1536 if val.chars().count() > 35 {
1537 return Err(ValidationError::new(
1538 1002,
1539 "vldtn_seq_nb exceeds the maximum length of 35".to_string(),
1540 ));
1541 }
1542 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1543 if !pattern.is_match(val) {
1544 return Err(ValidationError::new(
1545 1005,
1546 "vldtn_seq_nb does not match the required pattern".to_string(),
1547 ));
1548 }
1549 }
1550 Ok(())
1551 }
1552}
1553
1554#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1556pub enum CardPaymentServiceType2Code {
1557 #[default]
1558 #[serde(rename = "AGGR")]
1559 CodeAGGR,
1560 #[serde(rename = "DCCV")]
1561 CodeDCCV,
1562 #[serde(rename = "GRTT")]
1563 CodeGRTT,
1564 #[serde(rename = "INSP")]
1565 CodeINSP,
1566 #[serde(rename = "LOYT")]
1567 CodeLOYT,
1568 #[serde(rename = "NRES")]
1569 CodeNRES,
1570 #[serde(rename = "PUCO")]
1571 CodePUCO,
1572 #[serde(rename = "RECP")]
1573 CodeRECP,
1574 #[serde(rename = "SOAF")]
1575 CodeSOAF,
1576 #[serde(rename = "UNAF")]
1577 CodeUNAF,
1578 #[serde(rename = "VCAU")]
1579 CodeVCAU,
1580}
1581
1582impl CardPaymentServiceType2Code {
1583 pub fn validate(&self) -> Result<(), ValidationError> {
1584 Ok(())
1585 }
1586}
1587
1588#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1590pub struct CardSecurityInformation1 {
1591 #[serde(rename = "CSCMgmt")]
1592 pub csc_mgmt: CSCManagement1Code,
1593 #[serde(rename = "CSCVal", skip_serializing_if = "Option::is_none")]
1594 pub csc_val: Option<String>,
1595}
1596
1597impl CardSecurityInformation1 {
1598 pub fn validate(&self) -> Result<(), ValidationError> {
1599 self.csc_mgmt.validate()?;
1600 if let Some(ref val) = self.csc_val {
1601 let pattern = Regex::new("[0-9]{3,4}").unwrap();
1602 if !pattern.is_match(val) {
1603 return Err(ValidationError::new(
1604 1005,
1605 "csc_val does not match the required pattern".to_string(),
1606 ));
1607 }
1608 }
1609 Ok(())
1610 }
1611}
1612
1613#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1615pub struct CardSequenceNumberRange11 {
1616 #[serde(rename = "FrstTx", skip_serializing_if = "Option::is_none")]
1617 pub frst_tx: Option<String>,
1618 #[serde(rename = "LastTx", skip_serializing_if = "Option::is_none")]
1619 pub last_tx: Option<String>,
1620}
1621
1622impl CardSequenceNumberRange11 {
1623 pub fn validate(&self) -> Result<(), ValidationError> {
1624 if let Some(ref val) = self.frst_tx {
1625 if val.chars().count() < 1 {
1626 return Err(ValidationError::new(
1627 1001,
1628 "frst_tx is shorter than the minimum length of 1".to_string(),
1629 ));
1630 }
1631 if val.chars().count() > 35 {
1632 return Err(ValidationError::new(
1633 1002,
1634 "frst_tx exceeds the maximum length of 35".to_string(),
1635 ));
1636 }
1637 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1638 if !pattern.is_match(val) {
1639 return Err(ValidationError::new(
1640 1005,
1641 "frst_tx does not match the required pattern".to_string(),
1642 ));
1643 }
1644 }
1645 if let Some(ref val) = self.last_tx {
1646 if val.chars().count() < 1 {
1647 return Err(ValidationError::new(
1648 1001,
1649 "last_tx is shorter than the minimum length of 1".to_string(),
1650 ));
1651 }
1652 if val.chars().count() > 35 {
1653 return Err(ValidationError::new(
1654 1002,
1655 "last_tx exceeds the maximum length of 35".to_string(),
1656 ));
1657 }
1658 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1659 if !pattern.is_match(val) {
1660 return Err(ValidationError::new(
1661 1005,
1662 "last_tx does not match the required pattern".to_string(),
1663 ));
1664 }
1665 }
1666 Ok(())
1667 }
1668}
1669
1670#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1672pub struct CardTransaction171 {
1673 #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1674 pub card: Option<PaymentCard41>,
1675 #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1676 pub poi: Option<PointOfInteraction11>,
1677 #[serde(rename = "Tx", skip_serializing_if = "Option::is_none")]
1678 pub tx: Option<CardTransaction3Choice1>,
1679 #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1680 pub pre_pd_acct: Option<CashAccount384>,
1681}
1682
1683impl CardTransaction171 {
1684 pub fn validate(&self) -> Result<(), ValidationError> {
1685 if let Some(ref val) = self.card {
1686 val.validate()?
1687 }
1688 if let Some(ref val) = self.poi {
1689 val.validate()?
1690 }
1691 if let Some(ref val) = self.tx {
1692 val.validate()?
1693 }
1694 if let Some(ref val) = self.pre_pd_acct {
1695 val.validate()?
1696 }
1697 Ok(())
1698 }
1699}
1700
1701#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1703pub struct CardTransaction3Choice1 {
1704 #[serde(rename = "Aggtd", skip_serializing_if = "Option::is_none")]
1705 pub aggtd: Option<CardAggregated21>,
1706 #[serde(rename = "Indv", skip_serializing_if = "Option::is_none")]
1707 pub indv: Option<CardIndividualTransaction21>,
1708}
1709
1710impl CardTransaction3Choice1 {
1711 pub fn validate(&self) -> Result<(), ValidationError> {
1712 if let Some(ref val) = self.aggtd {
1713 val.validate()?
1714 }
1715 if let Some(ref val) = self.indv {
1716 val.validate()?
1717 }
1718 Ok(())
1719 }
1720}
1721
1722#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1724pub struct CardholderAuthentication2 {
1725 #[serde(rename = "AuthntcnMtd")]
1726 pub authntcn_mtd: AuthenticationMethod1Code,
1727 #[serde(rename = "AuthntcnNtty")]
1728 pub authntcn_ntty: AuthenticationEntity1Code,
1729}
1730
1731impl CardholderAuthentication2 {
1732 pub fn validate(&self) -> Result<(), ValidationError> {
1733 self.authntcn_mtd.validate()?;
1734 self.authntcn_ntty.validate()?;
1735 Ok(())
1736 }
1737}
1738
1739#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1741pub enum CardholderVerificationCapability1Code {
1742 #[default]
1743 #[serde(rename = "MNSG")]
1744 CodeMNSG,
1745 #[serde(rename = "NPIN")]
1746 CodeNPIN,
1747 #[serde(rename = "FCPN")]
1748 CodeFCPN,
1749 #[serde(rename = "FEPN")]
1750 CodeFEPN,
1751 #[serde(rename = "FDSG")]
1752 CodeFDSG,
1753 #[serde(rename = "FBIO")]
1754 CodeFBIO,
1755 #[serde(rename = "MNVR")]
1756 CodeMNVR,
1757 #[serde(rename = "FBIG")]
1758 CodeFBIG,
1759 #[serde(rename = "APKI")]
1760 CodeAPKI,
1761 #[serde(rename = "PKIS")]
1762 CodePKIS,
1763 #[serde(rename = "CHDT")]
1764 CodeCHDT,
1765 #[serde(rename = "SCEC")]
1766 CodeSCEC,
1767}
1768
1769impl CardholderVerificationCapability1Code {
1770 pub fn validate(&self) -> Result<(), ValidationError> {
1771 Ok(())
1772 }
1773}
1774
1775#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1777pub struct CashAccount381 {
1778 #[serde(rename = "Id")]
1779 pub id: AccountIdentification4Choice1,
1780 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1781 pub tp: Option<CashAccountType2Choice1>,
1782 #[serde(rename = "Ccy")]
1783 pub ccy: String,
1784 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1785 pub nm: Option<String>,
1786 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1787 pub prxy: Option<ProxyAccountIdentification11>,
1788}
1789
1790impl CashAccount381 {
1791 pub fn validate(&self) -> Result<(), ValidationError> {
1792 self.id.validate()?;
1793 if let Some(ref val) = self.tp {
1794 val.validate()?
1795 }
1796 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
1797 if !pattern.is_match(&self.ccy) {
1798 return Err(ValidationError::new(
1799 1005,
1800 "ccy does not match the required pattern".to_string(),
1801 ));
1802 }
1803 if let Some(ref val) = self.nm {
1804 if val.chars().count() < 1 {
1805 return Err(ValidationError::new(
1806 1001,
1807 "nm is shorter than the minimum length of 1".to_string(),
1808 ));
1809 }
1810 if val.chars().count() > 70 {
1811 return Err(ValidationError::new(
1812 1002,
1813 "nm exceeds the maximum length of 70".to_string(),
1814 ));
1815 }
1816 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1817 if !pattern.is_match(val) {
1818 return Err(ValidationError::new(
1819 1005,
1820 "nm does not match the required pattern".to_string(),
1821 ));
1822 }
1823 }
1824 if let Some(ref val) = self.prxy {
1825 val.validate()?
1826 }
1827 Ok(())
1828 }
1829}
1830
1831#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1833pub struct CashAccount382 {
1834 #[serde(rename = "Id")]
1835 pub id: AccountIdentification4Choice1,
1836 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1837 pub tp: Option<CashAccountType2Choice1>,
1838 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1839 pub ccy: Option<String>,
1840 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1841 pub nm: Option<String>,
1842 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1843 pub prxy: Option<ProxyAccountIdentification12>,
1844}
1845
1846impl CashAccount382 {
1847 pub fn validate(&self) -> Result<(), ValidationError> {
1848 self.id.validate()?;
1849 if let Some(ref val) = self.tp {
1850 val.validate()?
1851 }
1852 if let Some(ref val) = self.ccy {
1853 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
1854 if !pattern.is_match(val) {
1855 return Err(ValidationError::new(
1856 1005,
1857 "ccy does not match the required pattern".to_string(),
1858 ));
1859 }
1860 }
1861 if let Some(ref val) = self.nm {
1862 if val.chars().count() < 1 {
1863 return Err(ValidationError::new(
1864 1001,
1865 "nm is shorter than the minimum length of 1".to_string(),
1866 ));
1867 }
1868 if val.chars().count() > 70 {
1869 return Err(ValidationError::new(
1870 1002,
1871 "nm exceeds the maximum length of 70".to_string(),
1872 ));
1873 }
1874 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1875 if !pattern.is_match(val) {
1876 return Err(ValidationError::new(
1877 1005,
1878 "nm does not match the required pattern".to_string(),
1879 ));
1880 }
1881 }
1882 if let Some(ref val) = self.prxy {
1883 val.validate()?
1884 }
1885 Ok(())
1886 }
1887}
1888
1889#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1891pub struct CashAccount383 {
1892 #[serde(rename = "Id")]
1893 pub id: AccountIdentification4Choice1,
1894 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1895 pub tp: Option<CashAccountType2Choice1>,
1896 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1897 pub ccy: Option<String>,
1898 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1899 pub nm: Option<String>,
1900 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1901 pub prxy: Option<ProxyAccountIdentification13>,
1902}
1903
1904impl CashAccount383 {
1905 pub fn validate(&self) -> Result<(), ValidationError> {
1906 self.id.validate()?;
1907 if let Some(ref val) = self.tp {
1908 val.validate()?
1909 }
1910 if let Some(ref val) = self.ccy {
1911 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
1912 if !pattern.is_match(val) {
1913 return Err(ValidationError::new(
1914 1005,
1915 "ccy does not match the required pattern".to_string(),
1916 ));
1917 }
1918 }
1919 if let Some(ref val) = self.nm {
1920 if val.chars().count() < 1 {
1921 return Err(ValidationError::new(
1922 1001,
1923 "nm is shorter than the minimum length of 1".to_string(),
1924 ));
1925 }
1926 if val.chars().count() > 70 {
1927 return Err(ValidationError::new(
1928 1002,
1929 "nm exceeds the maximum length of 70".to_string(),
1930 ));
1931 }
1932 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1933 if !pattern.is_match(val) {
1934 return Err(ValidationError::new(
1935 1005,
1936 "nm does not match the required pattern".to_string(),
1937 ));
1938 }
1939 }
1940 if let Some(ref val) = self.prxy {
1941 val.validate()?
1942 }
1943 Ok(())
1944 }
1945}
1946
1947#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1949pub struct CashAccount384 {
1950 #[serde(rename = "Id")]
1951 pub id: AccountIdentification4Choice1,
1952 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1953 pub tp: Option<CashAccountType2Choice1>,
1954 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1955 pub ccy: Option<String>,
1956 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1957 pub nm: Option<String>,
1958 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1959 pub prxy: Option<ProxyAccountIdentification11>,
1960}
1961
1962impl CashAccount384 {
1963 pub fn validate(&self) -> Result<(), ValidationError> {
1964 self.id.validate()?;
1965 if let Some(ref val) = self.tp {
1966 val.validate()?
1967 }
1968 if let Some(ref val) = self.ccy {
1969 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
1970 if !pattern.is_match(val) {
1971 return Err(ValidationError::new(
1972 1005,
1973 "ccy does not match the required pattern".to_string(),
1974 ));
1975 }
1976 }
1977 if let Some(ref val) = self.nm {
1978 if val.chars().count() < 1 {
1979 return Err(ValidationError::new(
1980 1001,
1981 "nm is shorter than the minimum length of 1".to_string(),
1982 ));
1983 }
1984 if val.chars().count() > 70 {
1985 return Err(ValidationError::new(
1986 1002,
1987 "nm exceeds the maximum length of 70".to_string(),
1988 ));
1989 }
1990 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1991 if !pattern.is_match(val) {
1992 return Err(ValidationError::new(
1993 1005,
1994 "nm does not match the required pattern".to_string(),
1995 ));
1996 }
1997 }
1998 if let Some(ref val) = self.prxy {
1999 val.validate()?
2000 }
2001 Ok(())
2002 }
2003}
2004
2005#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2007pub struct CashAccount391 {
2008 #[serde(rename = "Id")]
2009 pub id: AccountIdentification4Choice1,
2010 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2011 pub tp: Option<CashAccountType2Choice1>,
2012 #[serde(rename = "Ccy")]
2013 pub ccy: String,
2014 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2015 pub nm: Option<String>,
2016 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
2017 pub prxy: Option<ProxyAccountIdentification11>,
2018 #[serde(rename = "Ownr", skip_serializing_if = "Option::is_none")]
2019 pub ownr: Option<PartyIdentification1352>,
2020 #[serde(rename = "Svcr", skip_serializing_if = "Option::is_none")]
2021 pub svcr: Option<BranchAndFinancialInstitutionIdentification61>,
2022}
2023
2024impl CashAccount391 {
2025 pub fn validate(&self) -> Result<(), ValidationError> {
2026 self.id.validate()?;
2027 if let Some(ref val) = self.tp {
2028 val.validate()?
2029 }
2030 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2031 if !pattern.is_match(&self.ccy) {
2032 return Err(ValidationError::new(
2033 1005,
2034 "ccy does not match the required pattern".to_string(),
2035 ));
2036 }
2037 if let Some(ref val) = self.nm {
2038 if val.chars().count() < 1 {
2039 return Err(ValidationError::new(
2040 1001,
2041 "nm is shorter than the minimum length of 1".to_string(),
2042 ));
2043 }
2044 if val.chars().count() > 70 {
2045 return Err(ValidationError::new(
2046 1002,
2047 "nm exceeds the maximum length of 70".to_string(),
2048 ));
2049 }
2050 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2051 if !pattern.is_match(val) {
2052 return Err(ValidationError::new(
2053 1005,
2054 "nm does not match the required pattern".to_string(),
2055 ));
2056 }
2057 }
2058 if let Some(ref val) = self.prxy {
2059 val.validate()?
2060 }
2061 if let Some(ref val) = self.ownr {
2062 val.validate()?
2063 }
2064 if let Some(ref val) = self.svcr {
2065 val.validate()?
2066 }
2067 Ok(())
2068 }
2069}
2070
2071#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2073pub struct CashAccountType2Choice1 {
2074 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2075 pub cd: Option<String>,
2076 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2077 pub prtry: Option<String>,
2078}
2079
2080impl CashAccountType2Choice1 {
2081 pub fn validate(&self) -> Result<(), ValidationError> {
2082 if let Some(ref val) = self.cd {
2083 if val.chars().count() < 1 {
2084 return Err(ValidationError::new(
2085 1001,
2086 "cd is shorter than the minimum length of 1".to_string(),
2087 ));
2088 }
2089 if val.chars().count() > 4 {
2090 return Err(ValidationError::new(
2091 1002,
2092 "cd exceeds the maximum length of 4".to_string(),
2093 ));
2094 }
2095 }
2096 if let Some(ref val) = self.prtry {
2097 if val.chars().count() < 1 {
2098 return Err(ValidationError::new(
2099 1001,
2100 "prtry is shorter than the minimum length of 1".to_string(),
2101 ));
2102 }
2103 if val.chars().count() > 35 {
2104 return Err(ValidationError::new(
2105 1002,
2106 "prtry exceeds the maximum length of 35".to_string(),
2107 ));
2108 }
2109 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2110 if !pattern.is_match(val) {
2111 return Err(ValidationError::new(
2112 1005,
2113 "prtry does not match the required pattern".to_string(),
2114 ));
2115 }
2116 }
2117 Ok(())
2118 }
2119}
2120
2121#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2124pub struct CashAvailability1 {
2125 #[serde(rename = "Dt")]
2126 pub dt: CashAvailabilityDate1Choice,
2127 #[serde(rename = "Amt")]
2128 pub amt: ActiveOrHistoricCurrencyAndAmount,
2129 #[serde(rename = "CdtDbtInd")]
2130 pub cdt_dbt_ind: CreditDebitCode,
2131}
2132
2133impl CashAvailability1 {
2134 pub fn validate(&self) -> Result<(), ValidationError> {
2135 self.dt.validate()?;
2136 self.amt.validate()?;
2137 self.cdt_dbt_ind.validate()?;
2138 Ok(())
2139 }
2140}
2141
2142#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2144pub struct CashAvailabilityDate1Choice {
2145 #[serde(rename = "NbOfDays", skip_serializing_if = "Option::is_none")]
2146 pub nb_of_days: Option<String>,
2147 #[serde(rename = "ActlDt", skip_serializing_if = "Option::is_none")]
2148 pub actl_dt: Option<String>,
2149}
2150
2151impl CashAvailabilityDate1Choice {
2152 pub fn validate(&self) -> Result<(), ValidationError> {
2153 if let Some(ref val) = self.nb_of_days {
2154 let pattern = Regex::new("[\\+]{0,1}[0-9]{1,15}").unwrap();
2155 if !pattern.is_match(val) {
2156 return Err(ValidationError::new(
2157 1005,
2158 "nb_of_days does not match the required pattern".to_string(),
2159 ));
2160 }
2161 }
2162 Ok(())
2163 }
2164}
2165
2166#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2168pub struct CashDeposit1 {
2169 #[serde(rename = "NoteDnmtn")]
2170 pub note_dnmtn: ActiveCurrencyAndAmount,
2171 #[serde(rename = "NbOfNotes")]
2172 pub nb_of_notes: String,
2173 #[serde(rename = "Amt")]
2174 pub amt: ActiveCurrencyAndAmount,
2175}
2176
2177impl CashDeposit1 {
2178 pub fn validate(&self) -> Result<(), ValidationError> {
2179 self.note_dnmtn.validate()?;
2180 let pattern = Regex::new("[0-9]{1,15}").unwrap();
2181 if !pattern.is_match(&self.nb_of_notes) {
2182 return Err(ValidationError::new(
2183 1005,
2184 "nb_of_notes does not match the required pattern".to_string(),
2185 ));
2186 }
2187 self.amt.validate()?;
2188 Ok(())
2189 }
2190}
2191
2192#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2194pub enum ChargeBearerType1Code {
2195 #[default]
2196 #[serde(rename = "DEBT")]
2197 CodeDEBT,
2198 #[serde(rename = "CRED")]
2199 CodeCRED,
2200 #[serde(rename = "SHAR")]
2201 CodeSHAR,
2202 #[serde(rename = "SLEV")]
2203 CodeSLEV,
2204}
2205
2206impl ChargeBearerType1Code {
2207 pub fn validate(&self) -> Result<(), ValidationError> {
2208 Ok(())
2209 }
2210}
2211
2212#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2214pub struct ChargeType3Choice1 {
2215 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2216 pub cd: Option<String>,
2217 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2218 pub prtry: Option<GenericIdentification31>,
2219}
2220
2221impl ChargeType3Choice1 {
2222 pub fn validate(&self) -> Result<(), ValidationError> {
2223 if let Some(ref val) = self.cd {
2224 if val.chars().count() < 1 {
2225 return Err(ValidationError::new(
2226 1001,
2227 "cd is shorter than the minimum length of 1".to_string(),
2228 ));
2229 }
2230 if val.chars().count() > 4 {
2231 return Err(ValidationError::new(
2232 1002,
2233 "cd exceeds the maximum length of 4".to_string(),
2234 ));
2235 }
2236 }
2237 if let Some(ref val) = self.prtry {
2238 val.validate()?
2239 }
2240 Ok(())
2241 }
2242}
2243
2244#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2246pub struct Charges61 {
2247 #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2248 pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2249 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2250 pub rcrd: Option<Vec<ChargesRecord31>>,
2251}
2252
2253impl Charges61 {
2254 pub fn validate(&self) -> Result<(), ValidationError> {
2255 if let Some(ref val) = self.ttl_chrgs_and_tax_amt {
2256 val.validate()?
2257 }
2258 if let Some(ref vec) = self.rcrd {
2259 for item in vec {
2260 item.validate()?
2261 }
2262 }
2263 Ok(())
2264 }
2265}
2266
2267#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2269pub struct Charges62 {
2270 #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2271 pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2272 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2273 pub rcrd: Option<Vec<ChargesRecord32>>,
2274}
2275
2276impl Charges62 {
2277 pub fn validate(&self) -> Result<(), ValidationError> {
2278 if let Some(ref val) = self.ttl_chrgs_and_tax_amt {
2279 val.validate()?
2280 }
2281 if let Some(ref vec) = self.rcrd {
2282 for item in vec {
2283 item.validate()?
2284 }
2285 }
2286 Ok(())
2287 }
2288}
2289
2290#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2292pub struct ChargesRecord31 {
2293 #[serde(rename = "Amt")]
2294 pub amt: ActiveOrHistoricCurrencyAndAmount,
2295 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2296 pub cdt_dbt_ind: Option<CreditDebitCode>,
2297 #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2298 pub chrg_incl_ind: Option<bool>,
2299 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2300 pub tp: Option<ChargeType3Choice1>,
2301 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2302 pub rate: Option<f64>,
2303 #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2304 pub br: Option<ChargeBearerType1Code>,
2305 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2306 pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
2307 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2308 pub tax: Option<TaxCharges21>,
2309}
2310
2311impl ChargesRecord31 {
2312 pub fn validate(&self) -> Result<(), ValidationError> {
2313 self.amt.validate()?;
2314 if let Some(ref val) = self.cdt_dbt_ind {
2315 val.validate()?
2316 }
2317 if let Some(ref val) = self.tp {
2318 val.validate()?
2319 }
2320 if let Some(ref val) = self.br {
2321 val.validate()?
2322 }
2323 if let Some(ref val) = self.agt {
2324 val.validate()?
2325 }
2326 if let Some(ref val) = self.tax {
2327 val.validate()?
2328 }
2329 Ok(())
2330 }
2331}
2332
2333#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2335pub struct ChargesRecord32 {
2336 #[serde(rename = "Amt")]
2337 pub amt: ActiveOrHistoricCurrencyAndAmount,
2338 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2339 pub cdt_dbt_ind: Option<CreditDebitCode>,
2340 #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2341 pub chrg_incl_ind: Option<bool>,
2342 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2343 pub tp: Option<ChargeType3Choice1>,
2344 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2345 pub rate: Option<f64>,
2346 #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2347 pub br: Option<ChargeBearerType1Code>,
2348 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2349 pub agt: Option<BranchAndFinancialInstitutionIdentification63>,
2350 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2351 pub tax: Option<TaxCharges21>,
2352}
2353
2354impl ChargesRecord32 {
2355 pub fn validate(&self) -> Result<(), ValidationError> {
2356 self.amt.validate()?;
2357 if let Some(ref val) = self.cdt_dbt_ind {
2358 val.validate()?
2359 }
2360 if let Some(ref val) = self.tp {
2361 val.validate()?
2362 }
2363 if let Some(ref val) = self.br {
2364 val.validate()?
2365 }
2366 if let Some(ref val) = self.agt {
2367 val.validate()?
2368 }
2369 if let Some(ref val) = self.tax {
2370 val.validate()?
2371 }
2372 Ok(())
2373 }
2374}
2375
2376#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2378pub struct ClearingSystemIdentification2Choice {
2379 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2380 pub cd: Option<String>,
2381 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2382 pub prtry: Option<String>,
2383}
2384
2385impl ClearingSystemIdentification2Choice {
2386 pub fn validate(&self) -> Result<(), ValidationError> {
2387 if let Some(ref val) = self.cd {
2388 if val.chars().count() < 1 {
2389 return Err(ValidationError::new(
2390 1001,
2391 "cd is shorter than the minimum length of 1".to_string(),
2392 ));
2393 }
2394 if val.chars().count() > 5 {
2395 return Err(ValidationError::new(
2396 1002,
2397 "cd exceeds the maximum length of 5".to_string(),
2398 ));
2399 }
2400 }
2401 if let Some(ref val) = self.prtry {
2402 if val.chars().count() < 1 {
2403 return Err(ValidationError::new(
2404 1001,
2405 "prtry is shorter than the minimum length of 1".to_string(),
2406 ));
2407 }
2408 if val.chars().count() > 35 {
2409 return Err(ValidationError::new(
2410 1002,
2411 "prtry exceeds the maximum length of 35".to_string(),
2412 ));
2413 }
2414 }
2415 Ok(())
2416 }
2417}
2418
2419#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2421pub struct ClearingSystemIdentification2Choice1 {
2422 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2423 pub cd: Option<String>,
2424}
2425
2426impl ClearingSystemIdentification2Choice1 {
2427 pub fn validate(&self) -> Result<(), ValidationError> {
2428 if let Some(ref val) = self.cd {
2429 if val.chars().count() < 1 {
2430 return Err(ValidationError::new(
2431 1001,
2432 "cd is shorter than the minimum length of 1".to_string(),
2433 ));
2434 }
2435 if val.chars().count() > 5 {
2436 return Err(ValidationError::new(
2437 1002,
2438 "cd exceeds the maximum length of 5".to_string(),
2439 ));
2440 }
2441 }
2442 Ok(())
2443 }
2444}
2445
2446#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2448pub struct ClearingSystemIdentification2Choice2 {
2449 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2450 pub cd: Option<String>,
2451 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2452 pub prtry: Option<String>,
2453}
2454
2455impl ClearingSystemIdentification2Choice2 {
2456 pub fn validate(&self) -> Result<(), ValidationError> {
2457 if let Some(ref val) = self.cd {
2458 if val.chars().count() < 1 {
2459 return Err(ValidationError::new(
2460 1001,
2461 "cd is shorter than the minimum length of 1".to_string(),
2462 ));
2463 }
2464 if val.chars().count() > 5 {
2465 return Err(ValidationError::new(
2466 1002,
2467 "cd exceeds the maximum length of 5".to_string(),
2468 ));
2469 }
2470 }
2471 if let Some(ref val) = self.prtry {
2472 if val.chars().count() < 1 {
2473 return Err(ValidationError::new(
2474 1001,
2475 "prtry is shorter than the minimum length of 1".to_string(),
2476 ));
2477 }
2478 if val.chars().count() > 35 {
2479 return Err(ValidationError::new(
2480 1002,
2481 "prtry exceeds the maximum length of 35".to_string(),
2482 ));
2483 }
2484 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2485 if !pattern.is_match(val) {
2486 return Err(ValidationError::new(
2487 1005,
2488 "prtry does not match the required pattern".to_string(),
2489 ));
2490 }
2491 }
2492 Ok(())
2493 }
2494}
2495
2496#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2498pub struct ClearingSystemMemberIdentification2 {
2499 #[serde(rename = "ClrSysId", skip_serializing_if = "Option::is_none")]
2500 pub clr_sys_id: Option<ClearingSystemIdentification2Choice>,
2501 #[serde(rename = "MmbId")]
2502 pub mmb_id: String,
2503}
2504
2505impl ClearingSystemMemberIdentification2 {
2506 pub fn validate(&self) -> Result<(), ValidationError> {
2507 if let Some(ref val) = self.clr_sys_id {
2508 val.validate()?
2509 }
2510 if self.mmb_id.chars().count() < 1 {
2511 return Err(ValidationError::new(
2512 1001,
2513 "mmb_id is shorter than the minimum length of 1".to_string(),
2514 ));
2515 }
2516 if self.mmb_id.chars().count() > 35 {
2517 return Err(ValidationError::new(
2518 1002,
2519 "mmb_id exceeds the maximum length of 35".to_string(),
2520 ));
2521 }
2522 Ok(())
2523 }
2524}
2525
2526#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2528pub struct ClearingSystemMemberIdentification21 {
2529 #[serde(rename = "ClrSysId")]
2530 pub clr_sys_id: ClearingSystemIdentification2Choice1,
2531 #[serde(rename = "MmbId")]
2532 pub mmb_id: String,
2533}
2534
2535impl ClearingSystemMemberIdentification21 {
2536 pub fn validate(&self) -> Result<(), ValidationError> {
2537 self.clr_sys_id.validate()?;
2538 if self.mmb_id.chars().count() < 1 {
2539 return Err(ValidationError::new(
2540 1001,
2541 "mmb_id is shorter than the minimum length of 1".to_string(),
2542 ));
2543 }
2544 if self.mmb_id.chars().count() > 28 {
2545 return Err(ValidationError::new(
2546 1002,
2547 "mmb_id exceeds the maximum length of 28".to_string(),
2548 ));
2549 }
2550 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2551 if !pattern.is_match(&self.mmb_id) {
2552 return Err(ValidationError::new(
2553 1005,
2554 "mmb_id does not match the required pattern".to_string(),
2555 ));
2556 }
2557 Ok(())
2558 }
2559}
2560
2561#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2563pub struct ClearingSystemMemberIdentification22 {
2564 #[serde(rename = "ClrSysId")]
2565 pub clr_sys_id: ClearingSystemIdentification2Choice2,
2566 #[serde(rename = "MmbId")]
2567 pub mmb_id: String,
2568}
2569
2570impl ClearingSystemMemberIdentification22 {
2571 pub fn validate(&self) -> Result<(), ValidationError> {
2572 self.clr_sys_id.validate()?;
2573 if self.mmb_id.chars().count() < 1 {
2574 return Err(ValidationError::new(
2575 1001,
2576 "mmb_id is shorter than the minimum length of 1".to_string(),
2577 ));
2578 }
2579 if self.mmb_id.chars().count() > 28 {
2580 return Err(ValidationError::new(
2581 1002,
2582 "mmb_id exceeds the maximum length of 28".to_string(),
2583 ));
2584 }
2585 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2586 if !pattern.is_match(&self.mmb_id) {
2587 return Err(ValidationError::new(
2588 1005,
2589 "mmb_id does not match the required pattern".to_string(),
2590 ));
2591 }
2592 Ok(())
2593 }
2594}
2595
2596#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2598pub struct Contact41 {
2599 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2600 pub nm: Option<String>,
2601}
2602
2603impl Contact41 {
2604 pub fn validate(&self) -> Result<(), ValidationError> {
2605 if let Some(ref val) = self.nm {
2606 if val.chars().count() < 1 {
2607 return Err(ValidationError::new(
2608 1001,
2609 "nm is shorter than the minimum length of 1".to_string(),
2610 ));
2611 }
2612 if val.chars().count() > 140 {
2613 return Err(ValidationError::new(
2614 1002,
2615 "nm exceeds the maximum length of 140".to_string(),
2616 ));
2617 }
2618 let pattern = Regex::new(
2619 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2620 )
2621 .unwrap();
2622 if !pattern.is_match(val) {
2623 return Err(ValidationError::new(
2624 1005,
2625 "nm does not match the required pattern".to_string(),
2626 ));
2627 }
2628 }
2629 Ok(())
2630 }
2631}
2632
2633#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2635pub struct Contact42 {
2636 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2637 pub nm: Option<String>,
2638 #[serde(rename = "PrefrdMtd", skip_serializing_if = "Option::is_none")]
2639 pub prefrd_mtd: Option<PreferredContactMethod1Code>,
2640}
2641
2642impl Contact42 {
2643 pub fn validate(&self) -> Result<(), ValidationError> {
2644 if let Some(ref val) = self.nm {
2645 if val.chars().count() < 1 {
2646 return Err(ValidationError::new(
2647 1001,
2648 "nm is shorter than the minimum length of 1".to_string(),
2649 ));
2650 }
2651 if val.chars().count() > 140 {
2652 return Err(ValidationError::new(
2653 1002,
2654 "nm exceeds the maximum length of 140".to_string(),
2655 ));
2656 }
2657 let pattern = Regex::new(
2658 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2659 )
2660 .unwrap();
2661 if !pattern.is_match(val) {
2662 return Err(ValidationError::new(
2663 1005,
2664 "nm does not match the required pattern".to_string(),
2665 ));
2666 }
2667 }
2668 if let Some(ref val) = self.prefrd_mtd {
2669 val.validate()?
2670 }
2671 Ok(())
2672 }
2673}
2674
2675#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2677pub struct Contact43 {
2678 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2679 pub nm: Option<String>,
2680}
2681
2682impl Contact43 {
2683 pub fn validate(&self) -> Result<(), ValidationError> {
2684 if let Some(ref val) = self.nm {
2685 if val.chars().count() < 1 {
2686 return Err(ValidationError::new(
2687 1001,
2688 "nm is shorter than the minimum length of 1".to_string(),
2689 ));
2690 }
2691 if val.chars().count() > 140 {
2692 return Err(ValidationError::new(
2693 1002,
2694 "nm exceeds the maximum length of 140".to_string(),
2695 ));
2696 }
2697 }
2698 Ok(())
2699 }
2700}
2701
2702#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2704pub enum CopyDuplicate1Code {
2705 #[default]
2706 #[serde(rename = "CODU")]
2707 CodeCODU,
2708 #[serde(rename = "COPY")]
2709 CodeCOPY,
2710 #[serde(rename = "DUPL")]
2711 CodeDUPL,
2712}
2713
2714impl CopyDuplicate1Code {
2715 pub fn validate(&self) -> Result<(), ValidationError> {
2716 Ok(())
2717 }
2718}
2719
2720#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2722pub struct CorporateAction91 {
2723 #[serde(rename = "EvtTp")]
2724 pub evt_tp: String,
2725 #[serde(rename = "EvtId")]
2726 pub evt_id: String,
2727}
2728
2729impl CorporateAction91 {
2730 pub fn validate(&self) -> Result<(), ValidationError> {
2731 if self.evt_tp.chars().count() < 1 {
2732 return Err(ValidationError::new(
2733 1001,
2734 "evt_tp is shorter than the minimum length of 1".to_string(),
2735 ));
2736 }
2737 if self.evt_tp.chars().count() > 35 {
2738 return Err(ValidationError::new(
2739 1002,
2740 "evt_tp exceeds the maximum length of 35".to_string(),
2741 ));
2742 }
2743 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2744 if !pattern.is_match(&self.evt_tp) {
2745 return Err(ValidationError::new(
2746 1005,
2747 "evt_tp does not match the required pattern".to_string(),
2748 ));
2749 }
2750 if self.evt_id.chars().count() < 1 {
2751 return Err(ValidationError::new(
2752 1001,
2753 "evt_id is shorter than the minimum length of 1".to_string(),
2754 ));
2755 }
2756 if self.evt_id.chars().count() > 35 {
2757 return Err(ValidationError::new(
2758 1002,
2759 "evt_id exceeds the maximum length of 35".to_string(),
2760 ));
2761 }
2762 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2763 if !pattern.is_match(&self.evt_id) {
2764 return Err(ValidationError::new(
2765 1005,
2766 "evt_id does not match the required pattern".to_string(),
2767 ));
2768 }
2769 Ok(())
2770 }
2771}
2772
2773#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2775pub enum CreditDebitCode {
2776 #[default]
2777 #[serde(rename = "CRDT")]
2778 CodeCRDT,
2779 #[serde(rename = "DBIT")]
2780 CodeDBIT,
2781}
2782
2783impl CreditDebitCode {
2784 pub fn validate(&self) -> Result<(), ValidationError> {
2785 Ok(())
2786 }
2787}
2788
2789#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2795pub struct CreditorReferenceInformation21 {
2796 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2797 pub tp: Option<CreditorReferenceType21>,
2798 #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
2799 pub ref_attr: Option<String>,
2800}
2801
2802impl CreditorReferenceInformation21 {
2803 pub fn validate(&self) -> Result<(), ValidationError> {
2804 if let Some(ref val) = self.tp {
2805 val.validate()?
2806 }
2807 if let Some(ref val) = self.ref_attr {
2808 if val.chars().count() < 1 {
2809 return Err(ValidationError::new(
2810 1001,
2811 "ref_attr is shorter than the minimum length of 1".to_string(),
2812 ));
2813 }
2814 if val.chars().count() > 35 {
2815 return Err(ValidationError::new(
2816 1002,
2817 "ref_attr exceeds the maximum length of 35".to_string(),
2818 ));
2819 }
2820 let pattern = Regex::new(
2821 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2822 )
2823 .unwrap();
2824 if !pattern.is_match(val) {
2825 return Err(ValidationError::new(
2826 1005,
2827 "ref_attr does not match the required pattern".to_string(),
2828 ));
2829 }
2830 }
2831 Ok(())
2832 }
2833}
2834
2835#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2837pub struct CreditorReferenceType1Choice1 {
2838 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2839 pub cd: Option<DocumentType3Code>,
2840 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2841 pub prtry: Option<String>,
2842}
2843
2844impl CreditorReferenceType1Choice1 {
2845 pub fn validate(&self) -> Result<(), ValidationError> {
2846 if let Some(ref val) = self.cd {
2847 val.validate()?
2848 }
2849 if let Some(ref val) = self.prtry {
2850 if val.chars().count() < 1 {
2851 return Err(ValidationError::new(
2852 1001,
2853 "prtry is shorter than the minimum length of 1".to_string(),
2854 ));
2855 }
2856 if val.chars().count() > 35 {
2857 return Err(ValidationError::new(
2858 1002,
2859 "prtry exceeds the maximum length of 35".to_string(),
2860 ));
2861 }
2862 let pattern = Regex::new(
2863 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2864 )
2865 .unwrap();
2866 if !pattern.is_match(val) {
2867 return Err(ValidationError::new(
2868 1005,
2869 "prtry does not match the required pattern".to_string(),
2870 ));
2871 }
2872 }
2873 Ok(())
2874 }
2875}
2876
2877#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2879pub struct CreditorReferenceType21 {
2880 #[serde(rename = "CdOrPrtry")]
2881 pub cd_or_prtry: CreditorReferenceType1Choice1,
2882 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2883 pub issr: Option<String>,
2884}
2885
2886impl CreditorReferenceType21 {
2887 pub fn validate(&self) -> Result<(), ValidationError> {
2888 self.cd_or_prtry.validate()?;
2889 if let Some(ref val) = self.issr {
2890 if val.chars().count() < 1 {
2891 return Err(ValidationError::new(
2892 1001,
2893 "issr is shorter than the minimum length of 1".to_string(),
2894 ));
2895 }
2896 if val.chars().count() > 35 {
2897 return Err(ValidationError::new(
2898 1002,
2899 "issr exceeds the maximum length of 35".to_string(),
2900 ));
2901 }
2902 let pattern = Regex::new(
2903 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2904 )
2905 .unwrap();
2906 if !pattern.is_match(val) {
2907 return Err(ValidationError::new(
2908 1005,
2909 "issr does not match the required pattern".to_string(),
2910 ));
2911 }
2912 }
2913 Ok(())
2914 }
2915}
2916
2917#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2919pub struct CurrencyExchange51 {
2920 #[serde(rename = "SrcCcy")]
2921 pub src_ccy: String,
2922 #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2923 pub trgt_ccy: Option<String>,
2924 #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2925 pub unit_ccy: Option<String>,
2926 #[serde(rename = "XchgRate")]
2927 pub xchg_rate: f64,
2928 #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2929 pub ctrct_id: Option<String>,
2930 #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2931 pub qtn_dt: Option<String>,
2932}
2933
2934impl CurrencyExchange51 {
2935 pub fn validate(&self) -> Result<(), ValidationError> {
2936 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2937 if !pattern.is_match(&self.src_ccy) {
2938 return Err(ValidationError::new(
2939 1005,
2940 "src_ccy does not match the required pattern".to_string(),
2941 ));
2942 }
2943 if let Some(ref val) = self.trgt_ccy {
2944 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2945 if !pattern.is_match(val) {
2946 return Err(ValidationError::new(
2947 1005,
2948 "trgt_ccy does not match the required pattern".to_string(),
2949 ));
2950 }
2951 }
2952 if let Some(ref val) = self.unit_ccy {
2953 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2954 if !pattern.is_match(val) {
2955 return Err(ValidationError::new(
2956 1005,
2957 "unit_ccy does not match the required pattern".to_string(),
2958 ));
2959 }
2960 }
2961 if let Some(ref val) = self.ctrct_id {
2962 if val.chars().count() < 1 {
2963 return Err(ValidationError::new(
2964 1001,
2965 "ctrct_id is shorter than the minimum length of 1".to_string(),
2966 ));
2967 }
2968 if val.chars().count() > 35 {
2969 return Err(ValidationError::new(
2970 1002,
2971 "ctrct_id exceeds the maximum length of 35".to_string(),
2972 ));
2973 }
2974 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2975 if !pattern.is_match(val) {
2976 return Err(ValidationError::new(
2977 1005,
2978 "ctrct_id does not match the required pattern".to_string(),
2979 ));
2980 }
2981 }
2982 if let Some(ref val) = self.qtn_dt {
2983 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
2984 if !pattern.is_match(val) {
2985 return Err(ValidationError::new(
2986 1005,
2987 "qtn_dt does not match the required pattern".to_string(),
2988 ));
2989 }
2990 }
2991 Ok(())
2992 }
2993}
2994
2995#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2997pub struct DateAndDateTime2Choice1 {
2998 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2999 pub dt: Option<String>,
3000 #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3001 pub dt_tm: Option<String>,
3002}
3003
3004impl DateAndDateTime2Choice1 {
3005 pub fn validate(&self) -> Result<(), ValidationError> {
3006 if let Some(ref val) = self.dt_tm {
3007 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
3008 if !pattern.is_match(val) {
3009 return Err(ValidationError::new(
3010 1005,
3011 "dt_tm does not match the required pattern".to_string(),
3012 ));
3013 }
3014 }
3015 Ok(())
3016 }
3017}
3018
3019#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3021pub struct DateAndDateTime2Choice2 {
3022 #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3023 pub dt_tm: Option<String>,
3024}
3025
3026impl DateAndDateTime2Choice2 {
3027 pub fn validate(&self) -> Result<(), ValidationError> {
3028 if let Some(ref val) = self.dt_tm {
3029 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
3030 if !pattern.is_match(val) {
3031 return Err(ValidationError::new(
3032 1005,
3033 "dt_tm does not match the required pattern".to_string(),
3034 ));
3035 }
3036 }
3037 Ok(())
3038 }
3039}
3040
3041#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3043pub struct DateAndPlaceOfBirth11 {
3044 #[serde(rename = "BirthDt")]
3045 pub birth_dt: String,
3046 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
3047 pub prvc_of_birth: Option<String>,
3048 #[serde(rename = "CityOfBirth")]
3049 pub city_of_birth: String,
3050 #[serde(rename = "CtryOfBirth")]
3051 pub ctry_of_birth: String,
3052}
3053
3054impl DateAndPlaceOfBirth11 {
3055 pub fn validate(&self) -> Result<(), ValidationError> {
3056 if let Some(ref val) = self.prvc_of_birth {
3057 if val.chars().count() < 1 {
3058 return Err(ValidationError::new(
3059 1001,
3060 "prvc_of_birth is shorter than the minimum length of 1".to_string(),
3061 ));
3062 }
3063 if val.chars().count() > 35 {
3064 return Err(ValidationError::new(
3065 1002,
3066 "prvc_of_birth exceeds the maximum length of 35".to_string(),
3067 ));
3068 }
3069 let pattern = Regex::new(
3070 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3071 )
3072 .unwrap();
3073 if !pattern.is_match(val) {
3074 return Err(ValidationError::new(
3075 1005,
3076 "prvc_of_birth does not match the required pattern".to_string(),
3077 ));
3078 }
3079 }
3080 if self.city_of_birth.chars().count() < 1 {
3081 return Err(ValidationError::new(
3082 1001,
3083 "city_of_birth is shorter than the minimum length of 1".to_string(),
3084 ));
3085 }
3086 if self.city_of_birth.chars().count() > 35 {
3087 return Err(ValidationError::new(
3088 1002,
3089 "city_of_birth exceeds the maximum length of 35".to_string(),
3090 ));
3091 }
3092 let pattern =
3093 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
3094 .unwrap();
3095 if !pattern.is_match(&self.city_of_birth) {
3096 return Err(ValidationError::new(
3097 1005,
3098 "city_of_birth does not match the required pattern".to_string(),
3099 ));
3100 }
3101 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
3102 if !pattern.is_match(&self.ctry_of_birth) {
3103 return Err(ValidationError::new(
3104 1005,
3105 "ctry_of_birth does not match the required pattern".to_string(),
3106 ));
3107 }
3108 Ok(())
3109 }
3110}
3111
3112#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3114pub struct DateOrDateTimePeriod1Choice1 {
3115 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3116 pub dt: Option<DatePeriod2>,
3117 #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3118 pub dt_tm: Option<DateTimePeriod11>,
3119}
3120
3121impl DateOrDateTimePeriod1Choice1 {
3122 pub fn validate(&self) -> Result<(), ValidationError> {
3123 if let Some(ref val) = self.dt {
3124 val.validate()?
3125 }
3126 if let Some(ref val) = self.dt_tm {
3127 val.validate()?
3128 }
3129 Ok(())
3130 }
3131}
3132
3133#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3135pub struct DatePeriod2 {
3136 #[serde(rename = "FrDt")]
3137 pub fr_dt: String,
3138 #[serde(rename = "ToDt")]
3139 pub to_dt: String,
3140}
3141
3142impl DatePeriod2 {
3143 pub fn validate(&self) -> Result<(), ValidationError> {
3144 Ok(())
3145 }
3146}
3147
3148#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3150pub struct DateTimePeriod11 {
3151 #[serde(rename = "FrDtTm")]
3152 pub fr_dt_tm: String,
3153 #[serde(rename = "ToDtTm")]
3154 pub to_dt_tm: String,
3155}
3156
3157impl DateTimePeriod11 {
3158 pub fn validate(&self) -> Result<(), ValidationError> {
3159 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
3160 if !pattern.is_match(&self.fr_dt_tm) {
3161 return Err(ValidationError::new(
3162 1005,
3163 "fr_dt_tm does not match the required pattern".to_string(),
3164 ));
3165 }
3166 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
3167 if !pattern.is_match(&self.to_dt_tm) {
3168 return Err(ValidationError::new(
3169 1005,
3170 "to_dt_tm does not match the required pattern".to_string(),
3171 ));
3172 }
3173 Ok(())
3174 }
3175}
3176
3177#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3179pub struct DiscountAmountAndType11 {
3180 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3181 pub tp: Option<DiscountAmountType1Choice1>,
3182 #[serde(rename = "Amt")]
3183 pub amt: ActiveOrHistoricCurrencyAndAmount,
3184}
3185
3186impl DiscountAmountAndType11 {
3187 pub fn validate(&self) -> Result<(), ValidationError> {
3188 if let Some(ref val) = self.tp {
3189 val.validate()?
3190 }
3191 self.amt.validate()?;
3192 Ok(())
3193 }
3194}
3195
3196#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3198pub struct DiscountAmountAndType12 {
3199 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3200 pub tp: Option<DiscountAmountType1Choice2>,
3201 #[serde(rename = "Amt")]
3202 pub amt: ActiveOrHistoricCurrencyAndAmount,
3203}
3204
3205impl DiscountAmountAndType12 {
3206 pub fn validate(&self) -> Result<(), ValidationError> {
3207 if let Some(ref val) = self.tp {
3208 val.validate()?
3209 }
3210 self.amt.validate()?;
3211 Ok(())
3212 }
3213}
3214
3215#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3217pub struct DiscountAmountType1Choice1 {
3218 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3219 pub cd: Option<String>,
3220 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3221 pub prtry: Option<String>,
3222}
3223
3224impl DiscountAmountType1Choice1 {
3225 pub fn validate(&self) -> Result<(), ValidationError> {
3226 if let Some(ref val) = self.cd {
3227 if val.chars().count() < 1 {
3228 return Err(ValidationError::new(
3229 1001,
3230 "cd is shorter than the minimum length of 1".to_string(),
3231 ));
3232 }
3233 if val.chars().count() > 4 {
3234 return Err(ValidationError::new(
3235 1002,
3236 "cd exceeds the maximum length of 4".to_string(),
3237 ));
3238 }
3239 }
3240 if let Some(ref val) = self.prtry {
3241 if val.chars().count() < 1 {
3242 return Err(ValidationError::new(
3243 1001,
3244 "prtry is shorter than the minimum length of 1".to_string(),
3245 ));
3246 }
3247 if val.chars().count() > 35 {
3248 return Err(ValidationError::new(
3249 1002,
3250 "prtry exceeds the maximum length of 35".to_string(),
3251 ));
3252 }
3253 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3254 if !pattern.is_match(val) {
3255 return Err(ValidationError::new(
3256 1005,
3257 "prtry does not match the required pattern".to_string(),
3258 ));
3259 }
3260 }
3261 Ok(())
3262 }
3263}
3264
3265#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3267pub struct DiscountAmountType1Choice2 {
3268 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3269 pub cd: Option<String>,
3270 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3271 pub prtry: Option<String>,
3272}
3273
3274impl DiscountAmountType1Choice2 {
3275 pub fn validate(&self) -> Result<(), ValidationError> {
3276 if let Some(ref val) = self.cd {
3277 if val.chars().count() < 1 {
3278 return Err(ValidationError::new(
3279 1001,
3280 "cd is shorter than the minimum length of 1".to_string(),
3281 ));
3282 }
3283 if val.chars().count() > 4 {
3284 return Err(ValidationError::new(
3285 1002,
3286 "cd exceeds the maximum length of 4".to_string(),
3287 ));
3288 }
3289 }
3290 if let Some(ref val) = self.prtry {
3291 if val.chars().count() < 1 {
3292 return Err(ValidationError::new(
3293 1001,
3294 "prtry is shorter than the minimum length of 1".to_string(),
3295 ));
3296 }
3297 if val.chars().count() > 35 {
3298 return Err(ValidationError::new(
3299 1002,
3300 "prtry exceeds the maximum length of 35".to_string(),
3301 ));
3302 }
3303 let pattern = Regex::new(
3304 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3305 )
3306 .unwrap();
3307 if !pattern.is_match(val) {
3308 return Err(ValidationError::new(
3309 1005,
3310 "prtry does not match the required pattern".to_string(),
3311 ));
3312 }
3313 }
3314 Ok(())
3315 }
3316}
3317
3318#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3320pub struct DisplayCapabilities1 {
3321 #[serde(rename = "DispTp")]
3322 pub disp_tp: UserInterface2Code,
3323 #[serde(rename = "NbOfLines")]
3324 pub nb_of_lines: String,
3325 #[serde(rename = "LineWidth")]
3326 pub line_width: String,
3327}
3328
3329impl DisplayCapabilities1 {
3330 pub fn validate(&self) -> Result<(), ValidationError> {
3331 self.disp_tp.validate()?;
3332 let pattern = Regex::new("[0-9]{1,3}").unwrap();
3333 if !pattern.is_match(&self.nb_of_lines) {
3334 return Err(ValidationError::new(
3335 1005,
3336 "nb_of_lines does not match the required pattern".to_string(),
3337 ));
3338 }
3339 let pattern = Regex::new("[0-9]{1,3}").unwrap();
3340 if !pattern.is_match(&self.line_width) {
3341 return Err(ValidationError::new(
3342 1005,
3343 "line_width does not match the required pattern".to_string(),
3344 ));
3345 }
3346 Ok(())
3347 }
3348}
3349
3350#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3352pub struct DocumentAdjustment11 {
3353 #[serde(rename = "Amt")]
3354 pub amt: ActiveOrHistoricCurrencyAndAmount,
3355 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
3356 pub cdt_dbt_ind: Option<CreditDebitCode>,
3357 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
3358 pub rsn: Option<String>,
3359 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
3360 pub addtl_inf: Option<String>,
3361}
3362
3363impl DocumentAdjustment11 {
3364 pub fn validate(&self) -> Result<(), ValidationError> {
3365 self.amt.validate()?;
3366 if let Some(ref val) = self.cdt_dbt_ind {
3367 val.validate()?
3368 }
3369 if let Some(ref val) = self.rsn {
3370 if val.chars().count() < 1 {
3371 return Err(ValidationError::new(
3372 1001,
3373 "rsn is shorter than the minimum length of 1".to_string(),
3374 ));
3375 }
3376 if val.chars().count() > 4 {
3377 return Err(ValidationError::new(
3378 1002,
3379 "rsn exceeds the maximum length of 4".to_string(),
3380 ));
3381 }
3382 let pattern = Regex::new(
3383 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3384 )
3385 .unwrap();
3386 if !pattern.is_match(val) {
3387 return Err(ValidationError::new(
3388 1005,
3389 "rsn does not match the required pattern".to_string(),
3390 ));
3391 }
3392 }
3393 if let Some(ref val) = self.addtl_inf {
3394 if val.chars().count() < 1 {
3395 return Err(ValidationError::new(
3396 1001,
3397 "addtl_inf is shorter than the minimum length of 1".to_string(),
3398 ));
3399 }
3400 if val.chars().count() > 140 {
3401 return Err(ValidationError::new(
3402 1002,
3403 "addtl_inf exceeds the maximum length of 140".to_string(),
3404 ));
3405 }
3406 let pattern = Regex::new(
3407 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3408 )
3409 .unwrap();
3410 if !pattern.is_match(val) {
3411 return Err(ValidationError::new(
3412 1005,
3413 "addtl_inf does not match the required pattern".to_string(),
3414 ));
3415 }
3416 }
3417 Ok(())
3418 }
3419}
3420
3421#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3423pub struct DocumentLineIdentification11 {
3424 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3425 pub tp: Option<DocumentLineType11>,
3426 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
3427 pub nb: Option<String>,
3428 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
3429 pub rltd_dt: Option<String>,
3430}
3431
3432impl DocumentLineIdentification11 {
3433 pub fn validate(&self) -> Result<(), ValidationError> {
3434 if let Some(ref val) = self.tp {
3435 val.validate()?
3436 }
3437 if let Some(ref val) = self.nb {
3438 if val.chars().count() < 1 {
3439 return Err(ValidationError::new(
3440 1001,
3441 "nb is shorter than the minimum length of 1".to_string(),
3442 ));
3443 }
3444 if val.chars().count() > 35 {
3445 return Err(ValidationError::new(
3446 1002,
3447 "nb exceeds the maximum length of 35".to_string(),
3448 ));
3449 }
3450 let pattern = Regex::new(
3451 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3452 )
3453 .unwrap();
3454 if !pattern.is_match(val) {
3455 return Err(ValidationError::new(
3456 1005,
3457 "nb does not match the required pattern".to_string(),
3458 ));
3459 }
3460 }
3461 Ok(())
3462 }
3463}
3464
3465#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3467pub struct DocumentLineInformation11 {
3468 #[serde(rename = "Id")]
3469 pub id: Vec<DocumentLineIdentification11>,
3470 #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
3471 pub desc: Option<String>,
3472 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
3473 pub amt: Option<RemittanceAmount31>,
3474}
3475
3476impl DocumentLineInformation11 {
3477 pub fn validate(&self) -> Result<(), ValidationError> {
3478 for item in &self.id {
3479 item.validate()?
3480 }
3481 if let Some(ref val) = self.desc {
3482 if val.chars().count() < 1 {
3483 return Err(ValidationError::new(
3484 1001,
3485 "desc is shorter than the minimum length of 1".to_string(),
3486 ));
3487 }
3488 if val.chars().count() > 35 {
3489 return Err(ValidationError::new(
3490 1002,
3491 "desc exceeds the maximum length of 35".to_string(),
3492 ));
3493 }
3494 let pattern = Regex::new(
3495 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3496 )
3497 .unwrap();
3498 if !pattern.is_match(val) {
3499 return Err(ValidationError::new(
3500 1005,
3501 "desc does not match the required pattern".to_string(),
3502 ));
3503 }
3504 }
3505 if let Some(ref val) = self.amt {
3506 val.validate()?
3507 }
3508 Ok(())
3509 }
3510}
3511
3512#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3514pub struct DocumentLineType1Choice1 {
3515 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3516 pub cd: Option<String>,
3517 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3518 pub prtry: Option<String>,
3519}
3520
3521impl DocumentLineType1Choice1 {
3522 pub fn validate(&self) -> Result<(), ValidationError> {
3523 if let Some(ref val) = self.cd {
3524 if val.chars().count() < 1 {
3525 return Err(ValidationError::new(
3526 1001,
3527 "cd is shorter than the minimum length of 1".to_string(),
3528 ));
3529 }
3530 if val.chars().count() > 4 {
3531 return Err(ValidationError::new(
3532 1002,
3533 "cd exceeds the maximum length of 4".to_string(),
3534 ));
3535 }
3536 }
3537 if let Some(ref val) = self.prtry {
3538 if val.chars().count() < 1 {
3539 return Err(ValidationError::new(
3540 1001,
3541 "prtry is shorter than the minimum length of 1".to_string(),
3542 ));
3543 }
3544 if val.chars().count() > 35 {
3545 return Err(ValidationError::new(
3546 1002,
3547 "prtry exceeds the maximum length of 35".to_string(),
3548 ));
3549 }
3550 let pattern = Regex::new(
3551 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3552 )
3553 .unwrap();
3554 if !pattern.is_match(val) {
3555 return Err(ValidationError::new(
3556 1005,
3557 "prtry does not match the required pattern".to_string(),
3558 ));
3559 }
3560 }
3561 Ok(())
3562 }
3563}
3564
3565#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3567pub struct DocumentLineType11 {
3568 #[serde(rename = "CdOrPrtry")]
3569 pub cd_or_prtry: DocumentLineType1Choice1,
3570 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3571 pub issr: Option<String>,
3572}
3573
3574impl DocumentLineType11 {
3575 pub fn validate(&self) -> Result<(), ValidationError> {
3576 self.cd_or_prtry.validate()?;
3577 if let Some(ref val) = self.issr {
3578 if val.chars().count() < 1 {
3579 return Err(ValidationError::new(
3580 1001,
3581 "issr is shorter than the minimum length of 1".to_string(),
3582 ));
3583 }
3584 if val.chars().count() > 35 {
3585 return Err(ValidationError::new(
3586 1002,
3587 "issr exceeds the maximum length of 35".to_string(),
3588 ));
3589 }
3590 let pattern = Regex::new(
3591 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3592 )
3593 .unwrap();
3594 if !pattern.is_match(val) {
3595 return Err(ValidationError::new(
3596 1005,
3597 "issr does not match the required pattern".to_string(),
3598 ));
3599 }
3600 }
3601 Ok(())
3602 }
3603}
3604
3605#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3607pub enum DocumentType3Code {
3608 #[default]
3609 #[serde(rename = "RADM")]
3610 CodeRADM,
3611 #[serde(rename = "RPIN")]
3612 CodeRPIN,
3613 #[serde(rename = "FXDR")]
3614 CodeFXDR,
3615 #[serde(rename = "DISP")]
3616 CodeDISP,
3617 #[serde(rename = "PUOR")]
3618 CodePUOR,
3619 #[serde(rename = "SCOR")]
3620 CodeSCOR,
3621}
3622
3623impl DocumentType3Code {
3624 pub fn validate(&self) -> Result<(), ValidationError> {
3625 Ok(())
3626 }
3627}
3628
3629#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3631pub enum DocumentType6Code {
3632 #[default]
3633 #[serde(rename = "MSIN")]
3634 CodeMSIN,
3635 #[serde(rename = "CNFA")]
3636 CodeCNFA,
3637 #[serde(rename = "DNFA")]
3638 CodeDNFA,
3639 #[serde(rename = "CINV")]
3640 CodeCINV,
3641 #[serde(rename = "CREN")]
3642 CodeCREN,
3643 #[serde(rename = "DEBN")]
3644 CodeDEBN,
3645 #[serde(rename = "HIRI")]
3646 CodeHIRI,
3647 #[serde(rename = "SBIN")]
3648 CodeSBIN,
3649 #[serde(rename = "CMCN")]
3650 CodeCMCN,
3651 #[serde(rename = "SOAC")]
3652 CodeSOAC,
3653 #[serde(rename = "DISP")]
3654 CodeDISP,
3655 #[serde(rename = "BOLD")]
3656 CodeBOLD,
3657 #[serde(rename = "VCHR")]
3658 CodeVCHR,
3659 #[serde(rename = "AROI")]
3660 CodeAROI,
3661 #[serde(rename = "TSUT")]
3662 CodeTSUT,
3663 #[serde(rename = "PUOR")]
3664 CodePUOR,
3665}
3666
3667impl DocumentType6Code {
3668 pub fn validate(&self) -> Result<(), ValidationError> {
3669 Ok(())
3670 }
3671}
3672
3673#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3675pub struct EntryDetails91 {
3676 #[serde(rename = "Btch", skip_serializing_if = "Option::is_none")]
3677 pub btch: Option<BatchInformation21>,
3678 #[serde(rename = "TxDtls", skip_serializing_if = "Option::is_none")]
3679 pub tx_dtls: Option<Vec<EntryTransaction101>>,
3680}
3681
3682impl EntryDetails91 {
3683 pub fn validate(&self) -> Result<(), ValidationError> {
3684 if let Some(ref val) = self.btch {
3685 val.validate()?
3686 }
3687 if let Some(ref vec) = self.tx_dtls {
3688 for item in vec {
3689 item.validate()?
3690 }
3691 }
3692 Ok(())
3693 }
3694}
3695
3696#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3698pub struct EntryStatus1Choice1 {
3699 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3700 pub cd: Option<String>,
3701}
3702
3703impl EntryStatus1Choice1 {
3704 pub fn validate(&self) -> Result<(), ValidationError> {
3705 if let Some(ref val) = self.cd {
3706 if val.chars().count() < 1 {
3707 return Err(ValidationError::new(
3708 1001,
3709 "cd is shorter than the minimum length of 1".to_string(),
3710 ));
3711 }
3712 if val.chars().count() > 4 {
3713 return Err(ValidationError::new(
3714 1002,
3715 "cd exceeds the maximum length of 4".to_string(),
3716 ));
3717 }
3718 }
3719 Ok(())
3720 }
3721}
3722
3723#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3725pub struct EntryTransaction101 {
3726 #[serde(rename = "Refs")]
3727 pub refs: TransactionReferences61,
3728 #[serde(rename = "Amt")]
3729 pub amt: ActiveOrHistoricCurrencyAndAmount,
3730 #[serde(rename = "CdtDbtInd")]
3731 pub cdt_dbt_ind: CreditDebitCode,
3732 #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
3733 pub amt_dtls: Option<AmountAndCurrencyExchange31>,
3734 #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
3735 pub avlbty: Option<Vec<CashAvailability1>>,
3736 #[serde(rename = "BkTxCd", skip_serializing_if = "Option::is_none")]
3737 pub bk_tx_cd: Option<BankTransactionCodeStructure41>,
3738 #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
3739 pub chrgs: Option<Charges62>,
3740 #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
3741 pub intrst: Option<TransactionInterest41>,
3742 #[serde(rename = "RltdPties", skip_serializing_if = "Option::is_none")]
3743 pub rltd_pties: Option<TransactionParties61>,
3744 #[serde(rename = "RltdAgts", skip_serializing_if = "Option::is_none")]
3745 pub rltd_agts: Option<TransactionAgents51>,
3746 #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3747 pub lcl_instrm: Option<LocalInstrument2Choice1>,
3748 #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
3749 pub purp: Option<Purpose2Choice1>,
3750 #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
3751 pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
3752 #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
3753 pub rmt_inf: Option<RemittanceInformation161>,
3754 #[serde(rename = "RltdDts")]
3755 pub rltd_dts: TransactionDates31,
3756 #[serde(rename = "RltdPric", skip_serializing_if = "Option::is_none")]
3757 pub rltd_pric: Option<TransactionPrice4Choice1>,
3758 #[serde(rename = "RltdQties", skip_serializing_if = "Option::is_none")]
3759 pub rltd_qties: Option<Vec<TransactionQuantities3Choice1>>,
3760 #[serde(rename = "FinInstrmId", skip_serializing_if = "Option::is_none")]
3761 pub fin_instrm_id: Option<SecurityIdentification191>,
3762 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
3763 pub tax: Option<TaxInformation81>,
3764 #[serde(rename = "RtrInf", skip_serializing_if = "Option::is_none")]
3765 pub rtr_inf: Option<PaymentReturnReason51>,
3766 #[serde(rename = "CorpActn", skip_serializing_if = "Option::is_none")]
3767 pub corp_actn: Option<CorporateAction91>,
3768 #[serde(rename = "SfkpgAcct", skip_serializing_if = "Option::is_none")]
3769 pub sfkpg_acct: Option<SecuritiesAccount191>,
3770 #[serde(rename = "CshDpst", skip_serializing_if = "Option::is_none")]
3771 pub csh_dpst: Option<Vec<CashDeposit1>>,
3772 #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
3773 pub card_tx: Option<CardTransaction171>,
3774 #[serde(rename = "AddtlTxInf", skip_serializing_if = "Option::is_none")]
3775 pub addtl_tx_inf: Option<String>,
3776}
3777
3778impl EntryTransaction101 {
3779 pub fn validate(&self) -> Result<(), ValidationError> {
3780 self.refs.validate()?;
3781 self.amt.validate()?;
3782 self.cdt_dbt_ind.validate()?;
3783 if let Some(ref val) = self.amt_dtls {
3784 val.validate()?
3785 }
3786 if let Some(ref vec) = self.avlbty {
3787 for item in vec {
3788 item.validate()?
3789 }
3790 }
3791 if let Some(ref val) = self.bk_tx_cd {
3792 val.validate()?
3793 }
3794 if let Some(ref val) = self.chrgs {
3795 val.validate()?
3796 }
3797 if let Some(ref val) = self.intrst {
3798 val.validate()?
3799 }
3800 if let Some(ref val) = self.rltd_pties {
3801 val.validate()?
3802 }
3803 if let Some(ref val) = self.rltd_agts {
3804 val.validate()?
3805 }
3806 if let Some(ref val) = self.lcl_instrm {
3807 val.validate()?
3808 }
3809 if let Some(ref val) = self.purp {
3810 val.validate()?
3811 }
3812 if let Some(ref vec) = self.rltd_rmt_inf {
3813 for item in vec {
3814 item.validate()?
3815 }
3816 }
3817 if let Some(ref val) = self.rmt_inf {
3818 val.validate()?
3819 }
3820 self.rltd_dts.validate()?;
3821 if let Some(ref val) = self.rltd_pric {
3822 val.validate()?
3823 }
3824 if let Some(ref vec) = self.rltd_qties {
3825 for item in vec {
3826 item.validate()?
3827 }
3828 }
3829 if let Some(ref val) = self.fin_instrm_id {
3830 val.validate()?
3831 }
3832 if let Some(ref val) = self.tax {
3833 val.validate()?
3834 }
3835 if let Some(ref val) = self.rtr_inf {
3836 val.validate()?
3837 }
3838 if let Some(ref val) = self.corp_actn {
3839 val.validate()?
3840 }
3841 if let Some(ref val) = self.sfkpg_acct {
3842 val.validate()?
3843 }
3844 if let Some(ref vec) = self.csh_dpst {
3845 for item in vec {
3846 item.validate()?
3847 }
3848 }
3849 if let Some(ref val) = self.card_tx {
3850 val.validate()?
3851 }
3852 if let Some(ref val) = self.addtl_tx_inf {
3853 if val.chars().count() < 1 {
3854 return Err(ValidationError::new(
3855 1001,
3856 "addtl_tx_inf is shorter than the minimum length of 1".to_string(),
3857 ));
3858 }
3859 if val.chars().count() > 500 {
3860 return Err(ValidationError::new(
3861 1002,
3862 "addtl_tx_inf exceeds the maximum length of 500".to_string(),
3863 ));
3864 }
3865 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3866 if !pattern.is_match(val) {
3867 return Err(ValidationError::new(
3868 1005,
3869 "addtl_tx_inf does not match the required pattern".to_string(),
3870 ));
3871 }
3872 }
3873 Ok(())
3874 }
3875}
3876
3877#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3879pub struct FinancialIdentificationSchemeName1Choice1 {
3880 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3881 pub cd: Option<String>,
3882 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3883 pub prtry: Option<String>,
3884}
3885
3886impl FinancialIdentificationSchemeName1Choice1 {
3887 pub fn validate(&self) -> Result<(), ValidationError> {
3888 if let Some(ref val) = self.cd {
3889 if val.chars().count() < 1 {
3890 return Err(ValidationError::new(
3891 1001,
3892 "cd is shorter than the minimum length of 1".to_string(),
3893 ));
3894 }
3895 if val.chars().count() > 4 {
3896 return Err(ValidationError::new(
3897 1002,
3898 "cd exceeds the maximum length of 4".to_string(),
3899 ));
3900 }
3901 }
3902 if let Some(ref val) = self.prtry {
3903 if val.chars().count() < 1 {
3904 return Err(ValidationError::new(
3905 1001,
3906 "prtry is shorter than the minimum length of 1".to_string(),
3907 ));
3908 }
3909 if val.chars().count() > 35 {
3910 return Err(ValidationError::new(
3911 1002,
3912 "prtry exceeds the maximum length of 35".to_string(),
3913 ));
3914 }
3915 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3916 if !pattern.is_match(val) {
3917 return Err(ValidationError::new(
3918 1005,
3919 "prtry does not match the required pattern".to_string(),
3920 ));
3921 }
3922 }
3923 Ok(())
3924 }
3925}
3926
3927#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3929pub struct FinancialInstitutionIdentification181 {
3930 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
3931 pub bicfi: Option<String>,
3932 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
3933 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
3934 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3935 pub lei: Option<String>,
3936 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3937 pub nm: Option<String>,
3938 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3939 pub pstl_adr: Option<PostalAddress242>,
3940 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3941 pub othr: Option<GenericFinancialIdentification11>,
3942}
3943
3944impl FinancialInstitutionIdentification181 {
3945 pub fn validate(&self) -> Result<(), ValidationError> {
3946 if let Some(ref val) = self.bicfi {
3947 let pattern =
3948 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
3949 if !pattern.is_match(val) {
3950 return Err(ValidationError::new(
3951 1005,
3952 "bicfi does not match the required pattern".to_string(),
3953 ));
3954 }
3955 }
3956 if let Some(ref val) = self.clr_sys_mmb_id {
3957 val.validate()?
3958 }
3959 if let Some(ref val) = self.lei {
3960 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
3961 if !pattern.is_match(val) {
3962 return Err(ValidationError::new(
3963 1005,
3964 "lei does not match the required pattern".to_string(),
3965 ));
3966 }
3967 }
3968 if let Some(ref val) = self.nm {
3969 if val.chars().count() < 1 {
3970 return Err(ValidationError::new(
3971 1001,
3972 "nm is shorter than the minimum length of 1".to_string(),
3973 ));
3974 }
3975 if val.chars().count() > 140 {
3976 return Err(ValidationError::new(
3977 1002,
3978 "nm exceeds the maximum length of 140".to_string(),
3979 ));
3980 }
3981 let pattern = Regex::new(
3982 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3983 )
3984 .unwrap();
3985 if !pattern.is_match(val) {
3986 return Err(ValidationError::new(
3987 1005,
3988 "nm does not match the required pattern".to_string(),
3989 ));
3990 }
3991 }
3992 if let Some(ref val) = self.pstl_adr {
3993 val.validate()?
3994 }
3995 if let Some(ref val) = self.othr {
3996 val.validate()?
3997 }
3998 Ok(())
3999 }
4000}
4001
4002#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4004pub struct FinancialInstitutionIdentification182 {
4005 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4006 pub bicfi: Option<String>,
4007 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4008 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
4009 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4010 pub lei: Option<String>,
4011 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4012 pub nm: Option<String>,
4013 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4014 pub pstl_adr: Option<PostalAddress241>,
4015 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4016 pub othr: Option<GenericFinancialIdentification11>,
4017}
4018
4019impl FinancialInstitutionIdentification182 {
4020 pub fn validate(&self) -> Result<(), ValidationError> {
4021 if let Some(ref val) = self.bicfi {
4022 let pattern =
4023 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
4024 if !pattern.is_match(val) {
4025 return Err(ValidationError::new(
4026 1005,
4027 "bicfi does not match the required pattern".to_string(),
4028 ));
4029 }
4030 }
4031 if let Some(ref val) = self.clr_sys_mmb_id {
4032 val.validate()?
4033 }
4034 if let Some(ref val) = self.lei {
4035 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
4036 if !pattern.is_match(val) {
4037 return Err(ValidationError::new(
4038 1005,
4039 "lei does not match the required pattern".to_string(),
4040 ));
4041 }
4042 }
4043 if let Some(ref val) = self.nm {
4044 if val.chars().count() < 1 {
4045 return Err(ValidationError::new(
4046 1001,
4047 "nm is shorter than the minimum length of 1".to_string(),
4048 ));
4049 }
4050 if val.chars().count() > 140 {
4051 return Err(ValidationError::new(
4052 1002,
4053 "nm exceeds the maximum length of 140".to_string(),
4054 ));
4055 }
4056 let pattern = Regex::new(
4057 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4058 )
4059 .unwrap();
4060 if !pattern.is_match(val) {
4061 return Err(ValidationError::new(
4062 1005,
4063 "nm does not match the required pattern".to_string(),
4064 ));
4065 }
4066 }
4067 if let Some(ref val) = self.pstl_adr {
4068 val.validate()?
4069 }
4070 if let Some(ref val) = self.othr {
4071 val.validate()?
4072 }
4073 Ok(())
4074 }
4075}
4076
4077#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4079pub struct FinancialInstitutionIdentification183 {
4080 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4081 pub bicfi: Option<String>,
4082 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4083 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
4084 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4085 pub lei: Option<String>,
4086 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4087 pub nm: Option<String>,
4088 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4089 pub pstl_adr: Option<PostalAddress243>,
4090}
4091
4092impl FinancialInstitutionIdentification183 {
4093 pub fn validate(&self) -> Result<(), ValidationError> {
4094 if let Some(ref val) = self.bicfi {
4095 let pattern =
4096 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
4097 if !pattern.is_match(val) {
4098 return Err(ValidationError::new(
4099 1005,
4100 "bicfi does not match the required pattern".to_string(),
4101 ));
4102 }
4103 }
4104 if let Some(ref val) = self.clr_sys_mmb_id {
4105 val.validate()?
4106 }
4107 if let Some(ref val) = self.lei {
4108 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
4109 if !pattern.is_match(val) {
4110 return Err(ValidationError::new(
4111 1005,
4112 "lei does not match the required pattern".to_string(),
4113 ));
4114 }
4115 }
4116 if let Some(ref val) = self.nm {
4117 if val.chars().count() < 1 {
4118 return Err(ValidationError::new(
4119 1001,
4120 "nm is shorter than the minimum length of 1".to_string(),
4121 ));
4122 }
4123 if val.chars().count() > 140 {
4124 return Err(ValidationError::new(
4125 1002,
4126 "nm exceeds the maximum length of 140".to_string(),
4127 ));
4128 }
4129 let pattern = Regex::new(
4130 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4131 )
4132 .unwrap();
4133 if !pattern.is_match(val) {
4134 return Err(ValidationError::new(
4135 1005,
4136 "nm does not match the required pattern".to_string(),
4137 ));
4138 }
4139 }
4140 if let Some(ref val) = self.pstl_adr {
4141 val.validate()?
4142 }
4143 Ok(())
4144 }
4145}
4146
4147#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4149pub struct FinancialInstitutionIdentification184 {
4150 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4151 pub bicfi: Option<String>,
4152 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4153 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
4154 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4155 pub lei: Option<String>,
4156 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4157 pub nm: Option<String>,
4158 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4159 pub pstl_adr: Option<PostalAddress241>,
4160 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4161 pub othr: Option<GenericFinancialIdentification11>,
4162}
4163
4164impl FinancialInstitutionIdentification184 {
4165 pub fn validate(&self) -> Result<(), ValidationError> {
4166 if let Some(ref val) = self.bicfi {
4167 let pattern =
4168 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
4169 if !pattern.is_match(val) {
4170 return Err(ValidationError::new(
4171 1005,
4172 "bicfi does not match the required pattern".to_string(),
4173 ));
4174 }
4175 }
4176 if let Some(ref val) = self.clr_sys_mmb_id {
4177 val.validate()?
4178 }
4179 if let Some(ref val) = self.lei {
4180 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
4181 if !pattern.is_match(val) {
4182 return Err(ValidationError::new(
4183 1005,
4184 "lei does not match the required pattern".to_string(),
4185 ));
4186 }
4187 }
4188 if let Some(ref val) = self.nm {
4189 if val.chars().count() < 1 {
4190 return Err(ValidationError::new(
4191 1001,
4192 "nm is shorter than the minimum length of 1".to_string(),
4193 ));
4194 }
4195 if val.chars().count() > 140 {
4196 return Err(ValidationError::new(
4197 1002,
4198 "nm exceeds the maximum length of 140".to_string(),
4199 ));
4200 }
4201 let pattern = Regex::new(
4202 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4203 )
4204 .unwrap();
4205 if !pattern.is_match(val) {
4206 return Err(ValidationError::new(
4207 1005,
4208 "nm does not match the required pattern".to_string(),
4209 ));
4210 }
4211 }
4212 if let Some(ref val) = self.pstl_adr {
4213 val.validate()?
4214 }
4215 if let Some(ref val) = self.othr {
4216 val.validate()?
4217 }
4218 Ok(())
4219 }
4220}
4221
4222#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4224pub struct FinancialInstitutionIdentification185 {
4225 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4226 pub bicfi: Option<String>,
4227 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4228 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification2>,
4229 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4230 pub lei: Option<String>,
4231 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4232 pub nm: Option<String>,
4233 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4234 pub pstl_adr: Option<PostalAddress241>,
4235 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4236 pub othr: Option<GenericFinancialIdentification11>,
4237}
4238
4239impl FinancialInstitutionIdentification185 {
4240 pub fn validate(&self) -> Result<(), ValidationError> {
4241 if let Some(ref val) = self.bicfi {
4242 let pattern =
4243 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
4244 if !pattern.is_match(val) {
4245 return Err(ValidationError::new(
4246 1005,
4247 "bicfi does not match the required pattern".to_string(),
4248 ));
4249 }
4250 }
4251 if let Some(ref val) = self.clr_sys_mmb_id {
4252 val.validate()?
4253 }
4254 if let Some(ref val) = self.lei {
4255 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
4256 if !pattern.is_match(val) {
4257 return Err(ValidationError::new(
4258 1005,
4259 "lei does not match the required pattern".to_string(),
4260 ));
4261 }
4262 }
4263 if let Some(ref val) = self.nm {
4264 if val.chars().count() < 1 {
4265 return Err(ValidationError::new(
4266 1001,
4267 "nm is shorter than the minimum length of 1".to_string(),
4268 ));
4269 }
4270 if val.chars().count() > 140 {
4271 return Err(ValidationError::new(
4272 1002,
4273 "nm exceeds the maximum length of 140".to_string(),
4274 ));
4275 }
4276 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4277 if !pattern.is_match(val) {
4278 return Err(ValidationError::new(
4279 1005,
4280 "nm does not match the required pattern".to_string(),
4281 ));
4282 }
4283 }
4284 if let Some(ref val) = self.pstl_adr {
4285 val.validate()?
4286 }
4287 if let Some(ref val) = self.othr {
4288 val.validate()?
4289 }
4290 Ok(())
4291 }
4292}
4293
4294#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4296pub struct FinancialInstitutionIdentification186 {
4297 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
4298 pub bicfi: Option<String>,
4299 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
4300 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
4301 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
4302 pub lei: Option<String>,
4303 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4304 pub nm: Option<String>,
4305 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4306 pub pstl_adr: Option<PostalAddress243>,
4307 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4308 pub othr: Option<GenericFinancialIdentification11>,
4309}
4310
4311impl FinancialInstitutionIdentification186 {
4312 pub fn validate(&self) -> Result<(), ValidationError> {
4313 if let Some(ref val) = self.bicfi {
4314 let pattern =
4315 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
4316 if !pattern.is_match(val) {
4317 return Err(ValidationError::new(
4318 1005,
4319 "bicfi does not match the required pattern".to_string(),
4320 ));
4321 }
4322 }
4323 if let Some(ref val) = self.clr_sys_mmb_id {
4324 val.validate()?
4325 }
4326 if let Some(ref val) = self.lei {
4327 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
4328 if !pattern.is_match(val) {
4329 return Err(ValidationError::new(
4330 1005,
4331 "lei does not match the required pattern".to_string(),
4332 ));
4333 }
4334 }
4335 if let Some(ref val) = self.nm {
4336 if val.chars().count() < 1 {
4337 return Err(ValidationError::new(
4338 1001,
4339 "nm is shorter than the minimum length of 1".to_string(),
4340 ));
4341 }
4342 if val.chars().count() > 140 {
4343 return Err(ValidationError::new(
4344 1002,
4345 "nm exceeds the maximum length of 140".to_string(),
4346 ));
4347 }
4348 let pattern = Regex::new(
4349 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4350 )
4351 .unwrap();
4352 if !pattern.is_match(val) {
4353 return Err(ValidationError::new(
4354 1005,
4355 "nm does not match the required pattern".to_string(),
4356 ));
4357 }
4358 }
4359 if let Some(ref val) = self.pstl_adr {
4360 val.validate()?
4361 }
4362 if let Some(ref val) = self.othr {
4363 val.validate()?
4364 }
4365 Ok(())
4366 }
4367}
4368
4369#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4371pub struct FinancialInstrumentQuantity1Choice {
4372 #[serde(rename = "Unit", skip_serializing_if = "Option::is_none")]
4373 pub unit: Option<f64>,
4374 #[serde(rename = "FaceAmt", skip_serializing_if = "Option::is_none")]
4375 pub face_amt: Option<f64>,
4376 #[serde(rename = "AmtsdVal", skip_serializing_if = "Option::is_none")]
4377 pub amtsd_val: Option<f64>,
4378}
4379
4380impl FinancialInstrumentQuantity1Choice {
4381 pub fn validate(&self) -> Result<(), ValidationError> {
4382 if let Some(ref val) = self.face_amt {
4383 if *val < 0.000000 {
4384 return Err(ValidationError::new(
4385 1003,
4386 "face_amt is less than the minimum value of 0.000000".to_string(),
4387 ));
4388 }
4389 }
4390 if let Some(ref val) = self.amtsd_val {
4391 if *val < 0.000000 {
4392 return Err(ValidationError::new(
4393 1003,
4394 "amtsd_val is less than the minimum value of 0.000000".to_string(),
4395 ));
4396 }
4397 }
4398 Ok(())
4399 }
4400}
4401
4402#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4404pub struct FromToAmountRange1 {
4405 #[serde(rename = "FrAmt")]
4406 pub fr_amt: AmountRangeBoundary1,
4407 #[serde(rename = "ToAmt")]
4408 pub to_amt: AmountRangeBoundary1,
4409}
4410
4411impl FromToAmountRange1 {
4412 pub fn validate(&self) -> Result<(), ValidationError> {
4413 self.fr_amt.validate()?;
4414 self.to_amt.validate()?;
4415 Ok(())
4416 }
4417}
4418
4419#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4421pub struct Garnishment31 {
4422 #[serde(rename = "Tp")]
4423 pub tp: GarnishmentType11,
4424 #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
4425 pub grnshee: Option<PartyIdentification1359>,
4426 #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
4427 pub grnshmt_admstr: Option<PartyIdentification1359>,
4428 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4429 pub ref_nb: Option<String>,
4430 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4431 pub dt: Option<String>,
4432 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4433 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4434 #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
4435 pub fmly_mdcl_insrnc_ind: Option<bool>,
4436 #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
4437 pub mplyee_termntn_ind: Option<bool>,
4438}
4439
4440impl Garnishment31 {
4441 pub fn validate(&self) -> Result<(), ValidationError> {
4442 self.tp.validate()?;
4443 if let Some(ref val) = self.grnshee {
4444 val.validate()?
4445 }
4446 if let Some(ref val) = self.grnshmt_admstr {
4447 val.validate()?
4448 }
4449 if let Some(ref val) = self.ref_nb {
4450 if val.chars().count() < 1 {
4451 return Err(ValidationError::new(
4452 1001,
4453 "ref_nb is shorter than the minimum length of 1".to_string(),
4454 ));
4455 }
4456 if val.chars().count() > 140 {
4457 return Err(ValidationError::new(
4458 1002,
4459 "ref_nb exceeds the maximum length of 140".to_string(),
4460 ));
4461 }
4462 let pattern = Regex::new(
4463 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4464 )
4465 .unwrap();
4466 if !pattern.is_match(val) {
4467 return Err(ValidationError::new(
4468 1005,
4469 "ref_nb does not match the required pattern".to_string(),
4470 ));
4471 }
4472 }
4473 if let Some(ref val) = self.rmtd_amt {
4474 val.validate()?
4475 }
4476 Ok(())
4477 }
4478}
4479
4480#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4482pub struct GarnishmentType1Choice1 {
4483 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4484 pub cd: Option<String>,
4485 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4486 pub prtry: Option<String>,
4487}
4488
4489impl GarnishmentType1Choice1 {
4490 pub fn validate(&self) -> Result<(), ValidationError> {
4491 if let Some(ref val) = self.cd {
4492 if val.chars().count() < 1 {
4493 return Err(ValidationError::new(
4494 1001,
4495 "cd is shorter than the minimum length of 1".to_string(),
4496 ));
4497 }
4498 if val.chars().count() > 4 {
4499 return Err(ValidationError::new(
4500 1002,
4501 "cd exceeds the maximum length of 4".to_string(),
4502 ));
4503 }
4504 }
4505 if let Some(ref val) = self.prtry {
4506 if val.chars().count() < 1 {
4507 return Err(ValidationError::new(
4508 1001,
4509 "prtry is shorter than the minimum length of 1".to_string(),
4510 ));
4511 }
4512 if val.chars().count() > 35 {
4513 return Err(ValidationError::new(
4514 1002,
4515 "prtry exceeds the maximum length of 35".to_string(),
4516 ));
4517 }
4518 let pattern = Regex::new(
4519 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4520 )
4521 .unwrap();
4522 if !pattern.is_match(val) {
4523 return Err(ValidationError::new(
4524 1005,
4525 "prtry does not match the required pattern".to_string(),
4526 ));
4527 }
4528 }
4529 Ok(())
4530 }
4531}
4532
4533#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4535pub struct GarnishmentType11 {
4536 #[serde(rename = "CdOrPrtry")]
4537 pub cd_or_prtry: GarnishmentType1Choice1,
4538 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4539 pub issr: Option<String>,
4540}
4541
4542impl GarnishmentType11 {
4543 pub fn validate(&self) -> Result<(), ValidationError> {
4544 self.cd_or_prtry.validate()?;
4545 if let Some(ref val) = self.issr {
4546 if val.chars().count() < 1 {
4547 return Err(ValidationError::new(
4548 1001,
4549 "issr is shorter than the minimum length of 1".to_string(),
4550 ));
4551 }
4552 if val.chars().count() > 35 {
4553 return Err(ValidationError::new(
4554 1002,
4555 "issr exceeds the maximum length of 35".to_string(),
4556 ));
4557 }
4558 let pattern = Regex::new(
4559 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4560 )
4561 .unwrap();
4562 if !pattern.is_match(val) {
4563 return Err(ValidationError::new(
4564 1005,
4565 "issr does not match the required pattern".to_string(),
4566 ));
4567 }
4568 }
4569 Ok(())
4570 }
4571}
4572
4573#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4575pub struct GenericAccountIdentification11 {
4576 #[serde(rename = "Id")]
4577 pub id: String,
4578 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4579 pub schme_nm: Option<AccountSchemeName1Choice1>,
4580 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4581 pub issr: Option<String>,
4582}
4583
4584impl GenericAccountIdentification11 {
4585 pub fn validate(&self) -> Result<(), ValidationError> {
4586 if self.id.chars().count() < 1 {
4587 return Err(ValidationError::new(
4588 1001,
4589 "id is shorter than the minimum length of 1".to_string(),
4590 ));
4591 }
4592 if self.id.chars().count() > 34 {
4593 return Err(ValidationError::new(
4594 1002,
4595 "id exceeds the maximum length of 34".to_string(),
4596 ));
4597 }
4598 let pattern = Regex::new("([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)").unwrap();
4599 if !pattern.is_match(&self.id) {
4600 return Err(ValidationError::new(
4601 1005,
4602 "id does not match the required pattern".to_string(),
4603 ));
4604 }
4605 if let Some(ref val) = self.schme_nm {
4606 val.validate()?
4607 }
4608 if let Some(ref val) = self.issr {
4609 if val.chars().count() < 1 {
4610 return Err(ValidationError::new(
4611 1001,
4612 "issr is shorter than the minimum length of 1".to_string(),
4613 ));
4614 }
4615 if val.chars().count() > 35 {
4616 return Err(ValidationError::new(
4617 1002,
4618 "issr exceeds the maximum length of 35".to_string(),
4619 ));
4620 }
4621 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4622 if !pattern.is_match(val) {
4623 return Err(ValidationError::new(
4624 1005,
4625 "issr does not match the required pattern".to_string(),
4626 ));
4627 }
4628 }
4629 Ok(())
4630 }
4631}
4632
4633#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4635pub struct GenericFinancialIdentification11 {
4636 #[serde(rename = "Id")]
4637 pub id: String,
4638 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4639 pub schme_nm: Option<FinancialIdentificationSchemeName1Choice1>,
4640 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4641 pub issr: Option<String>,
4642}
4643
4644impl GenericFinancialIdentification11 {
4645 pub fn validate(&self) -> Result<(), ValidationError> {
4646 if self.id.chars().count() < 1 {
4647 return Err(ValidationError::new(
4648 1001,
4649 "id is shorter than the minimum length of 1".to_string(),
4650 ));
4651 }
4652 if self.id.chars().count() > 35 {
4653 return Err(ValidationError::new(
4654 1002,
4655 "id exceeds the maximum length of 35".to_string(),
4656 ));
4657 }
4658 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4659 if !pattern.is_match(&self.id) {
4660 return Err(ValidationError::new(
4661 1005,
4662 "id does not match the required pattern".to_string(),
4663 ));
4664 }
4665 if let Some(ref val) = self.schme_nm {
4666 val.validate()?
4667 }
4668 if let Some(ref val) = self.issr {
4669 if val.chars().count() < 1 {
4670 return Err(ValidationError::new(
4671 1001,
4672 "issr is shorter than the minimum length of 1".to_string(),
4673 ));
4674 }
4675 if val.chars().count() > 35 {
4676 return Err(ValidationError::new(
4677 1002,
4678 "issr exceeds the maximum length of 35".to_string(),
4679 ));
4680 }
4681 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4682 if !pattern.is_match(val) {
4683 return Err(ValidationError::new(
4684 1005,
4685 "issr does not match the required pattern".to_string(),
4686 ));
4687 }
4688 }
4689 Ok(())
4690 }
4691}
4692
4693#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4695pub struct GenericIdentification11 {
4696 #[serde(rename = "Id")]
4697 pub id: String,
4698 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4699 pub schme_nm: Option<String>,
4700 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4701 pub issr: Option<String>,
4702}
4703
4704impl GenericIdentification11 {
4705 pub fn validate(&self) -> Result<(), ValidationError> {
4706 if self.id.chars().count() < 1 {
4707 return Err(ValidationError::new(
4708 1001,
4709 "id is shorter than the minimum length of 1".to_string(),
4710 ));
4711 }
4712 if self.id.chars().count() > 35 {
4713 return Err(ValidationError::new(
4714 1002,
4715 "id exceeds the maximum length of 35".to_string(),
4716 ));
4717 }
4718 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4719 if !pattern.is_match(&self.id) {
4720 return Err(ValidationError::new(
4721 1005,
4722 "id does not match the required pattern".to_string(),
4723 ));
4724 }
4725 if let Some(ref val) = self.schme_nm {
4726 if val.chars().count() < 1 {
4727 return Err(ValidationError::new(
4728 1001,
4729 "schme_nm is shorter than the minimum length of 1".to_string(),
4730 ));
4731 }
4732 if val.chars().count() > 35 {
4733 return Err(ValidationError::new(
4734 1002,
4735 "schme_nm exceeds the maximum length of 35".to_string(),
4736 ));
4737 }
4738 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4739 if !pattern.is_match(val) {
4740 return Err(ValidationError::new(
4741 1005,
4742 "schme_nm does not match the required pattern".to_string(),
4743 ));
4744 }
4745 }
4746 if let Some(ref val) = self.issr {
4747 if val.chars().count() < 1 {
4748 return Err(ValidationError::new(
4749 1001,
4750 "issr is shorter than the minimum length of 1".to_string(),
4751 ));
4752 }
4753 if val.chars().count() > 35 {
4754 return Err(ValidationError::new(
4755 1002,
4756 "issr exceeds the maximum length of 35".to_string(),
4757 ));
4758 }
4759 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4760 if !pattern.is_match(val) {
4761 return Err(ValidationError::new(
4762 1005,
4763 "issr does not match the required pattern".to_string(),
4764 ));
4765 }
4766 }
4767 Ok(())
4768 }
4769}
4770
4771#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4773pub struct GenericIdentification30 {
4774 #[serde(rename = "Id")]
4775 pub id: String,
4776 #[serde(rename = "Issr")]
4777 pub issr: String,
4778 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4779 pub schme_nm: Option<String>,
4780}
4781
4782impl GenericIdentification30 {
4783 pub fn validate(&self) -> Result<(), ValidationError> {
4784 let pattern = Regex::new("[a-zA-Z0-9]{4}").unwrap();
4785 if !pattern.is_match(&self.id) {
4786 return Err(ValidationError::new(
4787 1005,
4788 "id does not match the required pattern".to_string(),
4789 ));
4790 }
4791 if self.issr.chars().count() < 1 {
4792 return Err(ValidationError::new(
4793 1001,
4794 "issr is shorter than the minimum length of 1".to_string(),
4795 ));
4796 }
4797 if self.issr.chars().count() > 35 {
4798 return Err(ValidationError::new(
4799 1002,
4800 "issr exceeds the maximum length of 35".to_string(),
4801 ));
4802 }
4803 if let Some(ref val) = self.schme_nm {
4804 if val.chars().count() < 1 {
4805 return Err(ValidationError::new(
4806 1001,
4807 "schme_nm is shorter than the minimum length of 1".to_string(),
4808 ));
4809 }
4810 if val.chars().count() > 35 {
4811 return Err(ValidationError::new(
4812 1002,
4813 "schme_nm exceeds the maximum length of 35".to_string(),
4814 ));
4815 }
4816 }
4817 Ok(())
4818 }
4819}
4820
4821#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4823pub struct GenericIdentification301 {
4824 #[serde(rename = "Id")]
4825 pub id: String,
4826 #[serde(rename = "Issr")]
4827 pub issr: String,
4828 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4829 pub schme_nm: Option<String>,
4830}
4831
4832impl GenericIdentification301 {
4833 pub fn validate(&self) -> Result<(), ValidationError> {
4834 let pattern = Regex::new("[a-zA-Z0-9]{4}").unwrap();
4835 if !pattern.is_match(&self.id) {
4836 return Err(ValidationError::new(
4837 1005,
4838 "id does not match the required pattern".to_string(),
4839 ));
4840 }
4841 if self.issr.chars().count() < 1 {
4842 return Err(ValidationError::new(
4843 1001,
4844 "issr is shorter than the minimum length of 1".to_string(),
4845 ));
4846 }
4847 if self.issr.chars().count() > 35 {
4848 return Err(ValidationError::new(
4849 1002,
4850 "issr exceeds the maximum length of 35".to_string(),
4851 ));
4852 }
4853 let pattern =
4854 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
4855 .unwrap();
4856 if !pattern.is_match(&self.issr) {
4857 return Err(ValidationError::new(
4858 1005,
4859 "issr does not match the required pattern".to_string(),
4860 ));
4861 }
4862 if let Some(ref val) = self.schme_nm {
4863 if val.chars().count() < 1 {
4864 return Err(ValidationError::new(
4865 1001,
4866 "schme_nm is shorter than the minimum length of 1".to_string(),
4867 ));
4868 }
4869 if val.chars().count() > 35 {
4870 return Err(ValidationError::new(
4871 1002,
4872 "schme_nm exceeds the maximum length of 35".to_string(),
4873 ));
4874 }
4875 let pattern = Regex::new(
4876 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4877 )
4878 .unwrap();
4879 if !pattern.is_match(val) {
4880 return Err(ValidationError::new(
4881 1005,
4882 "schme_nm does not match the required pattern".to_string(),
4883 ));
4884 }
4885 }
4886 Ok(())
4887 }
4888}
4889
4890#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4892pub struct GenericIdentification302 {
4893 #[serde(rename = "Id")]
4894 pub id: String,
4895 #[serde(rename = "Issr")]
4896 pub issr: String,
4897 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4898 pub schme_nm: Option<String>,
4899}
4900
4901impl GenericIdentification302 {
4902 pub fn validate(&self) -> Result<(), ValidationError> {
4903 let pattern = Regex::new("[a-zA-Z0-9]{4}").unwrap();
4904 if !pattern.is_match(&self.id) {
4905 return Err(ValidationError::new(
4906 1005,
4907 "id does not match the required pattern".to_string(),
4908 ));
4909 }
4910 if self.issr.chars().count() < 1 {
4911 return Err(ValidationError::new(
4912 1001,
4913 "issr is shorter than the minimum length of 1".to_string(),
4914 ));
4915 }
4916 if self.issr.chars().count() > 35 {
4917 return Err(ValidationError::new(
4918 1002,
4919 "issr exceeds the maximum length of 35".to_string(),
4920 ));
4921 }
4922 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4923 if !pattern.is_match(&self.issr) {
4924 return Err(ValidationError::new(
4925 1005,
4926 "issr does not match the required pattern".to_string(),
4927 ));
4928 }
4929 if let Some(ref val) = self.schme_nm {
4930 if val.chars().count() < 1 {
4931 return Err(ValidationError::new(
4932 1001,
4933 "schme_nm is shorter than the minimum length of 1".to_string(),
4934 ));
4935 }
4936 if val.chars().count() > 35 {
4937 return Err(ValidationError::new(
4938 1002,
4939 "schme_nm exceeds the maximum length of 35".to_string(),
4940 ));
4941 }
4942 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4943 if !pattern.is_match(val) {
4944 return Err(ValidationError::new(
4945 1005,
4946 "schme_nm does not match the required pattern".to_string(),
4947 ));
4948 }
4949 }
4950 Ok(())
4951 }
4952}
4953
4954#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4956pub struct GenericIdentification321 {
4957 #[serde(rename = "Id")]
4958 pub id: String,
4959 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4960 pub tp: Option<PartyType3Code>,
4961 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4962 pub issr: Option<PartyType4Code>,
4963 #[serde(rename = "ShrtNm", skip_serializing_if = "Option::is_none")]
4964 pub shrt_nm: Option<String>,
4965}
4966
4967impl GenericIdentification321 {
4968 pub fn validate(&self) -> Result<(), ValidationError> {
4969 if self.id.chars().count() < 1 {
4970 return Err(ValidationError::new(
4971 1001,
4972 "id is shorter than the minimum length of 1".to_string(),
4973 ));
4974 }
4975 if self.id.chars().count() > 35 {
4976 return Err(ValidationError::new(
4977 1002,
4978 "id exceeds the maximum length of 35".to_string(),
4979 ));
4980 }
4981 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4982 if !pattern.is_match(&self.id) {
4983 return Err(ValidationError::new(
4984 1005,
4985 "id does not match the required pattern".to_string(),
4986 ));
4987 }
4988 if let Some(ref val) = self.tp {
4989 val.validate()?
4990 }
4991 if let Some(ref val) = self.issr {
4992 val.validate()?
4993 }
4994 if let Some(ref val) = self.shrt_nm {
4995 if val.chars().count() < 1 {
4996 return Err(ValidationError::new(
4997 1001,
4998 "shrt_nm is shorter than the minimum length of 1".to_string(),
4999 ));
5000 }
5001 if val.chars().count() > 35 {
5002 return Err(ValidationError::new(
5003 1002,
5004 "shrt_nm exceeds the maximum length of 35".to_string(),
5005 ));
5006 }
5007 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5008 if !pattern.is_match(val) {
5009 return Err(ValidationError::new(
5010 1005,
5011 "shrt_nm does not match the required pattern".to_string(),
5012 ));
5013 }
5014 }
5015 Ok(())
5016 }
5017}
5018
5019#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5021pub struct GenericIdentification31 {
5022 #[serde(rename = "Id")]
5023 pub id: String,
5024 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5025 pub issr: Option<String>,
5026}
5027
5028impl GenericIdentification31 {
5029 pub fn validate(&self) -> Result<(), ValidationError> {
5030 if self.id.chars().count() < 1 {
5031 return Err(ValidationError::new(
5032 1001,
5033 "id is shorter than the minimum length of 1".to_string(),
5034 ));
5035 }
5036 if self.id.chars().count() > 35 {
5037 return Err(ValidationError::new(
5038 1002,
5039 "id exceeds the maximum length of 35".to_string(),
5040 ));
5041 }
5042 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5043 if !pattern.is_match(&self.id) {
5044 return Err(ValidationError::new(
5045 1005,
5046 "id does not match the required pattern".to_string(),
5047 ));
5048 }
5049 if let Some(ref val) = self.issr {
5050 if val.chars().count() < 1 {
5051 return Err(ValidationError::new(
5052 1001,
5053 "issr is shorter than the minimum length of 1".to_string(),
5054 ));
5055 }
5056 if val.chars().count() > 35 {
5057 return Err(ValidationError::new(
5058 1002,
5059 "issr exceeds the maximum length of 35".to_string(),
5060 ));
5061 }
5062 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5063 if !pattern.is_match(val) {
5064 return Err(ValidationError::new(
5065 1005,
5066 "issr does not match the required pattern".to_string(),
5067 ));
5068 }
5069 }
5070 Ok(())
5071 }
5072}
5073
5074#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5076pub struct GenericOrganisationIdentification11 {
5077 #[serde(rename = "Id")]
5078 pub id: String,
5079 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5080 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
5081 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5082 pub issr: Option<String>,
5083}
5084
5085impl GenericOrganisationIdentification11 {
5086 pub fn validate(&self) -> Result<(), ValidationError> {
5087 if self.id.chars().count() < 1 {
5088 return Err(ValidationError::new(
5089 1001,
5090 "id is shorter than the minimum length of 1".to_string(),
5091 ));
5092 }
5093 if self.id.chars().count() > 35 {
5094 return Err(ValidationError::new(
5095 1002,
5096 "id exceeds the maximum length of 35".to_string(),
5097 ));
5098 }
5099 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5100 if !pattern.is_match(&self.id) {
5101 return Err(ValidationError::new(
5102 1005,
5103 "id does not match the required pattern".to_string(),
5104 ));
5105 }
5106 if let Some(ref val) = self.schme_nm {
5107 val.validate()?
5108 }
5109 if let Some(ref val) = self.issr {
5110 if val.chars().count() < 1 {
5111 return Err(ValidationError::new(
5112 1001,
5113 "issr is shorter than the minimum length of 1".to_string(),
5114 ));
5115 }
5116 if val.chars().count() > 35 {
5117 return Err(ValidationError::new(
5118 1002,
5119 "issr exceeds the maximum length of 35".to_string(),
5120 ));
5121 }
5122 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5123 if !pattern.is_match(val) {
5124 return Err(ValidationError::new(
5125 1005,
5126 "issr does not match the required pattern".to_string(),
5127 ));
5128 }
5129 }
5130 Ok(())
5131 }
5132}
5133
5134#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5136pub struct GenericOrganisationIdentification12 {
5137 #[serde(rename = "Id")]
5138 pub id: String,
5139 #[serde(rename = "SchmeNm")]
5140 pub schme_nm: OrganisationIdentificationSchemeName1Choice1,
5141 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5142 pub issr: Option<String>,
5143}
5144
5145impl GenericOrganisationIdentification12 {
5146 pub fn validate(&self) -> Result<(), ValidationError> {
5147 if self.id.chars().count() < 1 {
5148 return Err(ValidationError::new(
5149 1001,
5150 "id is shorter than the minimum length of 1".to_string(),
5151 ));
5152 }
5153 if self.id.chars().count() > 35 {
5154 return Err(ValidationError::new(
5155 1002,
5156 "id exceeds the maximum length of 35".to_string(),
5157 ));
5158 }
5159 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5160 if !pattern.is_match(&self.id) {
5161 return Err(ValidationError::new(
5162 1005,
5163 "id does not match the required pattern".to_string(),
5164 ));
5165 }
5166 self.schme_nm.validate()?;
5167 if let Some(ref val) = self.issr {
5168 if val.chars().count() < 1 {
5169 return Err(ValidationError::new(
5170 1001,
5171 "issr is shorter than the minimum length of 1".to_string(),
5172 ));
5173 }
5174 if val.chars().count() > 35 {
5175 return Err(ValidationError::new(
5176 1002,
5177 "issr exceeds the maximum length of 35".to_string(),
5178 ));
5179 }
5180 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5181 if !pattern.is_match(val) {
5182 return Err(ValidationError::new(
5183 1005,
5184 "issr does not match the required pattern".to_string(),
5185 ));
5186 }
5187 }
5188 Ok(())
5189 }
5190}
5191
5192#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5194pub struct GenericOrganisationIdentification13 {
5195 #[serde(rename = "Id")]
5196 pub id: String,
5197 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5198 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice2>,
5199 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5200 pub issr: Option<String>,
5201}
5202
5203impl GenericOrganisationIdentification13 {
5204 pub fn validate(&self) -> Result<(), ValidationError> {
5205 if self.id.chars().count() < 1 {
5206 return Err(ValidationError::new(
5207 1001,
5208 "id is shorter than the minimum length of 1".to_string(),
5209 ));
5210 }
5211 if self.id.chars().count() > 35 {
5212 return Err(ValidationError::new(
5213 1002,
5214 "id exceeds the maximum length of 35".to_string(),
5215 ));
5216 }
5217 let pattern =
5218 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
5219 .unwrap();
5220 if !pattern.is_match(&self.id) {
5221 return Err(ValidationError::new(
5222 1005,
5223 "id does not match the required pattern".to_string(),
5224 ));
5225 }
5226 if let Some(ref val) = self.schme_nm {
5227 val.validate()?
5228 }
5229 if let Some(ref val) = self.issr {
5230 if val.chars().count() < 1 {
5231 return Err(ValidationError::new(
5232 1001,
5233 "issr is shorter than the minimum length of 1".to_string(),
5234 ));
5235 }
5236 if val.chars().count() > 35 {
5237 return Err(ValidationError::new(
5238 1002,
5239 "issr exceeds the maximum length of 35".to_string(),
5240 ));
5241 }
5242 let pattern = Regex::new(
5243 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5244 )
5245 .unwrap();
5246 if !pattern.is_match(val) {
5247 return Err(ValidationError::new(
5248 1005,
5249 "issr does not match the required pattern".to_string(),
5250 ));
5251 }
5252 }
5253 Ok(())
5254 }
5255}
5256
5257#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5259pub struct GenericPersonIdentification11 {
5260 #[serde(rename = "Id")]
5261 pub id: String,
5262 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5263 pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
5264 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5265 pub issr: Option<String>,
5266}
5267
5268impl GenericPersonIdentification11 {
5269 pub fn validate(&self) -> Result<(), ValidationError> {
5270 if self.id.chars().count() < 1 {
5271 return Err(ValidationError::new(
5272 1001,
5273 "id is shorter than the minimum length of 1".to_string(),
5274 ));
5275 }
5276 if self.id.chars().count() > 35 {
5277 return Err(ValidationError::new(
5278 1002,
5279 "id exceeds the maximum length of 35".to_string(),
5280 ));
5281 }
5282 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5283 if !pattern.is_match(&self.id) {
5284 return Err(ValidationError::new(
5285 1005,
5286 "id does not match the required pattern".to_string(),
5287 ));
5288 }
5289 if let Some(ref val) = self.schme_nm {
5290 val.validate()?
5291 }
5292 if let Some(ref val) = self.issr {
5293 if val.chars().count() < 1 {
5294 return Err(ValidationError::new(
5295 1001,
5296 "issr is shorter than the minimum length of 1".to_string(),
5297 ));
5298 }
5299 if val.chars().count() > 35 {
5300 return Err(ValidationError::new(
5301 1002,
5302 "issr exceeds the maximum length of 35".to_string(),
5303 ));
5304 }
5305 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5306 if !pattern.is_match(val) {
5307 return Err(ValidationError::new(
5308 1005,
5309 "issr does not match the required pattern".to_string(),
5310 ));
5311 }
5312 }
5313 Ok(())
5314 }
5315}
5316
5317#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5319pub struct GenericPersonIdentification12 {
5320 #[serde(rename = "Id")]
5321 pub id: String,
5322 #[serde(rename = "SchmeNm")]
5323 pub schme_nm: PersonIdentificationSchemeName1Choice1,
5324 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5325 pub issr: Option<String>,
5326}
5327
5328impl GenericPersonIdentification12 {
5329 pub fn validate(&self) -> Result<(), ValidationError> {
5330 if self.id.chars().count() < 1 {
5331 return Err(ValidationError::new(
5332 1001,
5333 "id is shorter than the minimum length of 1".to_string(),
5334 ));
5335 }
5336 if self.id.chars().count() > 35 {
5337 return Err(ValidationError::new(
5338 1002,
5339 "id exceeds the maximum length of 35".to_string(),
5340 ));
5341 }
5342 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5343 if !pattern.is_match(&self.id) {
5344 return Err(ValidationError::new(
5345 1005,
5346 "id does not match the required pattern".to_string(),
5347 ));
5348 }
5349 self.schme_nm.validate()?;
5350 if let Some(ref val) = self.issr {
5351 if val.chars().count() < 1 {
5352 return Err(ValidationError::new(
5353 1001,
5354 "issr is shorter than the minimum length of 1".to_string(),
5355 ));
5356 }
5357 if val.chars().count() > 35 {
5358 return Err(ValidationError::new(
5359 1002,
5360 "issr exceeds the maximum length of 35".to_string(),
5361 ));
5362 }
5363 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5364 if !pattern.is_match(val) {
5365 return Err(ValidationError::new(
5366 1005,
5367 "issr does not match the required pattern".to_string(),
5368 ));
5369 }
5370 }
5371 Ok(())
5372 }
5373}
5374
5375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5377pub struct GenericPersonIdentification13 {
5378 #[serde(rename = "Id")]
5379 pub id: String,
5380 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
5381 pub schme_nm: Option<PersonIdentificationSchemeName1Choice2>,
5382 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
5383 pub issr: Option<String>,
5384}
5385
5386impl GenericPersonIdentification13 {
5387 pub fn validate(&self) -> Result<(), ValidationError> {
5388 if self.id.chars().count() < 1 {
5389 return Err(ValidationError::new(
5390 1001,
5391 "id is shorter than the minimum length of 1".to_string(),
5392 ));
5393 }
5394 if self.id.chars().count() > 35 {
5395 return Err(ValidationError::new(
5396 1002,
5397 "id exceeds the maximum length of 35".to_string(),
5398 ));
5399 }
5400 let pattern =
5401 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
5402 .unwrap();
5403 if !pattern.is_match(&self.id) {
5404 return Err(ValidationError::new(
5405 1005,
5406 "id does not match the required pattern".to_string(),
5407 ));
5408 }
5409 if let Some(ref val) = self.schme_nm {
5410 val.validate()?
5411 }
5412 if let Some(ref val) = self.issr {
5413 if val.chars().count() < 1 {
5414 return Err(ValidationError::new(
5415 1001,
5416 "issr is shorter than the minimum length of 1".to_string(),
5417 ));
5418 }
5419 if val.chars().count() > 35 {
5420 return Err(ValidationError::new(
5421 1002,
5422 "issr exceeds the maximum length of 35".to_string(),
5423 ));
5424 }
5425 let pattern = Regex::new(
5426 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5427 )
5428 .unwrap();
5429 if !pattern.is_match(val) {
5430 return Err(ValidationError::new(
5431 1005,
5432 "issr does not match the required pattern".to_string(),
5433 ));
5434 }
5435 }
5436 Ok(())
5437 }
5438}
5439
5440#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5442pub struct GroupHeader811 {
5443 #[serde(rename = "MsgId")]
5444 pub msg_id: String,
5445 #[serde(rename = "CreDtTm")]
5446 pub cre_dt_tm: String,
5447 #[serde(rename = "MsgRcpt", skip_serializing_if = "Option::is_none")]
5448 pub msg_rcpt: Option<PartyIdentification1351>,
5449 #[serde(rename = "OrgnlBizQry", skip_serializing_if = "Option::is_none")]
5450 pub orgnl_biz_qry: Option<OriginalBusinessQuery11>,
5451 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
5452 pub addtl_inf: Option<String>,
5453}
5454
5455impl GroupHeader811 {
5456 pub fn validate(&self) -> Result<(), ValidationError> {
5457 if self.msg_id.chars().count() < 1 {
5458 return Err(ValidationError::new(
5459 1001,
5460 "msg_id is shorter than the minimum length of 1".to_string(),
5461 ));
5462 }
5463 if self.msg_id.chars().count() > 35 {
5464 return Err(ValidationError::new(
5465 1002,
5466 "msg_id exceeds the maximum length of 35".to_string(),
5467 ));
5468 }
5469 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5470 if !pattern.is_match(&self.msg_id) {
5471 return Err(ValidationError::new(
5472 1005,
5473 "msg_id does not match the required pattern".to_string(),
5474 ));
5475 }
5476 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
5477 if !pattern.is_match(&self.cre_dt_tm) {
5478 return Err(ValidationError::new(
5479 1005,
5480 "cre_dt_tm does not match the required pattern".to_string(),
5481 ));
5482 }
5483 if let Some(ref val) = self.msg_rcpt {
5484 val.validate()?
5485 }
5486 if let Some(ref val) = self.orgnl_biz_qry {
5487 val.validate()?
5488 }
5489 if let Some(ref val) = self.addtl_inf {
5490 if val.chars().count() < 1 {
5491 return Err(ValidationError::new(
5492 1001,
5493 "addtl_inf is shorter than the minimum length of 1".to_string(),
5494 ));
5495 }
5496 if val.chars().count() > 500 {
5497 return Err(ValidationError::new(
5498 1002,
5499 "addtl_inf exceeds the maximum length of 500".to_string(),
5500 ));
5501 }
5502 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5503 if !pattern.is_match(val) {
5504 return Err(ValidationError::new(
5505 1005,
5506 "addtl_inf does not match the required pattern".to_string(),
5507 ));
5508 }
5509 }
5510 Ok(())
5511 }
5512}
5513
5514#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5516pub struct IdentificationSource3Choice1 {
5517 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5518 pub cd: Option<String>,
5519 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5520 pub prtry: Option<String>,
5521}
5522
5523impl IdentificationSource3Choice1 {
5524 pub fn validate(&self) -> Result<(), ValidationError> {
5525 if let Some(ref val) = self.cd {
5526 if val.chars().count() < 1 {
5527 return Err(ValidationError::new(
5528 1001,
5529 "cd is shorter than the minimum length of 1".to_string(),
5530 ));
5531 }
5532 if val.chars().count() > 4 {
5533 return Err(ValidationError::new(
5534 1002,
5535 "cd exceeds the maximum length of 4".to_string(),
5536 ));
5537 }
5538 }
5539 if let Some(ref val) = self.prtry {
5540 if val.chars().count() < 1 {
5541 return Err(ValidationError::new(
5542 1001,
5543 "prtry is shorter than the minimum length of 1".to_string(),
5544 ));
5545 }
5546 if val.chars().count() > 35 {
5547 return Err(ValidationError::new(
5548 1002,
5549 "prtry exceeds the maximum length of 35".to_string(),
5550 ));
5551 }
5552 let pattern = Regex::new(
5553 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5554 )
5555 .unwrap();
5556 if !pattern.is_match(val) {
5557 return Err(ValidationError::new(
5558 1005,
5559 "prtry does not match the required pattern".to_string(),
5560 ));
5561 }
5562 }
5563 Ok(())
5564 }
5565}
5566
5567#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5569pub struct ImpliedCurrencyAmountRange1Choice {
5570 #[serde(rename = "FrAmt", skip_serializing_if = "Option::is_none")]
5571 pub fr_amt: Option<AmountRangeBoundary1>,
5572 #[serde(rename = "ToAmt", skip_serializing_if = "Option::is_none")]
5573 pub to_amt: Option<AmountRangeBoundary1>,
5574 #[serde(rename = "FrToAmt", skip_serializing_if = "Option::is_none")]
5575 pub fr_to_amt: Option<FromToAmountRange1>,
5576 #[serde(rename = "EQAmt", skip_serializing_if = "Option::is_none")]
5577 pub eq_amt: Option<f64>,
5578 #[serde(rename = "NEQAmt", skip_serializing_if = "Option::is_none")]
5579 pub neq_amt: Option<f64>,
5580}
5581
5582impl ImpliedCurrencyAmountRange1Choice {
5583 pub fn validate(&self) -> Result<(), ValidationError> {
5584 if let Some(ref val) = self.fr_amt {
5585 val.validate()?
5586 }
5587 if let Some(ref val) = self.to_amt {
5588 val.validate()?
5589 }
5590 if let Some(ref val) = self.fr_to_amt {
5591 val.validate()?
5592 }
5593 if let Some(ref val) = self.eq_amt {
5594 if *val < 0.000000 {
5595 return Err(ValidationError::new(
5596 1003,
5597 "eq_amt is less than the minimum value of 0.000000".to_string(),
5598 ));
5599 }
5600 }
5601 if let Some(ref val) = self.neq_amt {
5602 if *val < 0.000000 {
5603 return Err(ValidationError::new(
5604 1003,
5605 "neq_amt is less than the minimum value of 0.000000".to_string(),
5606 ));
5607 }
5608 }
5609 Ok(())
5610 }
5611}
5612
5613#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5615pub struct InterestRecord21 {
5616 #[serde(rename = "Amt")]
5617 pub amt: ActiveOrHistoricCurrencyAndAmount,
5618 #[serde(rename = "CdtDbtInd")]
5619 pub cdt_dbt_ind: CreditDebitCode,
5620 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5621 pub tp: Option<InterestType1Choice1>,
5622 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
5623 pub rate: Option<Rate41>,
5624 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5625 pub fr_to_dt: Option<DateTimePeriod11>,
5626 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
5627 pub rsn: Option<String>,
5628 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
5629 pub tax: Option<TaxCharges21>,
5630}
5631
5632impl InterestRecord21 {
5633 pub fn validate(&self) -> Result<(), ValidationError> {
5634 self.amt.validate()?;
5635 self.cdt_dbt_ind.validate()?;
5636 if let Some(ref val) = self.tp {
5637 val.validate()?
5638 }
5639 if let Some(ref val) = self.rate {
5640 val.validate()?
5641 }
5642 if let Some(ref val) = self.fr_to_dt {
5643 val.validate()?
5644 }
5645 if let Some(ref val) = self.rsn {
5646 if val.chars().count() < 1 {
5647 return Err(ValidationError::new(
5648 1001,
5649 "rsn is shorter than the minimum length of 1".to_string(),
5650 ));
5651 }
5652 if val.chars().count() > 35 {
5653 return Err(ValidationError::new(
5654 1002,
5655 "rsn exceeds the maximum length of 35".to_string(),
5656 ));
5657 }
5658 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5659 if !pattern.is_match(val) {
5660 return Err(ValidationError::new(
5661 1005,
5662 "rsn does not match the required pattern".to_string(),
5663 ));
5664 }
5665 }
5666 if let Some(ref val) = self.tax {
5667 val.validate()?
5668 }
5669 Ok(())
5670 }
5671}
5672
5673#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5675pub struct InterestType1Choice1 {
5676 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5677 pub cd: Option<InterestType1Code>,
5678 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5679 pub prtry: Option<String>,
5680}
5681
5682impl InterestType1Choice1 {
5683 pub fn validate(&self) -> Result<(), ValidationError> {
5684 if let Some(ref val) = self.cd {
5685 val.validate()?
5686 }
5687 if let Some(ref val) = self.prtry {
5688 if val.chars().count() < 1 {
5689 return Err(ValidationError::new(
5690 1001,
5691 "prtry is shorter than the minimum length of 1".to_string(),
5692 ));
5693 }
5694 if val.chars().count() > 35 {
5695 return Err(ValidationError::new(
5696 1002,
5697 "prtry exceeds the maximum length of 35".to_string(),
5698 ));
5699 }
5700 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5701 if !pattern.is_match(val) {
5702 return Err(ValidationError::new(
5703 1005,
5704 "prtry does not match the required pattern".to_string(),
5705 ));
5706 }
5707 }
5708 Ok(())
5709 }
5710}
5711
5712#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5714pub enum InterestType1Code {
5715 #[default]
5716 #[serde(rename = "INDY")]
5717 CodeINDY,
5718 #[serde(rename = "OVRN")]
5719 CodeOVRN,
5720}
5721
5722impl InterestType1Code {
5723 pub fn validate(&self) -> Result<(), ValidationError> {
5724 Ok(())
5725 }
5726}
5727
5728#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5730pub struct LocalInstrument2Choice1 {
5731 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5732 pub cd: Option<String>,
5733 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5734 pub prtry: Option<String>,
5735}
5736
5737impl LocalInstrument2Choice1 {
5738 pub fn validate(&self) -> Result<(), ValidationError> {
5739 if let Some(ref val) = self.cd {
5740 if val.chars().count() < 1 {
5741 return Err(ValidationError::new(
5742 1001,
5743 "cd is shorter than the minimum length of 1".to_string(),
5744 ));
5745 }
5746 if val.chars().count() > 35 {
5747 return Err(ValidationError::new(
5748 1002,
5749 "cd exceeds the maximum length of 35".to_string(),
5750 ));
5751 }
5752 }
5753 if let Some(ref val) = self.prtry {
5754 if val.chars().count() < 1 {
5755 return Err(ValidationError::new(
5756 1001,
5757 "prtry is shorter than the minimum length of 1".to_string(),
5758 ));
5759 }
5760 if val.chars().count() > 35 {
5761 return Err(ValidationError::new(
5762 1002,
5763 "prtry exceeds the maximum length of 35".to_string(),
5764 ));
5765 }
5766 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5767 if !pattern.is_match(val) {
5768 return Err(ValidationError::new(
5769 1005,
5770 "prtry does not match the required pattern".to_string(),
5771 ));
5772 }
5773 }
5774 Ok(())
5775 }
5776}
5777
5778#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5780pub struct MessageIdentification21 {
5781 #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5782 pub msg_nm_id: Option<String>,
5783 #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
5784 pub msg_id: Option<String>,
5785}
5786
5787impl MessageIdentification21 {
5788 pub fn validate(&self) -> Result<(), ValidationError> {
5789 if let Some(ref val) = self.msg_nm_id {
5790 if val.chars().count() < 1 {
5791 return Err(ValidationError::new(
5792 1001,
5793 "msg_nm_id is shorter than the minimum length of 1".to_string(),
5794 ));
5795 }
5796 if val.chars().count() > 35 {
5797 return Err(ValidationError::new(
5798 1002,
5799 "msg_nm_id exceeds the maximum length of 35".to_string(),
5800 ));
5801 }
5802 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5803 if !pattern.is_match(val) {
5804 return Err(ValidationError::new(
5805 1005,
5806 "msg_nm_id does not match the required pattern".to_string(),
5807 ));
5808 }
5809 }
5810 if let Some(ref val) = self.msg_id {
5811 if val.chars().count() < 1 {
5812 return Err(ValidationError::new(
5813 1001,
5814 "msg_id is shorter than the minimum length of 1".to_string(),
5815 ));
5816 }
5817 if val.chars().count() > 35 {
5818 return Err(ValidationError::new(
5819 1002,
5820 "msg_id exceeds the maximum length of 35".to_string(),
5821 ));
5822 }
5823 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5824 if !pattern.is_match(val) {
5825 return Err(ValidationError::new(
5826 1005,
5827 "msg_id does not match the required pattern".to_string(),
5828 ));
5829 }
5830 }
5831 Ok(())
5832 }
5833}
5834
5835#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5837pub struct NameAndAddress161 {
5838 #[serde(rename = "Nm")]
5839 pub nm: String,
5840 #[serde(rename = "Adr")]
5841 pub adr: PostalAddress241,
5842}
5843
5844impl NameAndAddress161 {
5845 pub fn validate(&self) -> Result<(), ValidationError> {
5846 if self.nm.chars().count() < 1 {
5847 return Err(ValidationError::new(
5848 1001,
5849 "nm is shorter than the minimum length of 1".to_string(),
5850 ));
5851 }
5852 if self.nm.chars().count() > 140 {
5853 return Err(ValidationError::new(
5854 1002,
5855 "nm exceeds the maximum length of 140".to_string(),
5856 ));
5857 }
5858 let pattern =
5859 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
5860 .unwrap();
5861 if !pattern.is_match(&self.nm) {
5862 return Err(ValidationError::new(
5863 1005,
5864 "nm does not match the required pattern".to_string(),
5865 ));
5866 }
5867 self.adr.validate()?;
5868 Ok(())
5869 }
5870}
5871
5872#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5874pub struct NumberAndSumOfTransactions1 {
5875 #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5876 pub nb_of_ntries: Option<String>,
5877 #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5878 pub sum: Option<f64>,
5879}
5880
5881impl NumberAndSumOfTransactions1 {
5882 pub fn validate(&self) -> Result<(), ValidationError> {
5883 if let Some(ref val) = self.nb_of_ntries {
5884 let pattern = Regex::new("[0-9]{1,15}").unwrap();
5885 if !pattern.is_match(val) {
5886 return Err(ValidationError::new(
5887 1005,
5888 "nb_of_ntries does not match the required pattern".to_string(),
5889 ));
5890 }
5891 }
5892 Ok(())
5893 }
5894}
5895
5896#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5898pub struct NumberAndSumOfTransactions4 {
5899 #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5900 pub nb_of_ntries: Option<String>,
5901 #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5902 pub sum: Option<f64>,
5903 #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
5904 pub ttl_net_ntry: Option<AmountAndDirection35>,
5905}
5906
5907impl NumberAndSumOfTransactions4 {
5908 pub fn validate(&self) -> Result<(), ValidationError> {
5909 if let Some(ref val) = self.nb_of_ntries {
5910 let pattern = Regex::new("[0-9]{1,15}").unwrap();
5911 if !pattern.is_match(val) {
5912 return Err(ValidationError::new(
5913 1005,
5914 "nb_of_ntries does not match the required pattern".to_string(),
5915 ));
5916 }
5917 }
5918 if let Some(ref val) = self.ttl_net_ntry {
5919 val.validate()?
5920 }
5921 Ok(())
5922 }
5923}
5924
5925#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5927pub enum OnLineCapability1Code {
5928 #[default]
5929 #[serde(rename = "OFLN")]
5930 CodeOFLN,
5931 #[serde(rename = "ONLN")]
5932 CodeONLN,
5933 #[serde(rename = "SMON")]
5934 CodeSMON,
5935}
5936
5937impl OnLineCapability1Code {
5938 pub fn validate(&self) -> Result<(), ValidationError> {
5939 Ok(())
5940 }
5941}
5942
5943#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5945pub struct OrganisationIdentification291 {
5946 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5947 pub any_bic: Option<String>,
5948 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5949 pub lei: Option<String>,
5950 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5951 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
5952}
5953
5954impl OrganisationIdentification291 {
5955 pub fn validate(&self) -> Result<(), ValidationError> {
5956 if let Some(ref val) = self.any_bic {
5957 let pattern =
5958 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
5959 if !pattern.is_match(val) {
5960 return Err(ValidationError::new(
5961 1005,
5962 "any_bic does not match the required pattern".to_string(),
5963 ));
5964 }
5965 }
5966 if let Some(ref val) = self.lei {
5967 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
5968 if !pattern.is_match(val) {
5969 return Err(ValidationError::new(
5970 1005,
5971 "lei does not match the required pattern".to_string(),
5972 ));
5973 }
5974 }
5975 if let Some(ref vec) = self.othr {
5976 for item in vec {
5977 item.validate()?
5978 }
5979 }
5980 Ok(())
5981 }
5982}
5983
5984#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5986pub struct OrganisationIdentification292 {
5987 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5988 pub any_bic: Option<String>,
5989 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5990 pub lei: Option<String>,
5991 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5992 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
5993}
5994
5995impl OrganisationIdentification292 {
5996 pub fn validate(&self) -> Result<(), ValidationError> {
5997 if let Some(ref val) = self.any_bic {
5998 let pattern =
5999 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
6000 if !pattern.is_match(val) {
6001 return Err(ValidationError::new(
6002 1005,
6003 "any_bic does not match the required pattern".to_string(),
6004 ));
6005 }
6006 }
6007 if let Some(ref val) = self.lei {
6008 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
6009 if !pattern.is_match(val) {
6010 return Err(ValidationError::new(
6011 1005,
6012 "lei does not match the required pattern".to_string(),
6013 ));
6014 }
6015 }
6016 if let Some(ref vec) = self.othr {
6017 for item in vec {
6018 item.validate()?
6019 }
6020 }
6021 Ok(())
6022 }
6023}
6024
6025#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6027pub struct OrganisationIdentification293 {
6028 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
6029 pub any_bic: Option<String>,
6030 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
6031 pub lei: Option<String>,
6032 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6033 pub othr: Option<Vec<GenericOrganisationIdentification12>>,
6034}
6035
6036impl OrganisationIdentification293 {
6037 pub fn validate(&self) -> Result<(), ValidationError> {
6038 if let Some(ref val) = self.any_bic {
6039 let pattern =
6040 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
6041 if !pattern.is_match(val) {
6042 return Err(ValidationError::new(
6043 1005,
6044 "any_bic does not match the required pattern".to_string(),
6045 ));
6046 }
6047 }
6048 if let Some(ref val) = self.lei {
6049 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
6050 if !pattern.is_match(val) {
6051 return Err(ValidationError::new(
6052 1005,
6053 "lei does not match the required pattern".to_string(),
6054 ));
6055 }
6056 }
6057 if let Some(ref vec) = self.othr {
6058 for item in vec {
6059 item.validate()?
6060 }
6061 }
6062 Ok(())
6063 }
6064}
6065
6066#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6068pub struct OrganisationIdentification294 {
6069 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
6070 pub any_bic: Option<String>,
6071 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
6072 pub lei: Option<String>,
6073 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6074 pub othr: Option<Vec<GenericOrganisationIdentification13>>,
6075}
6076
6077impl OrganisationIdentification294 {
6078 pub fn validate(&self) -> Result<(), ValidationError> {
6079 if let Some(ref val) = self.any_bic {
6080 let pattern =
6081 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
6082 if !pattern.is_match(val) {
6083 return Err(ValidationError::new(
6084 1005,
6085 "any_bic does not match the required pattern".to_string(),
6086 ));
6087 }
6088 }
6089 if let Some(ref val) = self.lei {
6090 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
6091 if !pattern.is_match(val) {
6092 return Err(ValidationError::new(
6093 1005,
6094 "lei does not match the required pattern".to_string(),
6095 ));
6096 }
6097 }
6098 if let Some(ref vec) = self.othr {
6099 for item in vec {
6100 item.validate()?
6101 }
6102 }
6103 Ok(())
6104 }
6105}
6106
6107#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6109pub struct OrganisationIdentificationSchemeName1Choice1 {
6110 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6111 pub cd: Option<String>,
6112 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6113 pub prtry: Option<String>,
6114}
6115
6116impl OrganisationIdentificationSchemeName1Choice1 {
6117 pub fn validate(&self) -> Result<(), ValidationError> {
6118 if let Some(ref val) = self.cd {
6119 if val.chars().count() < 1 {
6120 return Err(ValidationError::new(
6121 1001,
6122 "cd is shorter than the minimum length of 1".to_string(),
6123 ));
6124 }
6125 if val.chars().count() > 4 {
6126 return Err(ValidationError::new(
6127 1002,
6128 "cd exceeds the maximum length of 4".to_string(),
6129 ));
6130 }
6131 }
6132 if let Some(ref val) = self.prtry {
6133 if val.chars().count() < 1 {
6134 return Err(ValidationError::new(
6135 1001,
6136 "prtry is shorter than the minimum length of 1".to_string(),
6137 ));
6138 }
6139 if val.chars().count() > 35 {
6140 return Err(ValidationError::new(
6141 1002,
6142 "prtry exceeds the maximum length of 35".to_string(),
6143 ));
6144 }
6145 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6146 if !pattern.is_match(val) {
6147 return Err(ValidationError::new(
6148 1005,
6149 "prtry does not match the required pattern".to_string(),
6150 ));
6151 }
6152 }
6153 Ok(())
6154 }
6155}
6156
6157#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6159pub struct OrganisationIdentificationSchemeName1Choice2 {
6160 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6161 pub cd: Option<String>,
6162 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6163 pub prtry: Option<String>,
6164}
6165
6166impl OrganisationIdentificationSchemeName1Choice2 {
6167 pub fn validate(&self) -> Result<(), ValidationError> {
6168 if let Some(ref val) = self.cd {
6169 if val.chars().count() < 1 {
6170 return Err(ValidationError::new(
6171 1001,
6172 "cd is shorter than the minimum length of 1".to_string(),
6173 ));
6174 }
6175 if val.chars().count() > 4 {
6176 return Err(ValidationError::new(
6177 1002,
6178 "cd exceeds the maximum length of 4".to_string(),
6179 ));
6180 }
6181 }
6182 if let Some(ref val) = self.prtry {
6183 if val.chars().count() < 1 {
6184 return Err(ValidationError::new(
6185 1001,
6186 "prtry is shorter than the minimum length of 1".to_string(),
6187 ));
6188 }
6189 if val.chars().count() > 35 {
6190 return Err(ValidationError::new(
6191 1002,
6192 "prtry exceeds the maximum length of 35".to_string(),
6193 ));
6194 }
6195 let pattern = Regex::new(
6196 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6197 )
6198 .unwrap();
6199 if !pattern.is_match(val) {
6200 return Err(ValidationError::new(
6201 1005,
6202 "prtry does not match the required pattern".to_string(),
6203 ));
6204 }
6205 }
6206 Ok(())
6207 }
6208}
6209
6210#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6212pub struct OriginalAndCurrentQuantities1 {
6213 #[serde(rename = "FaceAmt")]
6214 pub face_amt: f64,
6215 #[serde(rename = "AmtsdVal")]
6216 pub amtsd_val: f64,
6217}
6218
6219impl OriginalAndCurrentQuantities1 {
6220 pub fn validate(&self) -> Result<(), ValidationError> {
6221 Ok(())
6222 }
6223}
6224
6225#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6227pub struct OriginalBusinessQuery11 {
6228 #[serde(rename = "MsgId")]
6229 pub msg_id: String,
6230 #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
6231 pub msg_nm_id: Option<String>,
6232 #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
6233 pub cre_dt_tm: Option<String>,
6234}
6235
6236impl OriginalBusinessQuery11 {
6237 pub fn validate(&self) -> Result<(), ValidationError> {
6238 if self.msg_id.chars().count() < 1 {
6239 return Err(ValidationError::new(
6240 1001,
6241 "msg_id is shorter than the minimum length of 1".to_string(),
6242 ));
6243 }
6244 if self.msg_id.chars().count() > 35 {
6245 return Err(ValidationError::new(
6246 1002,
6247 "msg_id exceeds the maximum length of 35".to_string(),
6248 ));
6249 }
6250 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6251 if !pattern.is_match(&self.msg_id) {
6252 return Err(ValidationError::new(
6253 1005,
6254 "msg_id does not match the required pattern".to_string(),
6255 ));
6256 }
6257 if let Some(ref val) = self.msg_nm_id {
6258 if val.chars().count() < 1 {
6259 return Err(ValidationError::new(
6260 1001,
6261 "msg_nm_id is shorter than the minimum length of 1".to_string(),
6262 ));
6263 }
6264 if val.chars().count() > 35 {
6265 return Err(ValidationError::new(
6266 1002,
6267 "msg_nm_id exceeds the maximum length of 35".to_string(),
6268 ));
6269 }
6270 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6271 if !pattern.is_match(val) {
6272 return Err(ValidationError::new(
6273 1005,
6274 "msg_nm_id does not match the required pattern".to_string(),
6275 ));
6276 }
6277 }
6278 if let Some(ref val) = self.cre_dt_tm {
6279 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
6280 if !pattern.is_match(val) {
6281 return Err(ValidationError::new(
6282 1005,
6283 "cre_dt_tm does not match the required pattern".to_string(),
6284 ));
6285 }
6286 }
6287 Ok(())
6288 }
6289}
6290
6291#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6293pub struct OtherIdentification11 {
6294 #[serde(rename = "Id")]
6295 pub id: String,
6296 #[serde(rename = "Sfx", skip_serializing_if = "Option::is_none")]
6297 pub sfx: Option<String>,
6298 #[serde(rename = "Tp")]
6299 pub tp: IdentificationSource3Choice1,
6300}
6301
6302impl OtherIdentification11 {
6303 pub fn validate(&self) -> Result<(), ValidationError> {
6304 if self.id.chars().count() < 1 {
6305 return Err(ValidationError::new(
6306 1001,
6307 "id is shorter than the minimum length of 1".to_string(),
6308 ));
6309 }
6310 if self.id.chars().count() > 35 {
6311 return Err(ValidationError::new(
6312 1002,
6313 "id exceeds the maximum length of 35".to_string(),
6314 ));
6315 }
6316 let pattern =
6317 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
6318 .unwrap();
6319 if !pattern.is_match(&self.id) {
6320 return Err(ValidationError::new(
6321 1005,
6322 "id does not match the required pattern".to_string(),
6323 ));
6324 }
6325 if let Some(ref val) = self.sfx {
6326 if val.chars().count() < 1 {
6327 return Err(ValidationError::new(
6328 1001,
6329 "sfx is shorter than the minimum length of 1".to_string(),
6330 ));
6331 }
6332 if val.chars().count() > 16 {
6333 return Err(ValidationError::new(
6334 1002,
6335 "sfx exceeds the maximum length of 16".to_string(),
6336 ));
6337 }
6338 let pattern = Regex::new(
6339 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6340 )
6341 .unwrap();
6342 if !pattern.is_match(val) {
6343 return Err(ValidationError::new(
6344 1005,
6345 "sfx does not match the required pattern".to_string(),
6346 ));
6347 }
6348 }
6349 self.tp.validate()?;
6350 Ok(())
6351 }
6352}
6353
6354#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6356pub enum POIComponentType1Code {
6357 #[default]
6358 #[serde(rename = "SOFT")]
6359 CodeSOFT,
6360 #[serde(rename = "EMVK")]
6361 CodeEMVK,
6362 #[serde(rename = "EMVO")]
6363 CodeEMVO,
6364 #[serde(rename = "MRIT")]
6365 CodeMRIT,
6366 #[serde(rename = "CHIT")]
6367 CodeCHIT,
6368 #[serde(rename = "SECM")]
6369 CodeSECM,
6370 #[serde(rename = "PEDV")]
6371 CodePEDV,
6372}
6373
6374impl POIComponentType1Code {
6375 pub fn validate(&self) -> Result<(), ValidationError> {
6376 Ok(())
6377 }
6378}
6379
6380#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6382pub struct Pagination1 {
6383 #[serde(rename = "PgNb")]
6384 pub pg_nb: String,
6385 #[serde(rename = "LastPgInd")]
6386 pub last_pg_ind: bool,
6387}
6388
6389impl Pagination1 {
6390 pub fn validate(&self) -> Result<(), ValidationError> {
6391 let pattern = Regex::new("[0-9]{1,5}").unwrap();
6392 if !pattern.is_match(&self.pg_nb) {
6393 return Err(ValidationError::new(
6394 1005,
6395 "pg_nb does not match the required pattern".to_string(),
6396 ));
6397 }
6398 Ok(())
6399 }
6400}
6401
6402#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6404pub struct Party38Choice1 {
6405 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6406 pub org_id: Option<OrganisationIdentification291>,
6407 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6408 pub prvt_id: Option<PersonIdentification131>,
6409}
6410
6411impl Party38Choice1 {
6412 pub fn validate(&self) -> Result<(), ValidationError> {
6413 if let Some(ref val) = self.org_id {
6414 val.validate()?
6415 }
6416 if let Some(ref val) = self.prvt_id {
6417 val.validate()?
6418 }
6419 Ok(())
6420 }
6421}
6422
6423#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6425pub struct Party38Choice2 {
6426 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6427 pub org_id: Option<OrganisationIdentification292>,
6428 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6429 pub prvt_id: Option<PersonIdentification132>,
6430}
6431
6432impl Party38Choice2 {
6433 pub fn validate(&self) -> Result<(), ValidationError> {
6434 if let Some(ref val) = self.org_id {
6435 val.validate()?
6436 }
6437 if let Some(ref val) = self.prvt_id {
6438 val.validate()?
6439 }
6440 Ok(())
6441 }
6442}
6443
6444#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6446pub struct Party38Choice3 {
6447 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6448 pub org_id: Option<OrganisationIdentification293>,
6449 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6450 pub prvt_id: Option<PersonIdentification133>,
6451}
6452
6453impl Party38Choice3 {
6454 pub fn validate(&self) -> Result<(), ValidationError> {
6455 if let Some(ref val) = self.org_id {
6456 val.validate()?
6457 }
6458 if let Some(ref val) = self.prvt_id {
6459 val.validate()?
6460 }
6461 Ok(())
6462 }
6463}
6464
6465#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6467pub struct Party38Choice4 {
6468 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
6469 pub org_id: Option<OrganisationIdentification294>,
6470 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
6471 pub prvt_id: Option<PersonIdentification134>,
6472}
6473
6474impl Party38Choice4 {
6475 pub fn validate(&self) -> Result<(), ValidationError> {
6476 if let Some(ref val) = self.org_id {
6477 val.validate()?
6478 }
6479 if let Some(ref val) = self.prvt_id {
6480 val.validate()?
6481 }
6482 Ok(())
6483 }
6484}
6485
6486#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6488pub struct Party40Choice1 {
6489 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6490 pub pty: Option<PartyIdentification1353>,
6491 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6492 pub agt: Option<BranchAndFinancialInstitutionIdentification64>,
6493}
6494
6495impl Party40Choice1 {
6496 pub fn validate(&self) -> Result<(), ValidationError> {
6497 if let Some(ref val) = self.pty {
6498 val.validate()?
6499 }
6500 if let Some(ref val) = self.agt {
6501 val.validate()?
6502 }
6503 Ok(())
6504 }
6505}
6506
6507#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6509pub struct Party40Choice2 {
6510 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6511 pub pty: Option<PartyIdentification1354>,
6512 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6513 pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6514}
6515
6516impl Party40Choice2 {
6517 pub fn validate(&self) -> Result<(), ValidationError> {
6518 if let Some(ref val) = self.pty {
6519 val.validate()?
6520 }
6521 if let Some(ref val) = self.agt {
6522 val.validate()?
6523 }
6524 Ok(())
6525 }
6526}
6527
6528#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6530pub struct Party40Choice3 {
6531 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6532 pub pty: Option<PartyIdentification1355>,
6533 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6534 pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6535}
6536
6537impl Party40Choice3 {
6538 pub fn validate(&self) -> Result<(), ValidationError> {
6539 if let Some(ref val) = self.pty {
6540 val.validate()?
6541 }
6542 if let Some(ref val) = self.agt {
6543 val.validate()?
6544 }
6545 Ok(())
6546 }
6547}
6548
6549#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6551pub struct Party40Choice4 {
6552 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6553 pub pty: Option<PartyIdentification1356>,
6554 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6555 pub agt: Option<BranchAndFinancialInstitutionIdentification65>,
6556}
6557
6558impl Party40Choice4 {
6559 pub fn validate(&self) -> Result<(), ValidationError> {
6560 if let Some(ref val) = self.pty {
6561 val.validate()?
6562 }
6563 if let Some(ref val) = self.agt {
6564 val.validate()?
6565 }
6566 Ok(())
6567 }
6568}
6569
6570#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6572pub struct Party40Choice5 {
6573 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
6574 pub pty: Option<PartyIdentification1357>,
6575 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
6576 pub agt: Option<BranchAndFinancialInstitutionIdentification66>,
6577}
6578
6579impl Party40Choice5 {
6580 pub fn validate(&self) -> Result<(), ValidationError> {
6581 if let Some(ref val) = self.pty {
6582 val.validate()?
6583 }
6584 if let Some(ref val) = self.agt {
6585 val.validate()?
6586 }
6587 Ok(())
6588 }
6589}
6590
6591#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6593pub struct PartyIdentification1351 {
6594 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6595 pub nm: Option<String>,
6596 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6597 pub pstl_adr: Option<PostalAddress241>,
6598 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6599 pub id: Option<Party38Choice1>,
6600 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6601 pub ctct_dtls: Option<Contact41>,
6602}
6603
6604impl PartyIdentification1351 {
6605 pub fn validate(&self) -> Result<(), ValidationError> {
6606 if let Some(ref val) = self.nm {
6607 if val.chars().count() < 1 {
6608 return Err(ValidationError::new(
6609 1001,
6610 "nm is shorter than the minimum length of 1".to_string(),
6611 ));
6612 }
6613 if val.chars().count() > 140 {
6614 return Err(ValidationError::new(
6615 1002,
6616 "nm exceeds the maximum length of 140".to_string(),
6617 ));
6618 }
6619 let pattern = Regex::new(
6620 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6621 )
6622 .unwrap();
6623 if !pattern.is_match(val) {
6624 return Err(ValidationError::new(
6625 1005,
6626 "nm does not match the required pattern".to_string(),
6627 ));
6628 }
6629 }
6630 if let Some(ref val) = self.pstl_adr {
6631 val.validate()?
6632 }
6633 if let Some(ref val) = self.id {
6634 val.validate()?
6635 }
6636 if let Some(ref val) = self.ctct_dtls {
6637 val.validate()?
6638 }
6639 Ok(())
6640 }
6641}
6642
6643#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6645pub struct PartyIdentification13510 {
6646 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6647 pub nm: Option<String>,
6648 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6649 pub pstl_adr: Option<PostalAddress243>,
6650 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6651 pub id: Option<Party38Choice1>,
6652 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6653 pub ctry_of_res: Option<String>,
6654 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6655 pub ctct_dtls: Option<Contact42>,
6656}
6657
6658impl PartyIdentification13510 {
6659 pub fn validate(&self) -> Result<(), ValidationError> {
6660 if let Some(ref val) = self.nm {
6661 if val.chars().count() < 1 {
6662 return Err(ValidationError::new(
6663 1001,
6664 "nm is shorter than the minimum length of 1".to_string(),
6665 ));
6666 }
6667 if val.chars().count() > 140 {
6668 return Err(ValidationError::new(
6669 1002,
6670 "nm exceeds the maximum length of 140".to_string(),
6671 ));
6672 }
6673 let pattern = Regex::new(
6674 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6675 )
6676 .unwrap();
6677 if !pattern.is_match(val) {
6678 return Err(ValidationError::new(
6679 1005,
6680 "nm does not match the required pattern".to_string(),
6681 ));
6682 }
6683 }
6684 if let Some(ref val) = self.pstl_adr {
6685 val.validate()?
6686 }
6687 if let Some(ref val) = self.id {
6688 val.validate()?
6689 }
6690 if let Some(ref val) = self.ctry_of_res {
6691 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6692 if !pattern.is_match(val) {
6693 return Err(ValidationError::new(
6694 1005,
6695 "ctry_of_res does not match the required pattern".to_string(),
6696 ));
6697 }
6698 }
6699 if let Some(ref val) = self.ctct_dtls {
6700 val.validate()?
6701 }
6702 Ok(())
6703 }
6704}
6705
6706#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6708pub struct PartyIdentification1352 {
6709 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6710 pub nm: Option<String>,
6711 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6712 pub pstl_adr: Option<PostalAddress241>,
6713 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6714 pub id: Option<Party38Choice1>,
6715 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6716 pub ctry_of_res: Option<String>,
6717}
6718
6719impl PartyIdentification1352 {
6720 pub fn validate(&self) -> Result<(), ValidationError> {
6721 if let Some(ref val) = self.nm {
6722 if val.chars().count() < 1 {
6723 return Err(ValidationError::new(
6724 1001,
6725 "nm is shorter than the minimum length of 1".to_string(),
6726 ));
6727 }
6728 if val.chars().count() > 140 {
6729 return Err(ValidationError::new(
6730 1002,
6731 "nm exceeds the maximum length of 140".to_string(),
6732 ));
6733 }
6734 let pattern = Regex::new(
6735 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6736 )
6737 .unwrap();
6738 if !pattern.is_match(val) {
6739 return Err(ValidationError::new(
6740 1005,
6741 "nm does not match the required pattern".to_string(),
6742 ));
6743 }
6744 }
6745 if let Some(ref val) = self.pstl_adr {
6746 val.validate()?
6747 }
6748 if let Some(ref val) = self.id {
6749 val.validate()?
6750 }
6751 if let Some(ref val) = self.ctry_of_res {
6752 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6753 if !pattern.is_match(val) {
6754 return Err(ValidationError::new(
6755 1005,
6756 "ctry_of_res does not match the required pattern".to_string(),
6757 ));
6758 }
6759 }
6760 Ok(())
6761 }
6762}
6763
6764#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6766pub struct PartyIdentification1353 {
6767 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6768 pub nm: Option<String>,
6769 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6770 pub pstl_adr: Option<PostalAddress241>,
6771 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6772 pub id: Option<Party38Choice2>,
6773 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6774 pub ctry_of_res: Option<String>,
6775}
6776
6777impl PartyIdentification1353 {
6778 pub fn validate(&self) -> Result<(), ValidationError> {
6779 if let Some(ref val) = self.nm {
6780 if val.chars().count() < 1 {
6781 return Err(ValidationError::new(
6782 1001,
6783 "nm is shorter than the minimum length of 1".to_string(),
6784 ));
6785 }
6786 if val.chars().count() > 140 {
6787 return Err(ValidationError::new(
6788 1002,
6789 "nm exceeds the maximum length of 140".to_string(),
6790 ));
6791 }
6792 let pattern = Regex::new(
6793 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6794 )
6795 .unwrap();
6796 if !pattern.is_match(val) {
6797 return Err(ValidationError::new(
6798 1005,
6799 "nm does not match the required pattern".to_string(),
6800 ));
6801 }
6802 }
6803 if let Some(ref val) = self.pstl_adr {
6804 val.validate()?
6805 }
6806 if let Some(ref val) = self.id {
6807 val.validate()?
6808 }
6809 if let Some(ref val) = self.ctry_of_res {
6810 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6811 if !pattern.is_match(val) {
6812 return Err(ValidationError::new(
6813 1005,
6814 "ctry_of_res does not match the required pattern".to_string(),
6815 ));
6816 }
6817 }
6818 Ok(())
6819 }
6820}
6821
6822#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6824pub struct PartyIdentification1354 {
6825 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6826 pub nm: Option<String>,
6827 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6828 pub pstl_adr: Option<PostalAddress243>,
6829 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6830 pub id: Option<Party38Choice3>,
6831 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6832 pub ctry_of_res: Option<String>,
6833 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6834 pub ctct_dtls: Option<Contact42>,
6835}
6836
6837impl PartyIdentification1354 {
6838 pub fn validate(&self) -> Result<(), ValidationError> {
6839 if let Some(ref val) = self.nm {
6840 if val.chars().count() < 1 {
6841 return Err(ValidationError::new(
6842 1001,
6843 "nm is shorter than the minimum length of 1".to_string(),
6844 ));
6845 }
6846 if val.chars().count() > 140 {
6847 return Err(ValidationError::new(
6848 1002,
6849 "nm exceeds the maximum length of 140".to_string(),
6850 ));
6851 }
6852 let pattern = Regex::new(
6853 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6854 )
6855 .unwrap();
6856 if !pattern.is_match(val) {
6857 return Err(ValidationError::new(
6858 1005,
6859 "nm does not match the required pattern".to_string(),
6860 ));
6861 }
6862 }
6863 if let Some(ref val) = self.pstl_adr {
6864 val.validate()?
6865 }
6866 if let Some(ref val) = self.id {
6867 val.validate()?
6868 }
6869 if let Some(ref val) = self.ctry_of_res {
6870 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6871 if !pattern.is_match(val) {
6872 return Err(ValidationError::new(
6873 1005,
6874 "ctry_of_res does not match the required pattern".to_string(),
6875 ));
6876 }
6877 }
6878 if let Some(ref val) = self.ctct_dtls {
6879 val.validate()?
6880 }
6881 Ok(())
6882 }
6883}
6884
6885#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6887pub struct PartyIdentification1355 {
6888 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6889 pub nm: Option<String>,
6890 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6891 pub pstl_adr: Option<PostalAddress241>,
6892 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6893 pub id: Option<Party38Choice1>,
6894 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6895 pub ctry_of_res: Option<String>,
6896 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6897 pub ctct_dtls: Option<Contact43>,
6898}
6899
6900impl PartyIdentification1355 {
6901 pub fn validate(&self) -> Result<(), ValidationError> {
6902 if let Some(ref val) = self.nm {
6903 if val.chars().count() < 1 {
6904 return Err(ValidationError::new(
6905 1001,
6906 "nm is shorter than the minimum length of 1".to_string(),
6907 ));
6908 }
6909 if val.chars().count() > 140 {
6910 return Err(ValidationError::new(
6911 1002,
6912 "nm exceeds the maximum length of 140".to_string(),
6913 ));
6914 }
6915 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6916 if !pattern.is_match(val) {
6917 return Err(ValidationError::new(
6918 1005,
6919 "nm does not match the required pattern".to_string(),
6920 ));
6921 }
6922 }
6923 if let Some(ref val) = self.pstl_adr {
6924 val.validate()?
6925 }
6926 if let Some(ref val) = self.id {
6927 val.validate()?
6928 }
6929 if let Some(ref val) = self.ctry_of_res {
6930 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6931 if !pattern.is_match(val) {
6932 return Err(ValidationError::new(
6933 1005,
6934 "ctry_of_res does not match the required pattern".to_string(),
6935 ));
6936 }
6937 }
6938 if let Some(ref val) = self.ctct_dtls {
6939 val.validate()?
6940 }
6941 Ok(())
6942 }
6943}
6944
6945#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6947pub struct PartyIdentification1356 {
6948 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6949 pub nm: Option<String>,
6950 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6951 pub pstl_adr: Option<PostalAddress241>,
6952 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6953 pub id: Option<Party38Choice1>,
6954 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6955 pub ctry_of_res: Option<String>,
6956 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6957 pub ctct_dtls: Option<Contact41>,
6958}
6959
6960impl PartyIdentification1356 {
6961 pub fn validate(&self) -> Result<(), ValidationError> {
6962 if let Some(ref val) = self.nm {
6963 if val.chars().count() < 1 {
6964 return Err(ValidationError::new(
6965 1001,
6966 "nm is shorter than the minimum length of 1".to_string(),
6967 ));
6968 }
6969 if val.chars().count() > 140 {
6970 return Err(ValidationError::new(
6971 1002,
6972 "nm exceeds the maximum length of 140".to_string(),
6973 ));
6974 }
6975 let pattern = Regex::new(
6976 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6977 )
6978 .unwrap();
6979 if !pattern.is_match(val) {
6980 return Err(ValidationError::new(
6981 1005,
6982 "nm does not match the required pattern".to_string(),
6983 ));
6984 }
6985 }
6986 if let Some(ref val) = self.pstl_adr {
6987 val.validate()?
6988 }
6989 if let Some(ref val) = self.id {
6990 val.validate()?
6991 }
6992 if let Some(ref val) = self.ctry_of_res {
6993 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6994 if !pattern.is_match(val) {
6995 return Err(ValidationError::new(
6996 1005,
6997 "ctry_of_res does not match the required pattern".to_string(),
6998 ));
6999 }
7000 }
7001 if let Some(ref val) = self.ctct_dtls {
7002 val.validate()?
7003 }
7004 Ok(())
7005 }
7006}
7007
7008#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7010pub struct PartyIdentification1357 {
7011 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7012 pub nm: Option<String>,
7013 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7014 pub pstl_adr: Option<PostalAddress241>,
7015 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7016 pub id: Option<Party38Choice1>,
7017 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7018 pub ctry_of_res: Option<String>,
7019 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7020 pub ctct_dtls: Option<Contact41>,
7021}
7022
7023impl PartyIdentification1357 {
7024 pub fn validate(&self) -> Result<(), ValidationError> {
7025 if let Some(ref val) = self.nm {
7026 if val.chars().count() < 1 {
7027 return Err(ValidationError::new(
7028 1001,
7029 "nm is shorter than the minimum length of 1".to_string(),
7030 ));
7031 }
7032 if val.chars().count() > 140 {
7033 return Err(ValidationError::new(
7034 1002,
7035 "nm exceeds the maximum length of 140".to_string(),
7036 ));
7037 }
7038 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7039 if !pattern.is_match(val) {
7040 return Err(ValidationError::new(
7041 1005,
7042 "nm does not match the required pattern".to_string(),
7043 ));
7044 }
7045 }
7046 if let Some(ref val) = self.pstl_adr {
7047 val.validate()?
7048 }
7049 if let Some(ref val) = self.id {
7050 val.validate()?
7051 }
7052 if let Some(ref val) = self.ctry_of_res {
7053 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
7054 if !pattern.is_match(val) {
7055 return Err(ValidationError::new(
7056 1005,
7057 "ctry_of_res does not match the required pattern".to_string(),
7058 ));
7059 }
7060 }
7061 if let Some(ref val) = self.ctct_dtls {
7062 val.validate()?
7063 }
7064 Ok(())
7065 }
7066}
7067
7068#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7070pub struct PartyIdentification1358 {
7071 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7072 pub nm: Option<String>,
7073 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7074 pub pstl_adr: Option<PostalAddress241>,
7075 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7076 pub id: Option<Party38Choice1>,
7077 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7078 pub ctry_of_res: Option<String>,
7079 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7080 pub ctct_dtls: Option<Contact43>,
7081}
7082
7083impl PartyIdentification1358 {
7084 pub fn validate(&self) -> Result<(), ValidationError> {
7085 if let Some(ref val) = self.nm {
7086 if val.chars().count() < 1 {
7087 return Err(ValidationError::new(
7088 1001,
7089 "nm is shorter than the minimum length of 1".to_string(),
7090 ));
7091 }
7092 if val.chars().count() > 140 {
7093 return Err(ValidationError::new(
7094 1002,
7095 "nm exceeds the maximum length of 140".to_string(),
7096 ));
7097 }
7098 let pattern = Regex::new(
7099 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7100 )
7101 .unwrap();
7102 if !pattern.is_match(val) {
7103 return Err(ValidationError::new(
7104 1005,
7105 "nm does not match the required pattern".to_string(),
7106 ));
7107 }
7108 }
7109 if let Some(ref val) = self.pstl_adr {
7110 val.validate()?
7111 }
7112 if let Some(ref val) = self.id {
7113 val.validate()?
7114 }
7115 if let Some(ref val) = self.ctry_of_res {
7116 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
7117 if !pattern.is_match(val) {
7118 return Err(ValidationError::new(
7119 1005,
7120 "ctry_of_res does not match the required pattern".to_string(),
7121 ));
7122 }
7123 }
7124 if let Some(ref val) = self.ctct_dtls {
7125 val.validate()?
7126 }
7127 Ok(())
7128 }
7129}
7130
7131#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7133pub struct PartyIdentification1359 {
7134 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7135 pub nm: Option<String>,
7136 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
7137 pub pstl_adr: Option<PostalAddress241>,
7138 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
7139 pub id: Option<Party38Choice4>,
7140 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
7141 pub ctry_of_res: Option<String>,
7142 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
7143 pub ctct_dtls: Option<Contact43>,
7144}
7145
7146impl PartyIdentification1359 {
7147 pub fn validate(&self) -> Result<(), ValidationError> {
7148 if let Some(ref val) = self.nm {
7149 if val.chars().count() < 1 {
7150 return Err(ValidationError::new(
7151 1001,
7152 "nm is shorter than the minimum length of 1".to_string(),
7153 ));
7154 }
7155 if val.chars().count() > 140 {
7156 return Err(ValidationError::new(
7157 1002,
7158 "nm exceeds the maximum length of 140".to_string(),
7159 ));
7160 }
7161 let pattern = Regex::new(
7162 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7163 )
7164 .unwrap();
7165 if !pattern.is_match(val) {
7166 return Err(ValidationError::new(
7167 1005,
7168 "nm does not match the required pattern".to_string(),
7169 ));
7170 }
7171 }
7172 if let Some(ref val) = self.pstl_adr {
7173 val.validate()?
7174 }
7175 if let Some(ref val) = self.id {
7176 val.validate()?
7177 }
7178 if let Some(ref val) = self.ctry_of_res {
7179 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
7180 if !pattern.is_match(val) {
7181 return Err(ValidationError::new(
7182 1005,
7183 "ctry_of_res does not match the required pattern".to_string(),
7184 ));
7185 }
7186 }
7187 if let Some(ref val) = self.ctct_dtls {
7188 val.validate()?
7189 }
7190 Ok(())
7191 }
7192}
7193
7194#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7196pub enum PartyType3Code {
7197 #[default]
7198 #[serde(rename = "OPOI")]
7199 CodeOPOI,
7200 #[serde(rename = "MERC")]
7201 CodeMERC,
7202 #[serde(rename = "ACCP")]
7203 CodeACCP,
7204 #[serde(rename = "ITAG")]
7205 CodeITAG,
7206 #[serde(rename = "ACQR")]
7207 CodeACQR,
7208 #[serde(rename = "CISS")]
7209 CodeCISS,
7210 #[serde(rename = "DLIS")]
7211 CodeDLIS,
7212}
7213
7214impl PartyType3Code {
7215 pub fn validate(&self) -> Result<(), ValidationError> {
7216 Ok(())
7217 }
7218}
7219
7220#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7222pub enum PartyType4Code {
7223 #[default]
7224 #[serde(rename = "MERC")]
7225 CodeMERC,
7226 #[serde(rename = "ACCP")]
7227 CodeACCP,
7228 #[serde(rename = "ITAG")]
7229 CodeITAG,
7230 #[serde(rename = "ACQR")]
7231 CodeACQR,
7232 #[serde(rename = "CISS")]
7233 CodeCISS,
7234 #[serde(rename = "TAXH")]
7235 CodeTAXH,
7236}
7237
7238impl PartyType4Code {
7239 pub fn validate(&self) -> Result<(), ValidationError> {
7240 Ok(())
7241 }
7242}
7243
7244#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7246pub struct PaymentCard41 {
7247 #[serde(rename = "PlainCardData", skip_serializing_if = "Option::is_none")]
7248 pub plain_card_data: Option<PlainCardData11>,
7249 #[serde(rename = "CardCtryCd", skip_serializing_if = "Option::is_none")]
7250 pub card_ctry_cd: Option<String>,
7251 #[serde(rename = "CardBrnd", skip_serializing_if = "Option::is_none")]
7252 pub card_brnd: Option<GenericIdentification11>,
7253 #[serde(rename = "AddtlCardData", skip_serializing_if = "Option::is_none")]
7254 pub addtl_card_data: Option<String>,
7255}
7256
7257impl PaymentCard41 {
7258 pub fn validate(&self) -> Result<(), ValidationError> {
7259 if let Some(ref val) = self.plain_card_data {
7260 val.validate()?
7261 }
7262 if let Some(ref val) = self.card_ctry_cd {
7263 let pattern = Regex::new("[0-9]{3}").unwrap();
7264 if !pattern.is_match(val) {
7265 return Err(ValidationError::new(
7266 1005,
7267 "card_ctry_cd does not match the required pattern".to_string(),
7268 ));
7269 }
7270 }
7271 if let Some(ref val) = self.card_brnd {
7272 val.validate()?
7273 }
7274 if let Some(ref val) = self.addtl_card_data {
7275 if val.chars().count() < 1 {
7276 return Err(ValidationError::new(
7277 1001,
7278 "addtl_card_data is shorter than the minimum length of 1".to_string(),
7279 ));
7280 }
7281 if val.chars().count() > 70 {
7282 return Err(ValidationError::new(
7283 1002,
7284 "addtl_card_data exceeds the maximum length of 70".to_string(),
7285 ));
7286 }
7287 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7288 if !pattern.is_match(val) {
7289 return Err(ValidationError::new(
7290 1005,
7291 "addtl_card_data does not match the required pattern".to_string(),
7292 ));
7293 }
7294 }
7295 Ok(())
7296 }
7297}
7298
7299#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7301pub struct PaymentContext3 {
7302 #[serde(rename = "CardPres", skip_serializing_if = "Option::is_none")]
7303 pub card_pres: Option<bool>,
7304 #[serde(rename = "CrdhldrPres", skip_serializing_if = "Option::is_none")]
7305 pub crdhldr_pres: Option<bool>,
7306 #[serde(rename = "OnLineCntxt", skip_serializing_if = "Option::is_none")]
7307 pub on_line_cntxt: Option<bool>,
7308 #[serde(rename = "AttndncCntxt", skip_serializing_if = "Option::is_none")]
7309 pub attndnc_cntxt: Option<AttendanceContext1Code>,
7310 #[serde(rename = "TxEnvt", skip_serializing_if = "Option::is_none")]
7311 pub tx_envt: Option<TransactionEnvironment1Code>,
7312 #[serde(rename = "TxChanl", skip_serializing_if = "Option::is_none")]
7313 pub tx_chanl: Option<TransactionChannel1Code>,
7314 #[serde(rename = "AttndntMsgCpbl", skip_serializing_if = "Option::is_none")]
7315 pub attndnt_msg_cpbl: Option<bool>,
7316 #[serde(rename = "AttndntLang", skip_serializing_if = "Option::is_none")]
7317 pub attndnt_lang: Option<String>,
7318 #[serde(rename = "CardDataNtryMd")]
7319 pub card_data_ntry_md: CardDataReading1Code,
7320 #[serde(rename = "FllbckInd", skip_serializing_if = "Option::is_none")]
7321 pub fllbck_ind: Option<bool>,
7322 #[serde(rename = "AuthntcnMtd", skip_serializing_if = "Option::is_none")]
7323 pub authntcn_mtd: Option<CardholderAuthentication2>,
7324}
7325
7326impl PaymentContext3 {
7327 pub fn validate(&self) -> Result<(), ValidationError> {
7328 if let Some(ref val) = self.attndnc_cntxt {
7329 val.validate()?
7330 }
7331 if let Some(ref val) = self.tx_envt {
7332 val.validate()?
7333 }
7334 if let Some(ref val) = self.tx_chanl {
7335 val.validate()?
7336 }
7337 if let Some(ref val) = self.attndnt_lang {
7338 let pattern = Regex::new("[a-z]{2,2}").unwrap();
7339 if !pattern.is_match(val) {
7340 return Err(ValidationError::new(
7341 1005,
7342 "attndnt_lang does not match the required pattern".to_string(),
7343 ));
7344 }
7345 }
7346 self.card_data_ntry_md.validate()?;
7347 if let Some(ref val) = self.authntcn_mtd {
7348 val.validate()?
7349 }
7350 Ok(())
7351 }
7352}
7353
7354#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7356pub struct PaymentReturnReason51 {
7357 #[serde(rename = "OrgnlBkTxCd", skip_serializing_if = "Option::is_none")]
7358 pub orgnl_bk_tx_cd: Option<BankTransactionCodeStructure41>,
7359 #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
7360 pub orgtr: Option<PartyIdentification13510>,
7361 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
7362 pub rsn: Option<ReturnReason5Choice1>,
7363 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
7364 pub addtl_inf: Option<Vec<String>>,
7365}
7366
7367impl PaymentReturnReason51 {
7368 pub fn validate(&self) -> Result<(), ValidationError> {
7369 if let Some(ref val) = self.orgnl_bk_tx_cd {
7370 val.validate()?
7371 }
7372 if let Some(ref val) = self.orgtr {
7373 val.validate()?
7374 }
7375 if let Some(ref val) = self.rsn {
7376 val.validate()?
7377 }
7378 if let Some(ref vec) = self.addtl_inf {
7379 for item in vec {
7380 if item.chars().count() < 1 {
7381 return Err(ValidationError::new(
7382 1001,
7383 "addtl_inf is shorter than the minimum length of 1".to_string(),
7384 ));
7385 }
7386 if item.chars().count() > 105 {
7387 return Err(ValidationError::new(
7388 1002,
7389 "addtl_inf exceeds the maximum length of 105".to_string(),
7390 ));
7391 }
7392 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7393 if !pattern.is_match(&item) {
7394 return Err(ValidationError::new(
7395 1005,
7396 "addtl_inf does not match the required pattern".to_string(),
7397 ));
7398 }
7399 }
7400 }
7401 Ok(())
7402 }
7403}
7404
7405#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7407pub struct PersonIdentification131 {
7408 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7409 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7410 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7411 pub othr: Option<Vec<GenericPersonIdentification11>>,
7412}
7413
7414impl PersonIdentification131 {
7415 pub fn validate(&self) -> Result<(), ValidationError> {
7416 if let Some(ref val) = self.dt_and_plc_of_birth {
7417 val.validate()?
7418 }
7419 if let Some(ref vec) = self.othr {
7420 for item in vec {
7421 item.validate()?
7422 }
7423 }
7424 Ok(())
7425 }
7426}
7427
7428#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7430pub struct PersonIdentification132 {
7431 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7432 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7433 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7434 pub othr: Option<Vec<GenericPersonIdentification11>>,
7435}
7436
7437impl PersonIdentification132 {
7438 pub fn validate(&self) -> Result<(), ValidationError> {
7439 if let Some(ref val) = self.dt_and_plc_of_birth {
7440 val.validate()?
7441 }
7442 if let Some(ref vec) = self.othr {
7443 for item in vec {
7444 item.validate()?
7445 }
7446 }
7447 Ok(())
7448 }
7449}
7450
7451#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7453pub struct PersonIdentification133 {
7454 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7455 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7456 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7457 pub othr: Option<Vec<GenericPersonIdentification12>>,
7458}
7459
7460impl PersonIdentification133 {
7461 pub fn validate(&self) -> Result<(), ValidationError> {
7462 if let Some(ref val) = self.dt_and_plc_of_birth {
7463 val.validate()?
7464 }
7465 if let Some(ref vec) = self.othr {
7466 for item in vec {
7467 item.validate()?
7468 }
7469 }
7470 Ok(())
7471 }
7472}
7473
7474#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7476pub struct PersonIdentification134 {
7477 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
7478 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
7479 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
7480 pub othr: Option<Vec<GenericPersonIdentification13>>,
7481}
7482
7483impl PersonIdentification134 {
7484 pub fn validate(&self) -> Result<(), ValidationError> {
7485 if let Some(ref val) = self.dt_and_plc_of_birth {
7486 val.validate()?
7487 }
7488 if let Some(ref vec) = self.othr {
7489 for item in vec {
7490 item.validate()?
7491 }
7492 }
7493 Ok(())
7494 }
7495}
7496
7497#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7499pub struct PersonIdentificationSchemeName1Choice1 {
7500 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
7501 pub cd: Option<String>,
7502 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
7503 pub prtry: Option<String>,
7504}
7505
7506impl PersonIdentificationSchemeName1Choice1 {
7507 pub fn validate(&self) -> Result<(), ValidationError> {
7508 if let Some(ref val) = self.cd {
7509 if val.chars().count() < 1 {
7510 return Err(ValidationError::new(
7511 1001,
7512 "cd is shorter than the minimum length of 1".to_string(),
7513 ));
7514 }
7515 if val.chars().count() > 4 {
7516 return Err(ValidationError::new(
7517 1002,
7518 "cd exceeds the maximum length of 4".to_string(),
7519 ));
7520 }
7521 }
7522 if let Some(ref val) = self.prtry {
7523 if val.chars().count() < 1 {
7524 return Err(ValidationError::new(
7525 1001,
7526 "prtry is shorter than the minimum length of 1".to_string(),
7527 ));
7528 }
7529 if val.chars().count() > 35 {
7530 return Err(ValidationError::new(
7531 1002,
7532 "prtry exceeds the maximum length of 35".to_string(),
7533 ));
7534 }
7535 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7536 if !pattern.is_match(val) {
7537 return Err(ValidationError::new(
7538 1005,
7539 "prtry does not match the required pattern".to_string(),
7540 ));
7541 }
7542 }
7543 Ok(())
7544 }
7545}
7546
7547#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7549pub struct PersonIdentificationSchemeName1Choice2 {
7550 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
7551 pub cd: Option<String>,
7552 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
7553 pub prtry: Option<String>,
7554}
7555
7556impl PersonIdentificationSchemeName1Choice2 {
7557 pub fn validate(&self) -> Result<(), ValidationError> {
7558 if let Some(ref val) = self.cd {
7559 if val.chars().count() < 1 {
7560 return Err(ValidationError::new(
7561 1001,
7562 "cd is shorter than the minimum length of 1".to_string(),
7563 ));
7564 }
7565 if val.chars().count() > 4 {
7566 return Err(ValidationError::new(
7567 1002,
7568 "cd exceeds the maximum length of 4".to_string(),
7569 ));
7570 }
7571 }
7572 if let Some(ref val) = self.prtry {
7573 if val.chars().count() < 1 {
7574 return Err(ValidationError::new(
7575 1001,
7576 "prtry is shorter than the minimum length of 1".to_string(),
7577 ));
7578 }
7579 if val.chars().count() > 35 {
7580 return Err(ValidationError::new(
7581 1002,
7582 "prtry exceeds the maximum length of 35".to_string(),
7583 ));
7584 }
7585 let pattern = Regex::new(
7586 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7587 )
7588 .unwrap();
7589 if !pattern.is_match(val) {
7590 return Err(ValidationError::new(
7591 1005,
7592 "prtry does not match the required pattern".to_string(),
7593 ));
7594 }
7595 }
7596 Ok(())
7597 }
7598}
7599
7600#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7602pub struct PlainCardData11 {
7603 #[serde(rename = "PAN")]
7604 pub pan: String,
7605 #[serde(rename = "CardSeqNb", skip_serializing_if = "Option::is_none")]
7606 pub card_seq_nb: Option<String>,
7607 #[serde(rename = "FctvDt", skip_serializing_if = "Option::is_none")]
7608 pub fctv_dt: Option<String>,
7609 #[serde(rename = "XpryDt")]
7610 pub xpry_dt: String,
7611 #[serde(rename = "SvcCd", skip_serializing_if = "Option::is_none")]
7612 pub svc_cd: Option<String>,
7613 #[serde(rename = "TrckData", skip_serializing_if = "Option::is_none")]
7614 pub trck_data: Option<Vec<TrackData11>>,
7615 #[serde(rename = "CardSctyCd", skip_serializing_if = "Option::is_none")]
7616 pub card_scty_cd: Option<CardSecurityInformation1>,
7617}
7618
7619impl PlainCardData11 {
7620 pub fn validate(&self) -> Result<(), ValidationError> {
7621 let pattern = Regex::new("[0-9]{8,28}").unwrap();
7622 if !pattern.is_match(&self.pan) {
7623 return Err(ValidationError::new(
7624 1005,
7625 "pan does not match the required pattern".to_string(),
7626 ));
7627 }
7628 if let Some(ref val) = self.card_seq_nb {
7629 let pattern = Regex::new("[0-9]{2,3}").unwrap();
7630 if !pattern.is_match(val) {
7631 return Err(ValidationError::new(
7632 1005,
7633 "card_seq_nb does not match the required pattern".to_string(),
7634 ));
7635 }
7636 }
7637 if let Some(ref val) = self.svc_cd {
7638 let pattern = Regex::new("[0-9]{3}").unwrap();
7639 if !pattern.is_match(val) {
7640 return Err(ValidationError::new(
7641 1005,
7642 "svc_cd does not match the required pattern".to_string(),
7643 ));
7644 }
7645 }
7646 if let Some(ref vec) = self.trck_data {
7647 for item in vec {
7648 item.validate()?
7649 }
7650 }
7651 if let Some(ref val) = self.card_scty_cd {
7652 val.validate()?
7653 }
7654 Ok(())
7655 }
7656}
7657
7658#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7660pub struct PointOfInteraction11 {
7661 #[serde(rename = "Id")]
7662 pub id: GenericIdentification321,
7663 #[serde(rename = "SysNm", skip_serializing_if = "Option::is_none")]
7664 pub sys_nm: Option<String>,
7665 #[serde(rename = "GrpId", skip_serializing_if = "Option::is_none")]
7666 pub grp_id: Option<String>,
7667 #[serde(rename = "Cpblties", skip_serializing_if = "Option::is_none")]
7668 pub cpblties: Option<PointOfInteractionCapabilities1>,
7669 #[serde(rename = "Cmpnt", skip_serializing_if = "Option::is_none")]
7670 pub cmpnt: Option<Vec<PointOfInteractionComponent11>>,
7671}
7672
7673impl PointOfInteraction11 {
7674 pub fn validate(&self) -> Result<(), ValidationError> {
7675 self.id.validate()?;
7676 if let Some(ref val) = self.sys_nm {
7677 if val.chars().count() < 1 {
7678 return Err(ValidationError::new(
7679 1001,
7680 "sys_nm is shorter than the minimum length of 1".to_string(),
7681 ));
7682 }
7683 if val.chars().count() > 70 {
7684 return Err(ValidationError::new(
7685 1002,
7686 "sys_nm exceeds the maximum length of 70".to_string(),
7687 ));
7688 }
7689 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7690 if !pattern.is_match(val) {
7691 return Err(ValidationError::new(
7692 1005,
7693 "sys_nm does not match the required pattern".to_string(),
7694 ));
7695 }
7696 }
7697 if let Some(ref val) = self.grp_id {
7698 if val.chars().count() < 1 {
7699 return Err(ValidationError::new(
7700 1001,
7701 "grp_id is shorter than the minimum length of 1".to_string(),
7702 ));
7703 }
7704 if val.chars().count() > 35 {
7705 return Err(ValidationError::new(
7706 1002,
7707 "grp_id exceeds the maximum length of 35".to_string(),
7708 ));
7709 }
7710 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7711 if !pattern.is_match(val) {
7712 return Err(ValidationError::new(
7713 1005,
7714 "grp_id does not match the required pattern".to_string(),
7715 ));
7716 }
7717 }
7718 if let Some(ref val) = self.cpblties {
7719 val.validate()?
7720 }
7721 if let Some(ref vec) = self.cmpnt {
7722 for item in vec {
7723 item.validate()?
7724 }
7725 }
7726 Ok(())
7727 }
7728}
7729
7730#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7732pub struct PointOfInteractionCapabilities1 {
7733 #[serde(rename = "CardRdngCpblties", skip_serializing_if = "Option::is_none")]
7734 pub card_rdng_cpblties: Option<Vec<CardDataReading1Code>>,
7735 #[serde(
7736 rename = "CrdhldrVrfctnCpblties",
7737 skip_serializing_if = "Option::is_none"
7738 )]
7739 pub crdhldr_vrfctn_cpblties: Option<Vec<CardholderVerificationCapability1Code>>,
7740 #[serde(rename = "OnLineCpblties", skip_serializing_if = "Option::is_none")]
7741 pub on_line_cpblties: Option<OnLineCapability1Code>,
7742 #[serde(rename = "DispCpblties", skip_serializing_if = "Option::is_none")]
7743 pub disp_cpblties: Option<Vec<DisplayCapabilities1>>,
7744 #[serde(rename = "PrtLineWidth", skip_serializing_if = "Option::is_none")]
7745 pub prt_line_width: Option<String>,
7746}
7747
7748impl PointOfInteractionCapabilities1 {
7749 pub fn validate(&self) -> Result<(), ValidationError> {
7750 if let Some(ref vec) = self.card_rdng_cpblties {
7751 for item in vec {
7752 item.validate()?
7753 }
7754 }
7755 if let Some(ref vec) = self.crdhldr_vrfctn_cpblties {
7756 for item in vec {
7757 item.validate()?
7758 }
7759 }
7760 if let Some(ref val) = self.on_line_cpblties {
7761 val.validate()?
7762 }
7763 if let Some(ref vec) = self.disp_cpblties {
7764 for item in vec {
7765 item.validate()?
7766 }
7767 }
7768 if let Some(ref val) = self.prt_line_width {
7769 let pattern = Regex::new("[0-9]{1,3}").unwrap();
7770 if !pattern.is_match(val) {
7771 return Err(ValidationError::new(
7772 1005,
7773 "prt_line_width does not match the required pattern".to_string(),
7774 ));
7775 }
7776 }
7777 Ok(())
7778 }
7779}
7780
7781#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7784pub struct PointOfInteractionComponent11 {
7785 #[serde(rename = "POICmpntTp")]
7786 pub poi_cmpnt_tp: POIComponentType1Code,
7787 #[serde(rename = "ManfctrId", skip_serializing_if = "Option::is_none")]
7788 pub manfctr_id: Option<String>,
7789 #[serde(rename = "Mdl", skip_serializing_if = "Option::is_none")]
7790 pub mdl: Option<String>,
7791 #[serde(rename = "VrsnNb", skip_serializing_if = "Option::is_none")]
7792 pub vrsn_nb: Option<String>,
7793 #[serde(rename = "SrlNb", skip_serializing_if = "Option::is_none")]
7794 pub srl_nb: Option<String>,
7795 #[serde(rename = "ApprvlNb", skip_serializing_if = "Option::is_none")]
7796 pub apprvl_nb: Option<Vec<String>>,
7797}
7798
7799impl PointOfInteractionComponent11 {
7800 pub fn validate(&self) -> Result<(), ValidationError> {
7801 self.poi_cmpnt_tp.validate()?;
7802 if let Some(ref val) = self.manfctr_id {
7803 if val.chars().count() < 1 {
7804 return Err(ValidationError::new(
7805 1001,
7806 "manfctr_id is shorter than the minimum length of 1".to_string(),
7807 ));
7808 }
7809 if val.chars().count() > 35 {
7810 return Err(ValidationError::new(
7811 1002,
7812 "manfctr_id exceeds the maximum length of 35".to_string(),
7813 ));
7814 }
7815 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7816 if !pattern.is_match(val) {
7817 return Err(ValidationError::new(
7818 1005,
7819 "manfctr_id does not match the required pattern".to_string(),
7820 ));
7821 }
7822 }
7823 if let Some(ref val) = self.mdl {
7824 if val.chars().count() < 1 {
7825 return Err(ValidationError::new(
7826 1001,
7827 "mdl is shorter than the minimum length of 1".to_string(),
7828 ));
7829 }
7830 if val.chars().count() > 35 {
7831 return Err(ValidationError::new(
7832 1002,
7833 "mdl exceeds the maximum length of 35".to_string(),
7834 ));
7835 }
7836 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7837 if !pattern.is_match(val) {
7838 return Err(ValidationError::new(
7839 1005,
7840 "mdl does not match the required pattern".to_string(),
7841 ));
7842 }
7843 }
7844 if let Some(ref val) = self.vrsn_nb {
7845 if val.chars().count() < 1 {
7846 return Err(ValidationError::new(
7847 1001,
7848 "vrsn_nb is shorter than the minimum length of 1".to_string(),
7849 ));
7850 }
7851 if val.chars().count() > 16 {
7852 return Err(ValidationError::new(
7853 1002,
7854 "vrsn_nb exceeds the maximum length of 16".to_string(),
7855 ));
7856 }
7857 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7858 if !pattern.is_match(val) {
7859 return Err(ValidationError::new(
7860 1005,
7861 "vrsn_nb does not match the required pattern".to_string(),
7862 ));
7863 }
7864 }
7865 if let Some(ref val) = self.srl_nb {
7866 if val.chars().count() < 1 {
7867 return Err(ValidationError::new(
7868 1001,
7869 "srl_nb is shorter than the minimum length of 1".to_string(),
7870 ));
7871 }
7872 if val.chars().count() > 35 {
7873 return Err(ValidationError::new(
7874 1002,
7875 "srl_nb exceeds the maximum length of 35".to_string(),
7876 ));
7877 }
7878 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7879 if !pattern.is_match(val) {
7880 return Err(ValidationError::new(
7881 1005,
7882 "srl_nb does not match the required pattern".to_string(),
7883 ));
7884 }
7885 }
7886 if let Some(ref vec) = self.apprvl_nb {
7887 for item in vec {
7888 if item.chars().count() < 1 {
7889 return Err(ValidationError::new(
7890 1001,
7891 "apprvl_nb is shorter than the minimum length of 1".to_string(),
7892 ));
7893 }
7894 if item.chars().count() > 70 {
7895 return Err(ValidationError::new(
7896 1002,
7897 "apprvl_nb exceeds the maximum length of 70".to_string(),
7898 ));
7899 }
7900 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7901 if !pattern.is_match(&item) {
7902 return Err(ValidationError::new(
7903 1005,
7904 "apprvl_nb does not match the required pattern".to_string(),
7905 ));
7906 }
7907 }
7908 }
7909 Ok(())
7910 }
7911}
7912
7913#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7915pub struct PostalAddress241 {
7916 #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
7917 pub adr_tp: Option<AddressType3Choice1>,
7918 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
7919 pub dept: Option<String>,
7920 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
7921 pub sub_dept: Option<String>,
7922 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
7923 pub strt_nm: Option<String>,
7924 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
7925 pub bldg_nb: Option<String>,
7926 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
7927 pub bldg_nm: Option<String>,
7928 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
7929 pub flr: Option<String>,
7930 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
7931 pub pst_bx: Option<String>,
7932 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
7933 pub room: Option<String>,
7934 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
7935 pub pst_cd: Option<String>,
7936 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
7937 pub twn_nm: Option<String>,
7938 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
7939 pub twn_lctn_nm: Option<String>,
7940 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
7941 pub dstrct_nm: Option<String>,
7942 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
7943 pub ctry_sub_dvsn: Option<String>,
7944 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
7945 pub ctry: Option<String>,
7946 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
7947 pub adr_line: Option<Vec<String>>,
7948}
7949
7950impl PostalAddress241 {
7951 pub fn validate(&self) -> Result<(), ValidationError> {
7952 if let Some(ref val) = self.adr_tp {
7953 val.validate()?
7954 }
7955 if let Some(ref val) = self.dept {
7956 if val.chars().count() < 1 {
7957 return Err(ValidationError::new(
7958 1001,
7959 "dept is shorter than the minimum length of 1".to_string(),
7960 ));
7961 }
7962 if val.chars().count() > 70 {
7963 return Err(ValidationError::new(
7964 1002,
7965 "dept exceeds the maximum length of 70".to_string(),
7966 ));
7967 }
7968 let pattern = Regex::new(
7969 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7970 )
7971 .unwrap();
7972 if !pattern.is_match(val) {
7973 return Err(ValidationError::new(
7974 1005,
7975 "dept does not match the required pattern".to_string(),
7976 ));
7977 }
7978 }
7979 if let Some(ref val) = self.sub_dept {
7980 if val.chars().count() < 1 {
7981 return Err(ValidationError::new(
7982 1001,
7983 "sub_dept is shorter than the minimum length of 1".to_string(),
7984 ));
7985 }
7986 if val.chars().count() > 70 {
7987 return Err(ValidationError::new(
7988 1002,
7989 "sub_dept exceeds the maximum length of 70".to_string(),
7990 ));
7991 }
7992 let pattern = Regex::new(
7993 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7994 )
7995 .unwrap();
7996 if !pattern.is_match(val) {
7997 return Err(ValidationError::new(
7998 1005,
7999 "sub_dept does not match the required pattern".to_string(),
8000 ));
8001 }
8002 }
8003 if let Some(ref val) = self.strt_nm {
8004 if val.chars().count() < 1 {
8005 return Err(ValidationError::new(
8006 1001,
8007 "strt_nm is shorter than the minimum length of 1".to_string(),
8008 ));
8009 }
8010 if val.chars().count() > 70 {
8011 return Err(ValidationError::new(
8012 1002,
8013 "strt_nm exceeds the maximum length of 70".to_string(),
8014 ));
8015 }
8016 let pattern = Regex::new(
8017 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8018 )
8019 .unwrap();
8020 if !pattern.is_match(val) {
8021 return Err(ValidationError::new(
8022 1005,
8023 "strt_nm does not match the required pattern".to_string(),
8024 ));
8025 }
8026 }
8027 if let Some(ref val) = self.bldg_nb {
8028 if val.chars().count() < 1 {
8029 return Err(ValidationError::new(
8030 1001,
8031 "bldg_nb is shorter than the minimum length of 1".to_string(),
8032 ));
8033 }
8034 if val.chars().count() > 16 {
8035 return Err(ValidationError::new(
8036 1002,
8037 "bldg_nb exceeds the maximum length of 16".to_string(),
8038 ));
8039 }
8040 let pattern = Regex::new(
8041 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8042 )
8043 .unwrap();
8044 if !pattern.is_match(val) {
8045 return Err(ValidationError::new(
8046 1005,
8047 "bldg_nb does not match the required pattern".to_string(),
8048 ));
8049 }
8050 }
8051 if let Some(ref val) = self.bldg_nm {
8052 if val.chars().count() < 1 {
8053 return Err(ValidationError::new(
8054 1001,
8055 "bldg_nm is shorter than the minimum length of 1".to_string(),
8056 ));
8057 }
8058 if val.chars().count() > 35 {
8059 return Err(ValidationError::new(
8060 1002,
8061 "bldg_nm exceeds the maximum length of 35".to_string(),
8062 ));
8063 }
8064 let pattern = Regex::new(
8065 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8066 )
8067 .unwrap();
8068 if !pattern.is_match(val) {
8069 return Err(ValidationError::new(
8070 1005,
8071 "bldg_nm does not match the required pattern".to_string(),
8072 ));
8073 }
8074 }
8075 if let Some(ref val) = self.flr {
8076 if val.chars().count() < 1 {
8077 return Err(ValidationError::new(
8078 1001,
8079 "flr is shorter than the minimum length of 1".to_string(),
8080 ));
8081 }
8082 if val.chars().count() > 70 {
8083 return Err(ValidationError::new(
8084 1002,
8085 "flr exceeds the maximum length of 70".to_string(),
8086 ));
8087 }
8088 let pattern = Regex::new(
8089 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8090 )
8091 .unwrap();
8092 if !pattern.is_match(val) {
8093 return Err(ValidationError::new(
8094 1005,
8095 "flr does not match the required pattern".to_string(),
8096 ));
8097 }
8098 }
8099 if let Some(ref val) = self.pst_bx {
8100 if val.chars().count() < 1 {
8101 return Err(ValidationError::new(
8102 1001,
8103 "pst_bx is shorter than the minimum length of 1".to_string(),
8104 ));
8105 }
8106 if val.chars().count() > 16 {
8107 return Err(ValidationError::new(
8108 1002,
8109 "pst_bx exceeds the maximum length of 16".to_string(),
8110 ));
8111 }
8112 let pattern = Regex::new(
8113 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8114 )
8115 .unwrap();
8116 if !pattern.is_match(val) {
8117 return Err(ValidationError::new(
8118 1005,
8119 "pst_bx does not match the required pattern".to_string(),
8120 ));
8121 }
8122 }
8123 if let Some(ref val) = self.room {
8124 if val.chars().count() < 1 {
8125 return Err(ValidationError::new(
8126 1001,
8127 "room is shorter than the minimum length of 1".to_string(),
8128 ));
8129 }
8130 if val.chars().count() > 70 {
8131 return Err(ValidationError::new(
8132 1002,
8133 "room exceeds the maximum length of 70".to_string(),
8134 ));
8135 }
8136 let pattern = Regex::new(
8137 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8138 )
8139 .unwrap();
8140 if !pattern.is_match(val) {
8141 return Err(ValidationError::new(
8142 1005,
8143 "room does not match the required pattern".to_string(),
8144 ));
8145 }
8146 }
8147 if let Some(ref val) = self.pst_cd {
8148 if val.chars().count() < 1 {
8149 return Err(ValidationError::new(
8150 1001,
8151 "pst_cd is shorter than the minimum length of 1".to_string(),
8152 ));
8153 }
8154 if val.chars().count() > 16 {
8155 return Err(ValidationError::new(
8156 1002,
8157 "pst_cd exceeds the maximum length of 16".to_string(),
8158 ));
8159 }
8160 let pattern = Regex::new(
8161 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8162 )
8163 .unwrap();
8164 if !pattern.is_match(val) {
8165 return Err(ValidationError::new(
8166 1005,
8167 "pst_cd does not match the required pattern".to_string(),
8168 ));
8169 }
8170 }
8171 if let Some(ref val) = self.twn_nm {
8172 if val.chars().count() < 1 {
8173 return Err(ValidationError::new(
8174 1001,
8175 "twn_nm is shorter than the minimum length of 1".to_string(),
8176 ));
8177 }
8178 if val.chars().count() > 35 {
8179 return Err(ValidationError::new(
8180 1002,
8181 "twn_nm exceeds the maximum length of 35".to_string(),
8182 ));
8183 }
8184 let pattern = Regex::new(
8185 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8186 )
8187 .unwrap();
8188 if !pattern.is_match(val) {
8189 return Err(ValidationError::new(
8190 1005,
8191 "twn_nm does not match the required pattern".to_string(),
8192 ));
8193 }
8194 }
8195 if let Some(ref val) = self.twn_lctn_nm {
8196 if val.chars().count() < 1 {
8197 return Err(ValidationError::new(
8198 1001,
8199 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
8200 ));
8201 }
8202 if val.chars().count() > 35 {
8203 return Err(ValidationError::new(
8204 1002,
8205 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
8206 ));
8207 }
8208 let pattern = Regex::new(
8209 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8210 )
8211 .unwrap();
8212 if !pattern.is_match(val) {
8213 return Err(ValidationError::new(
8214 1005,
8215 "twn_lctn_nm does not match the required pattern".to_string(),
8216 ));
8217 }
8218 }
8219 if let Some(ref val) = self.dstrct_nm {
8220 if val.chars().count() < 1 {
8221 return Err(ValidationError::new(
8222 1001,
8223 "dstrct_nm is shorter than the minimum length of 1".to_string(),
8224 ));
8225 }
8226 if val.chars().count() > 35 {
8227 return Err(ValidationError::new(
8228 1002,
8229 "dstrct_nm exceeds the maximum length of 35".to_string(),
8230 ));
8231 }
8232 let pattern = Regex::new(
8233 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8234 )
8235 .unwrap();
8236 if !pattern.is_match(val) {
8237 return Err(ValidationError::new(
8238 1005,
8239 "dstrct_nm does not match the required pattern".to_string(),
8240 ));
8241 }
8242 }
8243 if let Some(ref val) = self.ctry_sub_dvsn {
8244 if val.chars().count() < 1 {
8245 return Err(ValidationError::new(
8246 1001,
8247 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
8248 ));
8249 }
8250 if val.chars().count() > 35 {
8251 return Err(ValidationError::new(
8252 1002,
8253 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
8254 ));
8255 }
8256 let pattern = Regex::new(
8257 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8258 )
8259 .unwrap();
8260 if !pattern.is_match(val) {
8261 return Err(ValidationError::new(
8262 1005,
8263 "ctry_sub_dvsn does not match the required pattern".to_string(),
8264 ));
8265 }
8266 }
8267 if let Some(ref val) = self.ctry {
8268 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
8269 if !pattern.is_match(val) {
8270 return Err(ValidationError::new(
8271 1005,
8272 "ctry does not match the required pattern".to_string(),
8273 ));
8274 }
8275 }
8276 if let Some(ref vec) = self.adr_line {
8277 for item in vec {
8278 if item.chars().count() < 1 {
8279 return Err(ValidationError::new(
8280 1001,
8281 "adr_line is shorter than the minimum length of 1".to_string(),
8282 ));
8283 }
8284 if item.chars().count() > 70 {
8285 return Err(ValidationError::new(
8286 1002,
8287 "adr_line exceeds the maximum length of 70".to_string(),
8288 ));
8289 }
8290 let pattern = Regex::new(
8291 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8292 )
8293 .unwrap();
8294 if !pattern.is_match(&item) {
8295 return Err(ValidationError::new(
8296 1005,
8297 "adr_line does not match the required pattern".to_string(),
8298 ));
8299 }
8300 }
8301 }
8302 Ok(())
8303 }
8304}
8305
8306#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8308pub struct PostalAddress242 {
8309 #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
8310 pub adr_tp: Option<AddressType3Choice1>,
8311 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
8312 pub dept: Option<String>,
8313 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
8314 pub sub_dept: Option<String>,
8315 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
8316 pub strt_nm: Option<String>,
8317 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
8318 pub bldg_nb: Option<String>,
8319 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
8320 pub bldg_nm: Option<String>,
8321 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
8322 pub flr: Option<String>,
8323 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
8324 pub pst_bx: Option<String>,
8325 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
8326 pub room: Option<String>,
8327 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
8328 pub pst_cd: Option<String>,
8329 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
8330 pub twn_nm: Option<String>,
8331 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
8332 pub twn_lctn_nm: Option<String>,
8333 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
8334 pub dstrct_nm: Option<String>,
8335 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
8336 pub ctry_sub_dvsn: Option<String>,
8337 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
8338 pub ctry: Option<String>,
8339 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
8340 pub adr_line: Option<Vec<String>>,
8341}
8342
8343impl PostalAddress242 {
8344 pub fn validate(&self) -> Result<(), ValidationError> {
8345 if let Some(ref val) = self.adr_tp {
8346 val.validate()?
8347 }
8348 if let Some(ref val) = self.dept {
8349 if val.chars().count() < 1 {
8350 return Err(ValidationError::new(
8351 1001,
8352 "dept is shorter than the minimum length of 1".to_string(),
8353 ));
8354 }
8355 if val.chars().count() > 70 {
8356 return Err(ValidationError::new(
8357 1002,
8358 "dept exceeds the maximum length of 70".to_string(),
8359 ));
8360 }
8361 let pattern = Regex::new(
8362 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8363 )
8364 .unwrap();
8365 if !pattern.is_match(val) {
8366 return Err(ValidationError::new(
8367 1005,
8368 "dept does not match the required pattern".to_string(),
8369 ));
8370 }
8371 }
8372 if let Some(ref val) = self.sub_dept {
8373 if val.chars().count() < 1 {
8374 return Err(ValidationError::new(
8375 1001,
8376 "sub_dept is shorter than the minimum length of 1".to_string(),
8377 ));
8378 }
8379 if val.chars().count() > 70 {
8380 return Err(ValidationError::new(
8381 1002,
8382 "sub_dept exceeds the maximum length of 70".to_string(),
8383 ));
8384 }
8385 let pattern = Regex::new(
8386 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8387 )
8388 .unwrap();
8389 if !pattern.is_match(val) {
8390 return Err(ValidationError::new(
8391 1005,
8392 "sub_dept does not match the required pattern".to_string(),
8393 ));
8394 }
8395 }
8396 if let Some(ref val) = self.strt_nm {
8397 if val.chars().count() < 1 {
8398 return Err(ValidationError::new(
8399 1001,
8400 "strt_nm is shorter than the minimum length of 1".to_string(),
8401 ));
8402 }
8403 if val.chars().count() > 70 {
8404 return Err(ValidationError::new(
8405 1002,
8406 "strt_nm exceeds the maximum length of 70".to_string(),
8407 ));
8408 }
8409 let pattern = Regex::new(
8410 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8411 )
8412 .unwrap();
8413 if !pattern.is_match(val) {
8414 return Err(ValidationError::new(
8415 1005,
8416 "strt_nm does not match the required pattern".to_string(),
8417 ));
8418 }
8419 }
8420 if let Some(ref val) = self.bldg_nb {
8421 if val.chars().count() < 1 {
8422 return Err(ValidationError::new(
8423 1001,
8424 "bldg_nb is shorter than the minimum length of 1".to_string(),
8425 ));
8426 }
8427 if val.chars().count() > 35 {
8428 return Err(ValidationError::new(
8429 1002,
8430 "bldg_nb exceeds the maximum length of 35".to_string(),
8431 ));
8432 }
8433 let pattern = Regex::new(
8434 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8435 )
8436 .unwrap();
8437 if !pattern.is_match(val) {
8438 return Err(ValidationError::new(
8439 1005,
8440 "bldg_nb does not match the required pattern".to_string(),
8441 ));
8442 }
8443 }
8444 if let Some(ref val) = self.bldg_nm {
8445 if val.chars().count() < 1 {
8446 return Err(ValidationError::new(
8447 1001,
8448 "bldg_nm is shorter than the minimum length of 1".to_string(),
8449 ));
8450 }
8451 if val.chars().count() > 35 {
8452 return Err(ValidationError::new(
8453 1002,
8454 "bldg_nm exceeds the maximum length of 35".to_string(),
8455 ));
8456 }
8457 let pattern = Regex::new(
8458 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8459 )
8460 .unwrap();
8461 if !pattern.is_match(val) {
8462 return Err(ValidationError::new(
8463 1005,
8464 "bldg_nm does not match the required pattern".to_string(),
8465 ));
8466 }
8467 }
8468 if let Some(ref val) = self.flr {
8469 if val.chars().count() < 1 {
8470 return Err(ValidationError::new(
8471 1001,
8472 "flr is shorter than the minimum length of 1".to_string(),
8473 ));
8474 }
8475 if val.chars().count() > 70 {
8476 return Err(ValidationError::new(
8477 1002,
8478 "flr exceeds the maximum length of 70".to_string(),
8479 ));
8480 }
8481 let pattern = Regex::new(
8482 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8483 )
8484 .unwrap();
8485 if !pattern.is_match(val) {
8486 return Err(ValidationError::new(
8487 1005,
8488 "flr does not match the required pattern".to_string(),
8489 ));
8490 }
8491 }
8492 if let Some(ref val) = self.pst_bx {
8493 if val.chars().count() < 1 {
8494 return Err(ValidationError::new(
8495 1001,
8496 "pst_bx is shorter than the minimum length of 1".to_string(),
8497 ));
8498 }
8499 if val.chars().count() > 16 {
8500 return Err(ValidationError::new(
8501 1002,
8502 "pst_bx exceeds the maximum length of 16".to_string(),
8503 ));
8504 }
8505 let pattern = Regex::new(
8506 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8507 )
8508 .unwrap();
8509 if !pattern.is_match(val) {
8510 return Err(ValidationError::new(
8511 1005,
8512 "pst_bx does not match the required pattern".to_string(),
8513 ));
8514 }
8515 }
8516 if let Some(ref val) = self.room {
8517 if val.chars().count() < 1 {
8518 return Err(ValidationError::new(
8519 1001,
8520 "room is shorter than the minimum length of 1".to_string(),
8521 ));
8522 }
8523 if val.chars().count() > 70 {
8524 return Err(ValidationError::new(
8525 1002,
8526 "room exceeds the maximum length of 70".to_string(),
8527 ));
8528 }
8529 let pattern = Regex::new(
8530 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8531 )
8532 .unwrap();
8533 if !pattern.is_match(val) {
8534 return Err(ValidationError::new(
8535 1005,
8536 "room does not match the required pattern".to_string(),
8537 ));
8538 }
8539 }
8540 if let Some(ref val) = self.pst_cd {
8541 if val.chars().count() < 1 {
8542 return Err(ValidationError::new(
8543 1001,
8544 "pst_cd is shorter than the minimum length of 1".to_string(),
8545 ));
8546 }
8547 if val.chars().count() > 16 {
8548 return Err(ValidationError::new(
8549 1002,
8550 "pst_cd exceeds the maximum length of 16".to_string(),
8551 ));
8552 }
8553 let pattern = Regex::new(
8554 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8555 )
8556 .unwrap();
8557 if !pattern.is_match(val) {
8558 return Err(ValidationError::new(
8559 1005,
8560 "pst_cd does not match the required pattern".to_string(),
8561 ));
8562 }
8563 }
8564 if let Some(ref val) = self.twn_nm {
8565 if val.chars().count() < 1 {
8566 return Err(ValidationError::new(
8567 1001,
8568 "twn_nm is shorter than the minimum length of 1".to_string(),
8569 ));
8570 }
8571 if val.chars().count() > 35 {
8572 return Err(ValidationError::new(
8573 1002,
8574 "twn_nm exceeds the maximum length of 35".to_string(),
8575 ));
8576 }
8577 let pattern = Regex::new(
8578 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8579 )
8580 .unwrap();
8581 if !pattern.is_match(val) {
8582 return Err(ValidationError::new(
8583 1005,
8584 "twn_nm does not match the required pattern".to_string(),
8585 ));
8586 }
8587 }
8588 if let Some(ref val) = self.twn_lctn_nm {
8589 if val.chars().count() < 1 {
8590 return Err(ValidationError::new(
8591 1001,
8592 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
8593 ));
8594 }
8595 if val.chars().count() > 35 {
8596 return Err(ValidationError::new(
8597 1002,
8598 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
8599 ));
8600 }
8601 let pattern = Regex::new(
8602 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8603 )
8604 .unwrap();
8605 if !pattern.is_match(val) {
8606 return Err(ValidationError::new(
8607 1005,
8608 "twn_lctn_nm does not match the required pattern".to_string(),
8609 ));
8610 }
8611 }
8612 if let Some(ref val) = self.dstrct_nm {
8613 if val.chars().count() < 1 {
8614 return Err(ValidationError::new(
8615 1001,
8616 "dstrct_nm is shorter than the minimum length of 1".to_string(),
8617 ));
8618 }
8619 if val.chars().count() > 35 {
8620 return Err(ValidationError::new(
8621 1002,
8622 "dstrct_nm exceeds the maximum length of 35".to_string(),
8623 ));
8624 }
8625 let pattern = Regex::new(
8626 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8627 )
8628 .unwrap();
8629 if !pattern.is_match(val) {
8630 return Err(ValidationError::new(
8631 1005,
8632 "dstrct_nm does not match the required pattern".to_string(),
8633 ));
8634 }
8635 }
8636 if let Some(ref val) = self.ctry_sub_dvsn {
8637 if val.chars().count() < 1 {
8638 return Err(ValidationError::new(
8639 1001,
8640 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
8641 ));
8642 }
8643 if val.chars().count() > 35 {
8644 return Err(ValidationError::new(
8645 1002,
8646 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
8647 ));
8648 }
8649 let pattern = Regex::new(
8650 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8651 )
8652 .unwrap();
8653 if !pattern.is_match(val) {
8654 return Err(ValidationError::new(
8655 1005,
8656 "ctry_sub_dvsn does not match the required pattern".to_string(),
8657 ));
8658 }
8659 }
8660 if let Some(ref val) = self.ctry {
8661 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
8662 if !pattern.is_match(val) {
8663 return Err(ValidationError::new(
8664 1005,
8665 "ctry does not match the required pattern".to_string(),
8666 ));
8667 }
8668 }
8669 if let Some(ref vec) = self.adr_line {
8670 for item in vec {
8671 if item.chars().count() < 1 {
8672 return Err(ValidationError::new(
8673 1001,
8674 "adr_line is shorter than the minimum length of 1".to_string(),
8675 ));
8676 }
8677 if item.chars().count() > 70 {
8678 return Err(ValidationError::new(
8679 1002,
8680 "adr_line exceeds the maximum length of 70".to_string(),
8681 ));
8682 }
8683 let pattern = Regex::new(
8684 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8685 )
8686 .unwrap();
8687 if !pattern.is_match(&item) {
8688 return Err(ValidationError::new(
8689 1005,
8690 "adr_line does not match the required pattern".to_string(),
8691 ));
8692 }
8693 }
8694 }
8695 Ok(())
8696 }
8697}
8698
8699#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8701pub struct PostalAddress243 {
8702 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
8703 pub dept: Option<String>,
8704 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
8705 pub sub_dept: Option<String>,
8706 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
8707 pub strt_nm: Option<String>,
8708 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
8709 pub bldg_nb: Option<String>,
8710 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
8711 pub bldg_nm: Option<String>,
8712 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
8713 pub flr: Option<String>,
8714 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
8715 pub pst_bx: Option<String>,
8716 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
8717 pub room: Option<String>,
8718 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
8719 pub pst_cd: Option<String>,
8720 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
8721 pub twn_nm: Option<String>,
8722 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
8723 pub twn_lctn_nm: Option<String>,
8724 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
8725 pub dstrct_nm: Option<String>,
8726 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
8727 pub ctry_sub_dvsn: Option<String>,
8728 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
8729 pub ctry: Option<String>,
8730 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
8731 pub adr_line: Option<Vec<String>>,
8732}
8733
8734impl PostalAddress243 {
8735 pub fn validate(&self) -> Result<(), ValidationError> {
8736 if let Some(ref val) = self.dept {
8737 if val.chars().count() < 1 {
8738 return Err(ValidationError::new(
8739 1001,
8740 "dept is shorter than the minimum length of 1".to_string(),
8741 ));
8742 }
8743 if val.chars().count() > 70 {
8744 return Err(ValidationError::new(
8745 1002,
8746 "dept exceeds the maximum length of 70".to_string(),
8747 ));
8748 }
8749 let pattern = Regex::new(
8750 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8751 )
8752 .unwrap();
8753 if !pattern.is_match(val) {
8754 return Err(ValidationError::new(
8755 1005,
8756 "dept does not match the required pattern".to_string(),
8757 ));
8758 }
8759 }
8760 if let Some(ref val) = self.sub_dept {
8761 if val.chars().count() < 1 {
8762 return Err(ValidationError::new(
8763 1001,
8764 "sub_dept is shorter than the minimum length of 1".to_string(),
8765 ));
8766 }
8767 if val.chars().count() > 70 {
8768 return Err(ValidationError::new(
8769 1002,
8770 "sub_dept exceeds the maximum length of 70".to_string(),
8771 ));
8772 }
8773 let pattern = Regex::new(
8774 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8775 )
8776 .unwrap();
8777 if !pattern.is_match(val) {
8778 return Err(ValidationError::new(
8779 1005,
8780 "sub_dept does not match the required pattern".to_string(),
8781 ));
8782 }
8783 }
8784 if let Some(ref val) = self.strt_nm {
8785 if val.chars().count() < 1 {
8786 return Err(ValidationError::new(
8787 1001,
8788 "strt_nm is shorter than the minimum length of 1".to_string(),
8789 ));
8790 }
8791 if val.chars().count() > 70 {
8792 return Err(ValidationError::new(
8793 1002,
8794 "strt_nm exceeds the maximum length of 70".to_string(),
8795 ));
8796 }
8797 let pattern = Regex::new(
8798 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8799 )
8800 .unwrap();
8801 if !pattern.is_match(val) {
8802 return Err(ValidationError::new(
8803 1005,
8804 "strt_nm does not match the required pattern".to_string(),
8805 ));
8806 }
8807 }
8808 if let Some(ref val) = self.bldg_nb {
8809 if val.chars().count() < 1 {
8810 return Err(ValidationError::new(
8811 1001,
8812 "bldg_nb is shorter than the minimum length of 1".to_string(),
8813 ));
8814 }
8815 if val.chars().count() > 16 {
8816 return Err(ValidationError::new(
8817 1002,
8818 "bldg_nb exceeds the maximum length of 16".to_string(),
8819 ));
8820 }
8821 let pattern = Regex::new(
8822 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8823 )
8824 .unwrap();
8825 if !pattern.is_match(val) {
8826 return Err(ValidationError::new(
8827 1005,
8828 "bldg_nb does not match the required pattern".to_string(),
8829 ));
8830 }
8831 }
8832 if let Some(ref val) = self.bldg_nm {
8833 if val.chars().count() < 1 {
8834 return Err(ValidationError::new(
8835 1001,
8836 "bldg_nm is shorter than the minimum length of 1".to_string(),
8837 ));
8838 }
8839 if val.chars().count() > 35 {
8840 return Err(ValidationError::new(
8841 1002,
8842 "bldg_nm exceeds the maximum length of 35".to_string(),
8843 ));
8844 }
8845 let pattern = Regex::new(
8846 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8847 )
8848 .unwrap();
8849 if !pattern.is_match(val) {
8850 return Err(ValidationError::new(
8851 1005,
8852 "bldg_nm does not match the required pattern".to_string(),
8853 ));
8854 }
8855 }
8856 if let Some(ref val) = self.flr {
8857 if val.chars().count() < 1 {
8858 return Err(ValidationError::new(
8859 1001,
8860 "flr is shorter than the minimum length of 1".to_string(),
8861 ));
8862 }
8863 if val.chars().count() > 70 {
8864 return Err(ValidationError::new(
8865 1002,
8866 "flr exceeds the maximum length of 70".to_string(),
8867 ));
8868 }
8869 let pattern = Regex::new(
8870 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8871 )
8872 .unwrap();
8873 if !pattern.is_match(val) {
8874 return Err(ValidationError::new(
8875 1005,
8876 "flr does not match the required pattern".to_string(),
8877 ));
8878 }
8879 }
8880 if let Some(ref val) = self.pst_bx {
8881 if val.chars().count() < 1 {
8882 return Err(ValidationError::new(
8883 1001,
8884 "pst_bx is shorter than the minimum length of 1".to_string(),
8885 ));
8886 }
8887 if val.chars().count() > 16 {
8888 return Err(ValidationError::new(
8889 1002,
8890 "pst_bx exceeds the maximum length of 16".to_string(),
8891 ));
8892 }
8893 let pattern = Regex::new(
8894 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8895 )
8896 .unwrap();
8897 if !pattern.is_match(val) {
8898 return Err(ValidationError::new(
8899 1005,
8900 "pst_bx does not match the required pattern".to_string(),
8901 ));
8902 }
8903 }
8904 if let Some(ref val) = self.room {
8905 if val.chars().count() < 1 {
8906 return Err(ValidationError::new(
8907 1001,
8908 "room is shorter than the minimum length of 1".to_string(),
8909 ));
8910 }
8911 if val.chars().count() > 70 {
8912 return Err(ValidationError::new(
8913 1002,
8914 "room exceeds the maximum length of 70".to_string(),
8915 ));
8916 }
8917 let pattern = Regex::new(
8918 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8919 )
8920 .unwrap();
8921 if !pattern.is_match(val) {
8922 return Err(ValidationError::new(
8923 1005,
8924 "room does not match the required pattern".to_string(),
8925 ));
8926 }
8927 }
8928 if let Some(ref val) = self.pst_cd {
8929 if val.chars().count() < 1 {
8930 return Err(ValidationError::new(
8931 1001,
8932 "pst_cd is shorter than the minimum length of 1".to_string(),
8933 ));
8934 }
8935 if val.chars().count() > 16 {
8936 return Err(ValidationError::new(
8937 1002,
8938 "pst_cd exceeds the maximum length of 16".to_string(),
8939 ));
8940 }
8941 let pattern = Regex::new(
8942 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8943 )
8944 .unwrap();
8945 if !pattern.is_match(val) {
8946 return Err(ValidationError::new(
8947 1005,
8948 "pst_cd does not match the required pattern".to_string(),
8949 ));
8950 }
8951 }
8952 if let Some(ref val) = self.twn_nm {
8953 if val.chars().count() < 1 {
8954 return Err(ValidationError::new(
8955 1001,
8956 "twn_nm is shorter than the minimum length of 1".to_string(),
8957 ));
8958 }
8959 if val.chars().count() > 35 {
8960 return Err(ValidationError::new(
8961 1002,
8962 "twn_nm exceeds the maximum length of 35".to_string(),
8963 ));
8964 }
8965 let pattern = Regex::new(
8966 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8967 )
8968 .unwrap();
8969 if !pattern.is_match(val) {
8970 return Err(ValidationError::new(
8971 1005,
8972 "twn_nm does not match the required pattern".to_string(),
8973 ));
8974 }
8975 }
8976 if let Some(ref val) = self.twn_lctn_nm {
8977 if val.chars().count() < 1 {
8978 return Err(ValidationError::new(
8979 1001,
8980 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
8981 ));
8982 }
8983 if val.chars().count() > 35 {
8984 return Err(ValidationError::new(
8985 1002,
8986 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
8987 ));
8988 }
8989 let pattern = Regex::new(
8990 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8991 )
8992 .unwrap();
8993 if !pattern.is_match(val) {
8994 return Err(ValidationError::new(
8995 1005,
8996 "twn_lctn_nm does not match the required pattern".to_string(),
8997 ));
8998 }
8999 }
9000 if let Some(ref val) = self.dstrct_nm {
9001 if val.chars().count() < 1 {
9002 return Err(ValidationError::new(
9003 1001,
9004 "dstrct_nm is shorter than the minimum length of 1".to_string(),
9005 ));
9006 }
9007 if val.chars().count() > 35 {
9008 return Err(ValidationError::new(
9009 1002,
9010 "dstrct_nm exceeds the maximum length of 35".to_string(),
9011 ));
9012 }
9013 let pattern = Regex::new(
9014 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9015 )
9016 .unwrap();
9017 if !pattern.is_match(val) {
9018 return Err(ValidationError::new(
9019 1005,
9020 "dstrct_nm does not match the required pattern".to_string(),
9021 ));
9022 }
9023 }
9024 if let Some(ref val) = self.ctry_sub_dvsn {
9025 if val.chars().count() < 1 {
9026 return Err(ValidationError::new(
9027 1001,
9028 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
9029 ));
9030 }
9031 if val.chars().count() > 35 {
9032 return Err(ValidationError::new(
9033 1002,
9034 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
9035 ));
9036 }
9037 let pattern = Regex::new(
9038 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9039 )
9040 .unwrap();
9041 if !pattern.is_match(val) {
9042 return Err(ValidationError::new(
9043 1005,
9044 "ctry_sub_dvsn does not match the required pattern".to_string(),
9045 ));
9046 }
9047 }
9048 if let Some(ref val) = self.ctry {
9049 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
9050 if !pattern.is_match(val) {
9051 return Err(ValidationError::new(
9052 1005,
9053 "ctry does not match the required pattern".to_string(),
9054 ));
9055 }
9056 }
9057 if let Some(ref vec) = self.adr_line {
9058 for item in vec {
9059 if item.chars().count() < 1 {
9060 return Err(ValidationError::new(
9061 1001,
9062 "adr_line is shorter than the minimum length of 1".to_string(),
9063 ));
9064 }
9065 if item.chars().count() > 70 {
9066 return Err(ValidationError::new(
9067 1002,
9068 "adr_line exceeds the maximum length of 70".to_string(),
9069 ));
9070 }
9071 let pattern = Regex::new(
9072 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9073 )
9074 .unwrap();
9075 if !pattern.is_match(&item) {
9076 return Err(ValidationError::new(
9077 1005,
9078 "adr_line does not match the required pattern".to_string(),
9079 ));
9080 }
9081 }
9082 }
9083 Ok(())
9084 }
9085}
9086
9087#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9089pub struct PostalAddress244 {
9090 #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
9091 pub adr_tp: Option<AddressType3Choice>,
9092 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
9093 pub dept: Option<String>,
9094 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
9095 pub sub_dept: Option<String>,
9096 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
9097 pub strt_nm: Option<String>,
9098 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
9099 pub bldg_nb: Option<String>,
9100 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
9101 pub bldg_nm: Option<String>,
9102 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
9103 pub flr: Option<String>,
9104 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
9105 pub pst_bx: Option<String>,
9106 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
9107 pub room: Option<String>,
9108 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
9109 pub pst_cd: Option<String>,
9110 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
9111 pub twn_nm: Option<String>,
9112 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
9113 pub twn_lctn_nm: Option<String>,
9114 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
9115 pub dstrct_nm: Option<String>,
9116 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
9117 pub ctry_sub_dvsn: Option<String>,
9118 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
9119 pub ctry: Option<String>,
9120 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
9121 pub adr_line: Option<Vec<String>>,
9122}
9123
9124impl PostalAddress244 {
9125 pub fn validate(&self) -> Result<(), ValidationError> {
9126 if let Some(ref val) = self.adr_tp {
9127 val.validate()?
9128 }
9129 if let Some(ref val) = self.dept {
9130 if val.chars().count() < 1 {
9131 return Err(ValidationError::new(
9132 1001,
9133 "dept is shorter than the minimum length of 1".to_string(),
9134 ));
9135 }
9136 if val.chars().count() > 70 {
9137 return Err(ValidationError::new(
9138 1002,
9139 "dept exceeds the maximum length of 70".to_string(),
9140 ));
9141 }
9142 }
9143 if let Some(ref val) = self.sub_dept {
9144 if val.chars().count() < 1 {
9145 return Err(ValidationError::new(
9146 1001,
9147 "sub_dept is shorter than the minimum length of 1".to_string(),
9148 ));
9149 }
9150 if val.chars().count() > 70 {
9151 return Err(ValidationError::new(
9152 1002,
9153 "sub_dept exceeds the maximum length of 70".to_string(),
9154 ));
9155 }
9156 }
9157 if let Some(ref val) = self.strt_nm {
9158 if val.chars().count() < 1 {
9159 return Err(ValidationError::new(
9160 1001,
9161 "strt_nm is shorter than the minimum length of 1".to_string(),
9162 ));
9163 }
9164 if val.chars().count() > 70 {
9165 return Err(ValidationError::new(
9166 1002,
9167 "strt_nm exceeds the maximum length of 70".to_string(),
9168 ));
9169 }
9170 }
9171 if let Some(ref val) = self.bldg_nb {
9172 if val.chars().count() < 1 {
9173 return Err(ValidationError::new(
9174 1001,
9175 "bldg_nb is shorter than the minimum length of 1".to_string(),
9176 ));
9177 }
9178 if val.chars().count() > 16 {
9179 return Err(ValidationError::new(
9180 1002,
9181 "bldg_nb exceeds the maximum length of 16".to_string(),
9182 ));
9183 }
9184 }
9185 if let Some(ref val) = self.bldg_nm {
9186 if val.chars().count() < 1 {
9187 return Err(ValidationError::new(
9188 1001,
9189 "bldg_nm is shorter than the minimum length of 1".to_string(),
9190 ));
9191 }
9192 if val.chars().count() > 35 {
9193 return Err(ValidationError::new(
9194 1002,
9195 "bldg_nm exceeds the maximum length of 35".to_string(),
9196 ));
9197 }
9198 }
9199 if let Some(ref val) = self.flr {
9200 if val.chars().count() < 1 {
9201 return Err(ValidationError::new(
9202 1001,
9203 "flr is shorter than the minimum length of 1".to_string(),
9204 ));
9205 }
9206 if val.chars().count() > 70 {
9207 return Err(ValidationError::new(
9208 1002,
9209 "flr exceeds the maximum length of 70".to_string(),
9210 ));
9211 }
9212 }
9213 if let Some(ref val) = self.pst_bx {
9214 if val.chars().count() < 1 {
9215 return Err(ValidationError::new(
9216 1001,
9217 "pst_bx is shorter than the minimum length of 1".to_string(),
9218 ));
9219 }
9220 if val.chars().count() > 16 {
9221 return Err(ValidationError::new(
9222 1002,
9223 "pst_bx exceeds the maximum length of 16".to_string(),
9224 ));
9225 }
9226 }
9227 if let Some(ref val) = self.room {
9228 if val.chars().count() < 1 {
9229 return Err(ValidationError::new(
9230 1001,
9231 "room is shorter than the minimum length of 1".to_string(),
9232 ));
9233 }
9234 if val.chars().count() > 70 {
9235 return Err(ValidationError::new(
9236 1002,
9237 "room exceeds the maximum length of 70".to_string(),
9238 ));
9239 }
9240 }
9241 if let Some(ref val) = self.pst_cd {
9242 if val.chars().count() < 1 {
9243 return Err(ValidationError::new(
9244 1001,
9245 "pst_cd is shorter than the minimum length of 1".to_string(),
9246 ));
9247 }
9248 if val.chars().count() > 16 {
9249 return Err(ValidationError::new(
9250 1002,
9251 "pst_cd exceeds the maximum length of 16".to_string(),
9252 ));
9253 }
9254 }
9255 if let Some(ref val) = self.twn_nm {
9256 if val.chars().count() < 1 {
9257 return Err(ValidationError::new(
9258 1001,
9259 "twn_nm is shorter than the minimum length of 1".to_string(),
9260 ));
9261 }
9262 if val.chars().count() > 35 {
9263 return Err(ValidationError::new(
9264 1002,
9265 "twn_nm exceeds the maximum length of 35".to_string(),
9266 ));
9267 }
9268 }
9269 if let Some(ref val) = self.twn_lctn_nm {
9270 if val.chars().count() < 1 {
9271 return Err(ValidationError::new(
9272 1001,
9273 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
9274 ));
9275 }
9276 if val.chars().count() > 35 {
9277 return Err(ValidationError::new(
9278 1002,
9279 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
9280 ));
9281 }
9282 }
9283 if let Some(ref val) = self.dstrct_nm {
9284 if val.chars().count() < 1 {
9285 return Err(ValidationError::new(
9286 1001,
9287 "dstrct_nm is shorter than the minimum length of 1".to_string(),
9288 ));
9289 }
9290 if val.chars().count() > 35 {
9291 return Err(ValidationError::new(
9292 1002,
9293 "dstrct_nm exceeds the maximum length of 35".to_string(),
9294 ));
9295 }
9296 }
9297 if let Some(ref val) = self.ctry_sub_dvsn {
9298 if val.chars().count() < 1 {
9299 return Err(ValidationError::new(
9300 1001,
9301 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
9302 ));
9303 }
9304 if val.chars().count() > 35 {
9305 return Err(ValidationError::new(
9306 1002,
9307 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
9308 ));
9309 }
9310 }
9311 if let Some(ref val) = self.ctry {
9312 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
9313 if !pattern.is_match(val) {
9314 return Err(ValidationError::new(
9315 1005,
9316 "ctry does not match the required pattern".to_string(),
9317 ));
9318 }
9319 }
9320 if let Some(ref vec) = self.adr_line {
9321 for item in vec {
9322 if item.chars().count() < 1 {
9323 return Err(ValidationError::new(
9324 1001,
9325 "adr_line is shorter than the minimum length of 1".to_string(),
9326 ));
9327 }
9328 if item.chars().count() > 70 {
9329 return Err(ValidationError::new(
9330 1002,
9331 "adr_line exceeds the maximum length of 70".to_string(),
9332 ));
9333 }
9334 let pattern = Regex::new(
9335 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9336 )
9337 .unwrap();
9338 if !pattern.is_match(&item) {
9339 return Err(ValidationError::new(
9340 1005,
9341 "adr_line does not match the required pattern".to_string(),
9342 ));
9343 }
9344 }
9345 }
9346 Ok(())
9347 }
9348}
9349
9350#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9352pub enum PreferredContactMethod1Code {
9353 #[default]
9354 #[serde(rename = "LETT")]
9355 CodeLETT,
9356 #[serde(rename = "MAIL")]
9357 CodeMAIL,
9358 #[serde(rename = "PHON")]
9359 CodePHON,
9360 #[serde(rename = "FAXX")]
9361 CodeFAXX,
9362 #[serde(rename = "CELL")]
9363 CodeCELL,
9364}
9365
9366impl PreferredContactMethod1Code {
9367 pub fn validate(&self) -> Result<(), ValidationError> {
9368 Ok(())
9369 }
9370}
9371
9372#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9374pub struct Price7 {
9375 #[serde(rename = "Tp")]
9376 pub tp: YieldedOrValueType1Choice,
9377 #[serde(rename = "Val")]
9378 pub val: PriceRateOrAmount3Choice,
9379}
9380
9381impl Price7 {
9382 pub fn validate(&self) -> Result<(), ValidationError> {
9383 self.tp.validate()?;
9384 self.val.validate()?;
9385 Ok(())
9386 }
9387}
9388
9389#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9391pub struct PriceRateOrAmount3Choice {
9392 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9393 pub rate: Option<f64>,
9394 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
9395 pub amt: Option<ActiveOrHistoricCurrencyAnd13DecimalAmount>,
9396}
9397
9398impl PriceRateOrAmount3Choice {
9399 pub fn validate(&self) -> Result<(), ValidationError> {
9400 if let Some(ref val) = self.amt {
9401 val.validate()?
9402 }
9403 Ok(())
9404 }
9405}
9406
9407#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9409pub enum PriceValueType1Code {
9410 #[default]
9411 #[serde(rename = "DISC")]
9412 CodeDISC,
9413 #[serde(rename = "PREM")]
9414 CodePREM,
9415 #[serde(rename = "PARV")]
9416 CodePARV,
9417}
9418
9419impl PriceValueType1Code {
9420 pub fn validate(&self) -> Result<(), ValidationError> {
9421 Ok(())
9422 }
9423}
9424
9425#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9427pub struct Product21 {
9428 #[serde(rename = "PdctCd")]
9429 pub pdct_cd: String,
9430 #[serde(rename = "UnitOfMeasr", skip_serializing_if = "Option::is_none")]
9431 pub unit_of_measr: Option<UnitOfMeasure1Code>,
9432 #[serde(rename = "PdctQty", skip_serializing_if = "Option::is_none")]
9433 pub pdct_qty: Option<f64>,
9434 #[serde(rename = "UnitPric", skip_serializing_if = "Option::is_none")]
9435 pub unit_pric: Option<f64>,
9436 #[serde(rename = "PdctAmt", skip_serializing_if = "Option::is_none")]
9437 pub pdct_amt: Option<f64>,
9438 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
9439 pub tax_tp: Option<String>,
9440 #[serde(rename = "AddtlPdctInf", skip_serializing_if = "Option::is_none")]
9441 pub addtl_pdct_inf: Option<String>,
9442}
9443
9444impl Product21 {
9445 pub fn validate(&self) -> Result<(), ValidationError> {
9446 if self.pdct_cd.chars().count() < 1 {
9447 return Err(ValidationError::new(
9448 1001,
9449 "pdct_cd is shorter than the minimum length of 1".to_string(),
9450 ));
9451 }
9452 if self.pdct_cd.chars().count() > 70 {
9453 return Err(ValidationError::new(
9454 1002,
9455 "pdct_cd exceeds the maximum length of 70".to_string(),
9456 ));
9457 }
9458 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9459 if !pattern.is_match(&self.pdct_cd) {
9460 return Err(ValidationError::new(
9461 1005,
9462 "pdct_cd does not match the required pattern".to_string(),
9463 ));
9464 }
9465 if let Some(ref val) = self.unit_of_measr {
9466 val.validate()?
9467 }
9468 if let Some(ref val) = self.tax_tp {
9469 if val.chars().count() < 1 {
9470 return Err(ValidationError::new(
9471 1001,
9472 "tax_tp is shorter than the minimum length of 1".to_string(),
9473 ));
9474 }
9475 if val.chars().count() > 35 {
9476 return Err(ValidationError::new(
9477 1002,
9478 "tax_tp exceeds the maximum length of 35".to_string(),
9479 ));
9480 }
9481 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9482 if !pattern.is_match(val) {
9483 return Err(ValidationError::new(
9484 1005,
9485 "tax_tp does not match the required pattern".to_string(),
9486 ));
9487 }
9488 }
9489 if let Some(ref val) = self.addtl_pdct_inf {
9490 if val.chars().count() < 1 {
9491 return Err(ValidationError::new(
9492 1001,
9493 "addtl_pdct_inf is shorter than the minimum length of 1".to_string(),
9494 ));
9495 }
9496 if val.chars().count() > 35 {
9497 return Err(ValidationError::new(
9498 1002,
9499 "addtl_pdct_inf exceeds the maximum length of 35".to_string(),
9500 ));
9501 }
9502 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9503 if !pattern.is_match(val) {
9504 return Err(ValidationError::new(
9505 1005,
9506 "addtl_pdct_inf does not match the required pattern".to_string(),
9507 ));
9508 }
9509 }
9510 Ok(())
9511 }
9512}
9513
9514#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9516pub struct ProprietaryAgent41 {
9517 #[serde(rename = "Tp")]
9518 pub tp: String,
9519 #[serde(rename = "Agt")]
9520 pub agt: BranchAndFinancialInstitutionIdentification65,
9521}
9522
9523impl ProprietaryAgent41 {
9524 pub fn validate(&self) -> Result<(), ValidationError> {
9525 if self.tp.chars().count() < 1 {
9526 return Err(ValidationError::new(
9527 1001,
9528 "tp is shorter than the minimum length of 1".to_string(),
9529 ));
9530 }
9531 if self.tp.chars().count() > 35 {
9532 return Err(ValidationError::new(
9533 1002,
9534 "tp exceeds the maximum length of 35".to_string(),
9535 ));
9536 }
9537 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9538 if !pattern.is_match(&self.tp) {
9539 return Err(ValidationError::new(
9540 1005,
9541 "tp does not match the required pattern".to_string(),
9542 ));
9543 }
9544 self.agt.validate()?;
9545 Ok(())
9546 }
9547}
9548
9549#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9551pub struct ProprietaryBankTransactionCodeStructure11 {
9552 #[serde(rename = "Cd")]
9553 pub cd: String,
9554 #[serde(rename = "Issr")]
9555 pub issr: String,
9556}
9557
9558impl ProprietaryBankTransactionCodeStructure11 {
9559 pub fn validate(&self) -> Result<(), ValidationError> {
9560 if self.cd.chars().count() < 1 {
9561 return Err(ValidationError::new(
9562 1001,
9563 "cd is shorter than the minimum length of 1".to_string(),
9564 ));
9565 }
9566 if self.cd.chars().count() > 35 {
9567 return Err(ValidationError::new(
9568 1002,
9569 "cd exceeds the maximum length of 35".to_string(),
9570 ));
9571 }
9572 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9573 if !pattern.is_match(&self.cd) {
9574 return Err(ValidationError::new(
9575 1005,
9576 "cd does not match the required pattern".to_string(),
9577 ));
9578 }
9579 if self.issr.chars().count() < 1 {
9580 return Err(ValidationError::new(
9581 1001,
9582 "issr is shorter than the minimum length of 1".to_string(),
9583 ));
9584 }
9585 if self.issr.chars().count() > 35 {
9586 return Err(ValidationError::new(
9587 1002,
9588 "issr exceeds the maximum length of 35".to_string(),
9589 ));
9590 }
9591 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9592 if !pattern.is_match(&self.issr) {
9593 return Err(ValidationError::new(
9594 1005,
9595 "issr does not match the required pattern".to_string(),
9596 ));
9597 }
9598 Ok(())
9599 }
9600}
9601
9602#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9604pub struct ProprietaryDate31 {
9605 #[serde(rename = "Tp")]
9606 pub tp: String,
9607 #[serde(rename = "Dt")]
9608 pub dt: DateAndDateTime2Choice1,
9609}
9610
9611impl ProprietaryDate31 {
9612 pub fn validate(&self) -> Result<(), ValidationError> {
9613 if self.tp.chars().count() < 1 {
9614 return Err(ValidationError::new(
9615 1001,
9616 "tp is shorter than the minimum length of 1".to_string(),
9617 ));
9618 }
9619 if self.tp.chars().count() > 35 {
9620 return Err(ValidationError::new(
9621 1002,
9622 "tp exceeds the maximum length of 35".to_string(),
9623 ));
9624 }
9625 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9626 if !pattern.is_match(&self.tp) {
9627 return Err(ValidationError::new(
9628 1005,
9629 "tp does not match the required pattern".to_string(),
9630 ));
9631 }
9632 self.dt.validate()?;
9633 Ok(())
9634 }
9635}
9636
9637#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9639pub struct ProprietaryParty51 {
9640 #[serde(rename = "Tp")]
9641 pub tp: String,
9642 #[serde(rename = "Pty")]
9643 pub pty: Party40Choice5,
9644}
9645
9646impl ProprietaryParty51 {
9647 pub fn validate(&self) -> Result<(), ValidationError> {
9648 if self.tp.chars().count() < 1 {
9649 return Err(ValidationError::new(
9650 1001,
9651 "tp is shorter than the minimum length of 1".to_string(),
9652 ));
9653 }
9654 if self.tp.chars().count() > 35 {
9655 return Err(ValidationError::new(
9656 1002,
9657 "tp exceeds the maximum length of 35".to_string(),
9658 ));
9659 }
9660 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9661 if !pattern.is_match(&self.tp) {
9662 return Err(ValidationError::new(
9663 1005,
9664 "tp does not match the required pattern".to_string(),
9665 ));
9666 }
9667 self.pty.validate()?;
9668 Ok(())
9669 }
9670}
9671
9672#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9674pub struct ProprietaryPrice21 {
9675 #[serde(rename = "Tp")]
9676 pub tp: String,
9677 #[serde(rename = "Pric")]
9678 pub pric: ActiveOrHistoricCurrencyAndAmount,
9679}
9680
9681impl ProprietaryPrice21 {
9682 pub fn validate(&self) -> Result<(), ValidationError> {
9683 if self.tp.chars().count() < 1 {
9684 return Err(ValidationError::new(
9685 1001,
9686 "tp is shorter than the minimum length of 1".to_string(),
9687 ));
9688 }
9689 if self.tp.chars().count() > 35 {
9690 return Err(ValidationError::new(
9691 1002,
9692 "tp exceeds the maximum length of 35".to_string(),
9693 ));
9694 }
9695 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9696 if !pattern.is_match(&self.tp) {
9697 return Err(ValidationError::new(
9698 1005,
9699 "tp does not match the required pattern".to_string(),
9700 ));
9701 }
9702 self.pric.validate()?;
9703 Ok(())
9704 }
9705}
9706
9707#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9709pub struct ProprietaryQuantity11 {
9710 #[serde(rename = "Tp")]
9711 pub tp: String,
9712 #[serde(rename = "Qty")]
9713 pub qty: String,
9714}
9715
9716impl ProprietaryQuantity11 {
9717 pub fn validate(&self) -> Result<(), ValidationError> {
9718 if self.tp.chars().count() < 1 {
9719 return Err(ValidationError::new(
9720 1001,
9721 "tp is shorter than the minimum length of 1".to_string(),
9722 ));
9723 }
9724 if self.tp.chars().count() > 35 {
9725 return Err(ValidationError::new(
9726 1002,
9727 "tp exceeds the maximum length of 35".to_string(),
9728 ));
9729 }
9730 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9731 if !pattern.is_match(&self.tp) {
9732 return Err(ValidationError::new(
9733 1005,
9734 "tp does not match the required pattern".to_string(),
9735 ));
9736 }
9737 if self.qty.chars().count() < 1 {
9738 return Err(ValidationError::new(
9739 1001,
9740 "qty is shorter than the minimum length of 1".to_string(),
9741 ));
9742 }
9743 if self.qty.chars().count() > 35 {
9744 return Err(ValidationError::new(
9745 1002,
9746 "qty exceeds the maximum length of 35".to_string(),
9747 ));
9748 }
9749 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9750 if !pattern.is_match(&self.qty) {
9751 return Err(ValidationError::new(
9752 1005,
9753 "qty does not match the required pattern".to_string(),
9754 ));
9755 }
9756 Ok(())
9757 }
9758}
9759
9760#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9762pub struct ProprietaryReference11 {
9763 #[serde(rename = "Tp")]
9764 pub tp: String,
9765 #[serde(rename = "Ref")]
9766 pub ref_attr: String,
9767}
9768
9769impl ProprietaryReference11 {
9770 pub fn validate(&self) -> Result<(), ValidationError> {
9771 if self.tp.chars().count() < 1 {
9772 return Err(ValidationError::new(
9773 1001,
9774 "tp is shorter than the minimum length of 1".to_string(),
9775 ));
9776 }
9777 if self.tp.chars().count() > 35 {
9778 return Err(ValidationError::new(
9779 1002,
9780 "tp exceeds the maximum length of 35".to_string(),
9781 ));
9782 }
9783 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9784 if !pattern.is_match(&self.tp) {
9785 return Err(ValidationError::new(
9786 1005,
9787 "tp does not match the required pattern".to_string(),
9788 ));
9789 }
9790 if self.ref_attr.chars().count() < 1 {
9791 return Err(ValidationError::new(
9792 1001,
9793 "ref_attr is shorter than the minimum length of 1".to_string(),
9794 ));
9795 }
9796 if self.ref_attr.chars().count() > 35 {
9797 return Err(ValidationError::new(
9798 1002,
9799 "ref_attr exceeds the maximum length of 35".to_string(),
9800 ));
9801 }
9802 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9803 if !pattern.is_match(&self.ref_attr) {
9804 return Err(ValidationError::new(
9805 1005,
9806 "ref_attr does not match the required pattern".to_string(),
9807 ));
9808 }
9809 Ok(())
9810 }
9811}
9812
9813#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9815pub struct ProxyAccountIdentification11 {
9816 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9817 pub tp: Option<ProxyAccountType1Choice1>,
9818 #[serde(rename = "Id")]
9819 pub id: String,
9820}
9821
9822impl ProxyAccountIdentification11 {
9823 pub fn validate(&self) -> Result<(), ValidationError> {
9824 if let Some(ref val) = self.tp {
9825 val.validate()?
9826 }
9827 if self.id.chars().count() < 1 {
9828 return Err(ValidationError::new(
9829 1001,
9830 "id is shorter than the minimum length of 1".to_string(),
9831 ));
9832 }
9833 if self.id.chars().count() > 320 {
9834 return Err(ValidationError::new(
9835 1002,
9836 "id exceeds the maximum length of 320".to_string(),
9837 ));
9838 }
9839 let pattern =
9840 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
9841 .unwrap();
9842 if !pattern.is_match(&self.id) {
9843 return Err(ValidationError::new(
9844 1005,
9845 "id does not match the required pattern".to_string(),
9846 ));
9847 }
9848 Ok(())
9849 }
9850}
9851
9852#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9854pub struct ProxyAccountIdentification12 {
9855 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9856 pub tp: Option<ProxyAccountType1Choice1>,
9857 #[serde(rename = "Id")]
9858 pub id: String,
9859}
9860
9861impl ProxyAccountIdentification12 {
9862 pub fn validate(&self) -> Result<(), ValidationError> {
9863 if let Some(ref val) = self.tp {
9864 val.validate()?
9865 }
9866 if self.id.chars().count() < 1 {
9867 return Err(ValidationError::new(
9868 1001,
9869 "id is shorter than the minimum length of 1".to_string(),
9870 ));
9871 }
9872 if self.id.chars().count() > 2048 {
9873 return Err(ValidationError::new(
9874 1002,
9875 "id exceeds the maximum length of 2048".to_string(),
9876 ));
9877 }
9878 Ok(())
9879 }
9880}
9881
9882#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9884pub struct ProxyAccountIdentification13 {
9885 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9886 pub tp: Option<ProxyAccountType1Choice>,
9887 #[serde(rename = "Id")]
9888 pub id: String,
9889}
9890
9891impl ProxyAccountIdentification13 {
9892 pub fn validate(&self) -> Result<(), ValidationError> {
9893 if let Some(ref val) = self.tp {
9894 val.validate()?
9895 }
9896 if self.id.chars().count() < 1 {
9897 return Err(ValidationError::new(
9898 1001,
9899 "id is shorter than the minimum length of 1".to_string(),
9900 ));
9901 }
9902 if self.id.chars().count() > 320 {
9903 return Err(ValidationError::new(
9904 1002,
9905 "id exceeds the maximum length of 320".to_string(),
9906 ));
9907 }
9908 let pattern =
9909 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
9910 .unwrap();
9911 if !pattern.is_match(&self.id) {
9912 return Err(ValidationError::new(
9913 1005,
9914 "id does not match the required pattern".to_string(),
9915 ));
9916 }
9917 Ok(())
9918 }
9919}
9920
9921#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9923pub struct ProxyAccountType1Choice {
9924 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9925 pub cd: Option<String>,
9926 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9927 pub prtry: Option<String>,
9928}
9929
9930impl ProxyAccountType1Choice {
9931 pub fn validate(&self) -> Result<(), ValidationError> {
9932 if let Some(ref val) = self.cd {
9933 if val.chars().count() < 1 {
9934 return Err(ValidationError::new(
9935 1001,
9936 "cd is shorter than the minimum length of 1".to_string(),
9937 ));
9938 }
9939 if val.chars().count() > 4 {
9940 return Err(ValidationError::new(
9941 1002,
9942 "cd exceeds the maximum length of 4".to_string(),
9943 ));
9944 }
9945 }
9946 if let Some(ref val) = self.prtry {
9947 if val.chars().count() < 1 {
9948 return Err(ValidationError::new(
9949 1001,
9950 "prtry is shorter than the minimum length of 1".to_string(),
9951 ));
9952 }
9953 if val.chars().count() > 35 {
9954 return Err(ValidationError::new(
9955 1002,
9956 "prtry exceeds the maximum length of 35".to_string(),
9957 ));
9958 }
9959 }
9960 Ok(())
9961 }
9962}
9963
9964#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9966pub struct ProxyAccountType1Choice1 {
9967 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9968 pub cd: Option<String>,
9969 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9970 pub prtry: Option<String>,
9971}
9972
9973impl ProxyAccountType1Choice1 {
9974 pub fn validate(&self) -> Result<(), ValidationError> {
9975 if let Some(ref val) = self.cd {
9976 if val.chars().count() < 1 {
9977 return Err(ValidationError::new(
9978 1001,
9979 "cd is shorter than the minimum length of 1".to_string(),
9980 ));
9981 }
9982 if val.chars().count() > 4 {
9983 return Err(ValidationError::new(
9984 1002,
9985 "cd exceeds the maximum length of 4".to_string(),
9986 ));
9987 }
9988 }
9989 if let Some(ref val) = self.prtry {
9990 if val.chars().count() < 1 {
9991 return Err(ValidationError::new(
9992 1001,
9993 "prtry is shorter than the minimum length of 1".to_string(),
9994 ));
9995 }
9996 if val.chars().count() > 35 {
9997 return Err(ValidationError::new(
9998 1002,
9999 "prtry exceeds the maximum length of 35".to_string(),
10000 ));
10001 }
10002 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10003 if !pattern.is_match(val) {
10004 return Err(ValidationError::new(
10005 1005,
10006 "prtry does not match the required pattern".to_string(),
10007 ));
10008 }
10009 }
10010 Ok(())
10011 }
10012}
10013
10014#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10016pub struct Purpose2Choice1 {
10017 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10018 pub cd: Option<String>,
10019 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10020 pub prtry: Option<String>,
10021}
10022
10023impl Purpose2Choice1 {
10024 pub fn validate(&self) -> Result<(), ValidationError> {
10025 if let Some(ref val) = self.cd {
10026 if val.chars().count() < 1 {
10027 return Err(ValidationError::new(
10028 1001,
10029 "cd is shorter than the minimum length of 1".to_string(),
10030 ));
10031 }
10032 if val.chars().count() > 4 {
10033 return Err(ValidationError::new(
10034 1002,
10035 "cd exceeds the maximum length of 4".to_string(),
10036 ));
10037 }
10038 }
10039 if let Some(ref val) = self.prtry {
10040 if val.chars().count() < 1 {
10041 return Err(ValidationError::new(
10042 1001,
10043 "prtry is shorter than the minimum length of 1".to_string(),
10044 ));
10045 }
10046 if val.chars().count() > 35 {
10047 return Err(ValidationError::new(
10048 1002,
10049 "prtry exceeds the maximum length of 35".to_string(),
10050 ));
10051 }
10052 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10053 if !pattern.is_match(val) {
10054 return Err(ValidationError::new(
10055 1005,
10056 "prtry does not match the required pattern".to_string(),
10057 ));
10058 }
10059 }
10060 Ok(())
10061 }
10062}
10063
10064#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10066pub struct Rate41 {
10067 #[serde(rename = "Tp")]
10068 pub tp: RateType4Choice1,
10069 #[serde(rename = "VldtyRg", skip_serializing_if = "Option::is_none")]
10070 pub vldty_rg: Option<ActiveOrHistoricCurrencyAndAmountRange2>,
10071}
10072
10073impl Rate41 {
10074 pub fn validate(&self) -> Result<(), ValidationError> {
10075 self.tp.validate()?;
10076 if let Some(ref val) = self.vldty_rg {
10077 val.validate()?
10078 }
10079 Ok(())
10080 }
10081}
10082
10083#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10085pub struct RateType4Choice1 {
10086 #[serde(rename = "Pctg", skip_serializing_if = "Option::is_none")]
10087 pub pctg: Option<f64>,
10088 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
10089 pub othr: Option<String>,
10090}
10091
10092impl RateType4Choice1 {
10093 pub fn validate(&self) -> Result<(), ValidationError> {
10094 if let Some(ref val) = self.othr {
10095 if val.chars().count() < 1 {
10096 return Err(ValidationError::new(
10097 1001,
10098 "othr is shorter than the minimum length of 1".to_string(),
10099 ));
10100 }
10101 if val.chars().count() > 35 {
10102 return Err(ValidationError::new(
10103 1002,
10104 "othr exceeds the maximum length of 35".to_string(),
10105 ));
10106 }
10107 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10108 if !pattern.is_match(val) {
10109 return Err(ValidationError::new(
10110 1005,
10111 "othr does not match the required pattern".to_string(),
10112 ));
10113 }
10114 }
10115 Ok(())
10116 }
10117}
10118
10119#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10121pub struct ReferredDocumentInformation71 {
10122 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10123 pub tp: Option<ReferredDocumentType41>,
10124 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
10125 pub nb: Option<String>,
10126 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
10127 pub rltd_dt: Option<String>,
10128 #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
10129 pub line_dtls: Option<Vec<DocumentLineInformation11>>,
10130}
10131
10132impl ReferredDocumentInformation71 {
10133 pub fn validate(&self) -> Result<(), ValidationError> {
10134 if let Some(ref val) = self.tp {
10135 val.validate()?
10136 }
10137 if let Some(ref val) = self.nb {
10138 if val.chars().count() < 1 {
10139 return Err(ValidationError::new(
10140 1001,
10141 "nb is shorter than the minimum length of 1".to_string(),
10142 ));
10143 }
10144 if val.chars().count() > 35 {
10145 return Err(ValidationError::new(
10146 1002,
10147 "nb exceeds the maximum length of 35".to_string(),
10148 ));
10149 }
10150 let pattern = Regex::new(
10151 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10152 )
10153 .unwrap();
10154 if !pattern.is_match(val) {
10155 return Err(ValidationError::new(
10156 1005,
10157 "nb does not match the required pattern".to_string(),
10158 ));
10159 }
10160 }
10161 if let Some(ref vec) = self.line_dtls {
10162 for item in vec {
10163 item.validate()?
10164 }
10165 }
10166 Ok(())
10167 }
10168}
10169
10170#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10172pub struct ReferredDocumentType3Choice1 {
10173 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10174 pub cd: Option<DocumentType6Code>,
10175 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10176 pub prtry: Option<String>,
10177}
10178
10179impl ReferredDocumentType3Choice1 {
10180 pub fn validate(&self) -> Result<(), ValidationError> {
10181 if let Some(ref val) = self.cd {
10182 val.validate()?
10183 }
10184 if let Some(ref val) = self.prtry {
10185 if val.chars().count() < 1 {
10186 return Err(ValidationError::new(
10187 1001,
10188 "prtry is shorter than the minimum length of 1".to_string(),
10189 ));
10190 }
10191 if val.chars().count() > 35 {
10192 return Err(ValidationError::new(
10193 1002,
10194 "prtry exceeds the maximum length of 35".to_string(),
10195 ));
10196 }
10197 let pattern = Regex::new(
10198 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10199 )
10200 .unwrap();
10201 if !pattern.is_match(val) {
10202 return Err(ValidationError::new(
10203 1005,
10204 "prtry does not match the required pattern".to_string(),
10205 ));
10206 }
10207 }
10208 Ok(())
10209 }
10210}
10211
10212#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10214pub struct ReferredDocumentType41 {
10215 #[serde(rename = "CdOrPrtry")]
10216 pub cd_or_prtry: ReferredDocumentType3Choice1,
10217 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
10218 pub issr: Option<String>,
10219}
10220
10221impl ReferredDocumentType41 {
10222 pub fn validate(&self) -> Result<(), ValidationError> {
10223 self.cd_or_prtry.validate()?;
10224 if let Some(ref val) = self.issr {
10225 if val.chars().count() < 1 {
10226 return Err(ValidationError::new(
10227 1001,
10228 "issr is shorter than the minimum length of 1".to_string(),
10229 ));
10230 }
10231 if val.chars().count() > 35 {
10232 return Err(ValidationError::new(
10233 1002,
10234 "issr exceeds the maximum length of 35".to_string(),
10235 ));
10236 }
10237 let pattern = Regex::new(
10238 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10239 )
10240 .unwrap();
10241 if !pattern.is_match(val) {
10242 return Err(ValidationError::new(
10243 1005,
10244 "issr does not match the required pattern".to_string(),
10245 ));
10246 }
10247 }
10248 Ok(())
10249 }
10250}
10251
10252#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10254pub struct RemittanceAmount21 {
10255 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
10256 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10257 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
10258 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType12>>,
10259 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
10260 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10261 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10262 pub tax_amt: Option<Vec<TaxAmountAndType11>>,
10263 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
10264 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
10265 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
10266 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10267}
10268
10269impl RemittanceAmount21 {
10270 pub fn validate(&self) -> Result<(), ValidationError> {
10271 if let Some(ref val) = self.due_pybl_amt {
10272 val.validate()?
10273 }
10274 if let Some(ref vec) = self.dscnt_apld_amt {
10275 for item in vec {
10276 item.validate()?
10277 }
10278 }
10279 if let Some(ref val) = self.cdt_note_amt {
10280 val.validate()?
10281 }
10282 if let Some(ref vec) = self.tax_amt {
10283 for item in vec {
10284 item.validate()?
10285 }
10286 }
10287 if let Some(ref vec) = self.adjstmnt_amt_and_rsn {
10288 for item in vec {
10289 item.validate()?
10290 }
10291 }
10292 if let Some(ref val) = self.rmtd_amt {
10293 val.validate()?
10294 }
10295 Ok(())
10296 }
10297}
10298
10299#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10301pub struct RemittanceAmount31 {
10302 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
10303 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10304 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
10305 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
10306 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
10307 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10308 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10309 pub tax_amt: Option<Vec<TaxAmountAndType11>>,
10310 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
10311 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
10312 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
10313 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
10314}
10315
10316impl RemittanceAmount31 {
10317 pub fn validate(&self) -> Result<(), ValidationError> {
10318 if let Some(ref val) = self.due_pybl_amt {
10319 val.validate()?
10320 }
10321 if let Some(ref vec) = self.dscnt_apld_amt {
10322 for item in vec {
10323 item.validate()?
10324 }
10325 }
10326 if let Some(ref val) = self.cdt_note_amt {
10327 val.validate()?
10328 }
10329 if let Some(ref vec) = self.tax_amt {
10330 for item in vec {
10331 item.validate()?
10332 }
10333 }
10334 if let Some(ref vec) = self.adjstmnt_amt_and_rsn {
10335 for item in vec {
10336 item.validate()?
10337 }
10338 }
10339 if let Some(ref val) = self.rmtd_amt {
10340 val.validate()?
10341 }
10342 Ok(())
10343 }
10344}
10345
10346#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10348pub struct RemittanceInformation161 {
10349 #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
10350 pub ustrd: Option<String>,
10351 #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
10352 pub strd: Option<Vec<StructuredRemittanceInformation161>>,
10353}
10354
10355impl RemittanceInformation161 {
10356 pub fn validate(&self) -> Result<(), ValidationError> {
10357 if let Some(ref val) = self.ustrd {
10358 if val.chars().count() < 1 {
10359 return Err(ValidationError::new(
10360 1001,
10361 "ustrd is shorter than the minimum length of 1".to_string(),
10362 ));
10363 }
10364 if val.chars().count() > 140 {
10365 return Err(ValidationError::new(
10366 1002,
10367 "ustrd exceeds the maximum length of 140".to_string(),
10368 ));
10369 }
10370 let pattern = Regex::new(
10371 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10372 )
10373 .unwrap();
10374 if !pattern.is_match(val) {
10375 return Err(ValidationError::new(
10376 1005,
10377 "ustrd does not match the required pattern".to_string(),
10378 ));
10379 }
10380 }
10381 if let Some(ref vec) = self.strd {
10382 for item in vec {
10383 item.validate()?
10384 }
10385 }
10386 Ok(())
10387 }
10388}
10389
10390#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10392pub struct RemittanceLocation71 {
10393 #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
10394 pub rmt_id: Option<String>,
10395 #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
10396 pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
10397}
10398
10399impl RemittanceLocation71 {
10400 pub fn validate(&self) -> Result<(), ValidationError> {
10401 if let Some(ref val) = self.rmt_id {
10402 if val.chars().count() < 1 {
10403 return Err(ValidationError::new(
10404 1001,
10405 "rmt_id is shorter than the minimum length of 1".to_string(),
10406 ));
10407 }
10408 if val.chars().count() > 35 {
10409 return Err(ValidationError::new(
10410 1002,
10411 "rmt_id exceeds the maximum length of 35".to_string(),
10412 ));
10413 }
10414 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10415 if !pattern.is_match(val) {
10416 return Err(ValidationError::new(
10417 1005,
10418 "rmt_id does not match the required pattern".to_string(),
10419 ));
10420 }
10421 }
10422 if let Some(ref vec) = self.rmt_lctn_dtls {
10423 for item in vec {
10424 item.validate()?
10425 }
10426 }
10427 Ok(())
10428 }
10429}
10430
10431#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10433pub struct RemittanceLocationData11 {
10434 #[serde(rename = "Mtd")]
10435 pub mtd: RemittanceLocationMethod2Code,
10436 #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
10437 pub elctrnc_adr: Option<String>,
10438 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
10439 pub pstl_adr: Option<NameAndAddress161>,
10440}
10441
10442impl RemittanceLocationData11 {
10443 pub fn validate(&self) -> Result<(), ValidationError> {
10444 self.mtd.validate()?;
10445 if let Some(ref val) = self.elctrnc_adr {
10446 if val.chars().count() < 1 {
10447 return Err(ValidationError::new(
10448 1001,
10449 "elctrnc_adr is shorter than the minimum length of 1".to_string(),
10450 ));
10451 }
10452 if val.chars().count() > 2048 {
10453 return Err(ValidationError::new(
10454 1002,
10455 "elctrnc_adr exceeds the maximum length of 2048".to_string(),
10456 ));
10457 }
10458 let pattern = Regex::new(
10459 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10460 )
10461 .unwrap();
10462 if !pattern.is_match(val) {
10463 return Err(ValidationError::new(
10464 1005,
10465 "elctrnc_adr does not match the required pattern".to_string(),
10466 ));
10467 }
10468 }
10469 if let Some(ref val) = self.pstl_adr {
10470 val.validate()?
10471 }
10472 Ok(())
10473 }
10474}
10475
10476#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10478pub enum RemittanceLocationMethod2Code {
10479 #[default]
10480 #[serde(rename = "FAXI")]
10481 CodeFAXI,
10482 #[serde(rename = "EDIC")]
10483 CodeEDIC,
10484 #[serde(rename = "URID")]
10485 CodeURID,
10486 #[serde(rename = "EMAL")]
10487 CodeEMAL,
10488 #[serde(rename = "POST")]
10489 CodePOST,
10490 #[serde(rename = "SMSM")]
10491 CodeSMSM,
10492}
10493
10494impl RemittanceLocationMethod2Code {
10495 pub fn validate(&self) -> Result<(), ValidationError> {
10496 Ok(())
10497 }
10498}
10499
10500#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10502pub struct ReportEntry101 {
10503 #[serde(rename = "NtryRef")]
10504 pub ntry_ref: String,
10505 #[serde(rename = "Amt")]
10506 pub amt: ActiveOrHistoricCurrencyAndAmount,
10507 #[serde(rename = "CdtDbtInd")]
10508 pub cdt_dbt_ind: CreditDebitCode,
10509 #[serde(rename = "RvslInd", skip_serializing_if = "Option::is_none")]
10510 pub rvsl_ind: Option<bool>,
10511 #[serde(rename = "Sts")]
10512 pub sts: EntryStatus1Choice1,
10513 #[serde(rename = "BookgDt", skip_serializing_if = "Option::is_none")]
10514 pub bookg_dt: Option<DateAndDateTime2Choice2>,
10515 #[serde(rename = "ValDt", skip_serializing_if = "Option::is_none")]
10516 pub val_dt: Option<DateAndDateTime2Choice1>,
10517 #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
10518 pub acct_svcr_ref: Option<String>,
10519 #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
10520 pub avlbty: Option<Vec<CashAvailability1>>,
10521 #[serde(rename = "BkTxCd")]
10522 pub bk_tx_cd: BankTransactionCodeStructure41,
10523 #[serde(rename = "ComssnWvrInd", skip_serializing_if = "Option::is_none")]
10524 pub comssn_wvr_ind: Option<bool>,
10525 #[serde(rename = "AddtlInfInd", skip_serializing_if = "Option::is_none")]
10526 pub addtl_inf_ind: Option<MessageIdentification21>,
10527 #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
10528 pub amt_dtls: Option<AmountAndCurrencyExchange31>,
10529 #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
10530 pub chrgs: Option<Charges61>,
10531 #[serde(rename = "TechInptChanl", skip_serializing_if = "Option::is_none")]
10532 pub tech_inpt_chanl: Option<TechnicalInputChannel1Choice1>,
10533 #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
10534 pub intrst: Option<TransactionInterest41>,
10535 #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
10536 pub card_tx: Option<CardEntry41>,
10537 #[serde(rename = "NtryDtls", skip_serializing_if = "Option::is_none")]
10538 pub ntry_dtls: Option<Vec<EntryDetails91>>,
10539 #[serde(rename = "AddtlNtryInf", skip_serializing_if = "Option::is_none")]
10540 pub addtl_ntry_inf: Option<String>,
10541}
10542
10543impl ReportEntry101 {
10544 pub fn validate(&self) -> Result<(), ValidationError> {
10545 if self.ntry_ref.chars().count() < 1 {
10546 return Err(ValidationError::new(
10547 1001,
10548 "ntry_ref is shorter than the minimum length of 1".to_string(),
10549 ));
10550 }
10551 if self.ntry_ref.chars().count() > 16 {
10552 return Err(ValidationError::new(
10553 1002,
10554 "ntry_ref exceeds the maximum length of 16".to_string(),
10555 ));
10556 }
10557 let pattern = Regex::new("([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]+|[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]+/)*[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]").unwrap();
10558 if !pattern.is_match(&self.ntry_ref) {
10559 return Err(ValidationError::new(
10560 1005,
10561 "ntry_ref does not match the required pattern".to_string(),
10562 ));
10563 }
10564 self.amt.validate()?;
10565 self.cdt_dbt_ind.validate()?;
10566 self.sts.validate()?;
10567 if let Some(ref val) = self.bookg_dt {
10568 val.validate()?
10569 }
10570 if let Some(ref val) = self.val_dt {
10571 val.validate()?
10572 }
10573 if let Some(ref val) = self.acct_svcr_ref {
10574 if val.chars().count() < 1 {
10575 return Err(ValidationError::new(
10576 1001,
10577 "acct_svcr_ref is shorter than the minimum length of 1".to_string(),
10578 ));
10579 }
10580 if val.chars().count() > 35 {
10581 return Err(ValidationError::new(
10582 1002,
10583 "acct_svcr_ref exceeds the maximum length of 35".to_string(),
10584 ));
10585 }
10586 }
10587 if let Some(ref vec) = self.avlbty {
10588 for item in vec {
10589 item.validate()?
10590 }
10591 }
10592 self.bk_tx_cd.validate()?;
10593 if let Some(ref val) = self.addtl_inf_ind {
10594 val.validate()?
10595 }
10596 if let Some(ref val) = self.amt_dtls {
10597 val.validate()?
10598 }
10599 if let Some(ref val) = self.chrgs {
10600 val.validate()?
10601 }
10602 if let Some(ref val) = self.tech_inpt_chanl {
10603 val.validate()?
10604 }
10605 if let Some(ref val) = self.intrst {
10606 val.validate()?
10607 }
10608 if let Some(ref val) = self.card_tx {
10609 val.validate()?
10610 }
10611 if let Some(ref vec) = self.ntry_dtls {
10612 for item in vec {
10613 item.validate()?
10614 }
10615 }
10616 if let Some(ref val) = self.addtl_ntry_inf {
10617 if val.chars().count() < 1 {
10618 return Err(ValidationError::new(
10619 1001,
10620 "addtl_ntry_inf is shorter than the minimum length of 1".to_string(),
10621 ));
10622 }
10623 if val.chars().count() > 500 {
10624 return Err(ValidationError::new(
10625 1002,
10626 "addtl_ntry_inf exceeds the maximum length of 500".to_string(),
10627 ));
10628 }
10629 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10630 if !pattern.is_match(val) {
10631 return Err(ValidationError::new(
10632 1005,
10633 "addtl_ntry_inf does not match the required pattern".to_string(),
10634 ));
10635 }
10636 }
10637 Ok(())
10638 }
10639}
10640
10641#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10643pub struct ReportingSource1Choice1 {
10644 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10645 pub cd: Option<String>,
10646 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10647 pub prtry: Option<String>,
10648}
10649
10650impl ReportingSource1Choice1 {
10651 pub fn validate(&self) -> Result<(), ValidationError> {
10652 if let Some(ref val) = self.cd {
10653 if val.chars().count() < 1 {
10654 return Err(ValidationError::new(
10655 1001,
10656 "cd is shorter than the minimum length of 1".to_string(),
10657 ));
10658 }
10659 if val.chars().count() > 4 {
10660 return Err(ValidationError::new(
10661 1002,
10662 "cd exceeds the maximum length of 4".to_string(),
10663 ));
10664 }
10665 }
10666 if let Some(ref val) = self.prtry {
10667 if val.chars().count() < 1 {
10668 return Err(ValidationError::new(
10669 1001,
10670 "prtry is shorter than the minimum length of 1".to_string(),
10671 ));
10672 }
10673 if val.chars().count() > 35 {
10674 return Err(ValidationError::new(
10675 1002,
10676 "prtry exceeds the maximum length of 35".to_string(),
10677 ));
10678 }
10679 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10680 if !pattern.is_match(val) {
10681 return Err(ValidationError::new(
10682 1005,
10683 "prtry does not match the required pattern".to_string(),
10684 ));
10685 }
10686 }
10687 Ok(())
10688 }
10689}
10690
10691#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10693pub struct ReturnReason5Choice1 {
10694 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10695 pub cd: Option<String>,
10696 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10697 pub prtry: Option<String>,
10698}
10699
10700impl ReturnReason5Choice1 {
10701 pub fn validate(&self) -> Result<(), ValidationError> {
10702 if let Some(ref val) = self.cd {
10703 if val.chars().count() < 1 {
10704 return Err(ValidationError::new(
10705 1001,
10706 "cd is shorter than the minimum length of 1".to_string(),
10707 ));
10708 }
10709 if val.chars().count() > 4 {
10710 return Err(ValidationError::new(
10711 1002,
10712 "cd exceeds the maximum length of 4".to_string(),
10713 ));
10714 }
10715 }
10716 if let Some(ref val) = self.prtry {
10717 if val.chars().count() < 1 {
10718 return Err(ValidationError::new(
10719 1001,
10720 "prtry is shorter than the minimum length of 1".to_string(),
10721 ));
10722 }
10723 if val.chars().count() > 35 {
10724 return Err(ValidationError::new(
10725 1002,
10726 "prtry exceeds the maximum length of 35".to_string(),
10727 ));
10728 }
10729 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10730 if !pattern.is_match(val) {
10731 return Err(ValidationError::new(
10732 1005,
10733 "prtry does not match the required pattern".to_string(),
10734 ));
10735 }
10736 }
10737 Ok(())
10738 }
10739}
10740
10741#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10743pub struct SecuritiesAccount191 {
10744 #[serde(rename = "Id")]
10745 pub id: String,
10746 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10747 pub tp: Option<GenericIdentification302>,
10748 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
10749 pub nm: Option<String>,
10750}
10751
10752impl SecuritiesAccount191 {
10753 pub fn validate(&self) -> Result<(), ValidationError> {
10754 if self.id.chars().count() < 1 {
10755 return Err(ValidationError::new(
10756 1001,
10757 "id is shorter than the minimum length of 1".to_string(),
10758 ));
10759 }
10760 if self.id.chars().count() > 35 {
10761 return Err(ValidationError::new(
10762 1002,
10763 "id exceeds the maximum length of 35".to_string(),
10764 ));
10765 }
10766 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10767 if !pattern.is_match(&self.id) {
10768 return Err(ValidationError::new(
10769 1005,
10770 "id does not match the required pattern".to_string(),
10771 ));
10772 }
10773 if let Some(ref val) = self.tp {
10774 val.validate()?
10775 }
10776 if let Some(ref val) = self.nm {
10777 if val.chars().count() < 1 {
10778 return Err(ValidationError::new(
10779 1001,
10780 "nm is shorter than the minimum length of 1".to_string(),
10781 ));
10782 }
10783 if val.chars().count() > 70 {
10784 return Err(ValidationError::new(
10785 1002,
10786 "nm exceeds the maximum length of 70".to_string(),
10787 ));
10788 }
10789 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10790 if !pattern.is_match(val) {
10791 return Err(ValidationError::new(
10792 1005,
10793 "nm does not match the required pattern".to_string(),
10794 ));
10795 }
10796 }
10797 Ok(())
10798 }
10799}
10800
10801#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10803pub struct SecurityIdentification191 {
10804 #[serde(rename = "ISIN", skip_serializing_if = "Option::is_none")]
10805 pub isin: Option<String>,
10806 #[serde(rename = "OthrId", skip_serializing_if = "Option::is_none")]
10807 pub othr_id: Option<Vec<OtherIdentification11>>,
10808 #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
10809 pub desc: Option<String>,
10810}
10811
10812impl SecurityIdentification191 {
10813 pub fn validate(&self) -> Result<(), ValidationError> {
10814 if let Some(ref val) = self.isin {
10815 let pattern = Regex::new("[A-Z]{2,2}[A-Z0-9]{9,9}[0-9]{1,1}").unwrap();
10816 if !pattern.is_match(val) {
10817 return Err(ValidationError::new(
10818 1005,
10819 "isin does not match the required pattern".to_string(),
10820 ));
10821 }
10822 }
10823 if let Some(ref vec) = self.othr_id {
10824 for item in vec {
10825 item.validate()?
10826 }
10827 }
10828 if let Some(ref val) = self.desc {
10829 if val.chars().count() < 1 {
10830 return Err(ValidationError::new(
10831 1001,
10832 "desc is shorter than the minimum length of 1".to_string(),
10833 ));
10834 }
10835 if val.chars().count() > 140 {
10836 return Err(ValidationError::new(
10837 1002,
10838 "desc exceeds the maximum length of 140".to_string(),
10839 ));
10840 }
10841 let pattern = Regex::new(
10842 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10843 )
10844 .unwrap();
10845 if !pattern.is_match(val) {
10846 return Err(ValidationError::new(
10847 1005,
10848 "desc does not match the required pattern".to_string(),
10849 ));
10850 }
10851 }
10852 Ok(())
10853 }
10854}
10855
10856#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10858pub struct SequenceRange1Choice1 {
10859 #[serde(rename = "FrSeq", skip_serializing_if = "Option::is_none")]
10860 pub fr_seq: Option<String>,
10861 #[serde(rename = "ToSeq", skip_serializing_if = "Option::is_none")]
10862 pub to_seq: Option<String>,
10863 #[serde(rename = "FrToSeq", skip_serializing_if = "Option::is_none")]
10864 pub fr_to_seq: Option<Vec<SequenceRange11>>,
10865 #[serde(rename = "EQSeq", skip_serializing_if = "Option::is_none")]
10866 pub eq_seq: Option<Vec<String>>,
10867 #[serde(rename = "NEQSeq", skip_serializing_if = "Option::is_none")]
10868 pub neq_seq: Option<Vec<String>>,
10869}
10870
10871impl SequenceRange1Choice1 {
10872 pub fn validate(&self) -> Result<(), ValidationError> {
10873 if let Some(ref val) = self.fr_seq {
10874 if val.chars().count() < 1 {
10875 return Err(ValidationError::new(
10876 1001,
10877 "fr_seq is shorter than the minimum length of 1".to_string(),
10878 ));
10879 }
10880 if val.chars().count() > 35 {
10881 return Err(ValidationError::new(
10882 1002,
10883 "fr_seq exceeds the maximum length of 35".to_string(),
10884 ));
10885 }
10886 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10887 if !pattern.is_match(val) {
10888 return Err(ValidationError::new(
10889 1005,
10890 "fr_seq does not match the required pattern".to_string(),
10891 ));
10892 }
10893 }
10894 if let Some(ref val) = self.to_seq {
10895 if val.chars().count() < 1 {
10896 return Err(ValidationError::new(
10897 1001,
10898 "to_seq is shorter than the minimum length of 1".to_string(),
10899 ));
10900 }
10901 if val.chars().count() > 35 {
10902 return Err(ValidationError::new(
10903 1002,
10904 "to_seq exceeds the maximum length of 35".to_string(),
10905 ));
10906 }
10907 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10908 if !pattern.is_match(val) {
10909 return Err(ValidationError::new(
10910 1005,
10911 "to_seq does not match the required pattern".to_string(),
10912 ));
10913 }
10914 }
10915 if let Some(ref vec) = self.fr_to_seq {
10916 for item in vec {
10917 item.validate()?
10918 }
10919 }
10920 if let Some(ref vec) = self.eq_seq {
10921 for item in vec {
10922 if item.chars().count() < 1 {
10923 return Err(ValidationError::new(
10924 1001,
10925 "eq_seq is shorter than the minimum length of 1".to_string(),
10926 ));
10927 }
10928 if item.chars().count() > 35 {
10929 return Err(ValidationError::new(
10930 1002,
10931 "eq_seq exceeds the maximum length of 35".to_string(),
10932 ));
10933 }
10934 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10935 if !pattern.is_match(&item) {
10936 return Err(ValidationError::new(
10937 1005,
10938 "eq_seq does not match the required pattern".to_string(),
10939 ));
10940 }
10941 }
10942 }
10943 if let Some(ref vec) = self.neq_seq {
10944 for item in vec {
10945 if item.chars().count() < 1 {
10946 return Err(ValidationError::new(
10947 1001,
10948 "neq_seq is shorter than the minimum length of 1".to_string(),
10949 ));
10950 }
10951 if item.chars().count() > 35 {
10952 return Err(ValidationError::new(
10953 1002,
10954 "neq_seq exceeds the maximum length of 35".to_string(),
10955 ));
10956 }
10957 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10958 if !pattern.is_match(&item) {
10959 return Err(ValidationError::new(
10960 1005,
10961 "neq_seq does not match the required pattern".to_string(),
10962 ));
10963 }
10964 }
10965 }
10966 Ok(())
10967 }
10968}
10969
10970#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10972pub struct SequenceRange11 {
10973 #[serde(rename = "FrSeq")]
10974 pub fr_seq: String,
10975 #[serde(rename = "ToSeq")]
10976 pub to_seq: String,
10977}
10978
10979impl SequenceRange11 {
10980 pub fn validate(&self) -> Result<(), ValidationError> {
10981 if self.fr_seq.chars().count() < 1 {
10982 return Err(ValidationError::new(
10983 1001,
10984 "fr_seq is shorter than the minimum length of 1".to_string(),
10985 ));
10986 }
10987 if self.fr_seq.chars().count() > 35 {
10988 return Err(ValidationError::new(
10989 1002,
10990 "fr_seq exceeds the maximum length of 35".to_string(),
10991 ));
10992 }
10993 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10994 if !pattern.is_match(&self.fr_seq) {
10995 return Err(ValidationError::new(
10996 1005,
10997 "fr_seq does not match the required pattern".to_string(),
10998 ));
10999 }
11000 if self.to_seq.chars().count() < 1 {
11001 return Err(ValidationError::new(
11002 1001,
11003 "to_seq is shorter than the minimum length of 1".to_string(),
11004 ));
11005 }
11006 if self.to_seq.chars().count() > 35 {
11007 return Err(ValidationError::new(
11008 1002,
11009 "to_seq exceeds the maximum length of 35".to_string(),
11010 ));
11011 }
11012 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11013 if !pattern.is_match(&self.to_seq) {
11014 return Err(ValidationError::new(
11015 1005,
11016 "to_seq does not match the required pattern".to_string(),
11017 ));
11018 }
11019 Ok(())
11020 }
11021}
11022
11023#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11025pub struct StructuredRemittanceInformation161 {
11026 #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
11027 pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
11028 #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
11029 pub rfrd_doc_amt: Option<RemittanceAmount21>,
11030 #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
11031 pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
11032 #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
11033 pub invcr: Option<PartyIdentification1358>,
11034 #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
11035 pub invcee: Option<PartyIdentification1358>,
11036 #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
11037 pub tax_rmt: Option<TaxInformation71>,
11038 #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
11039 pub grnshmt_rmt: Option<Garnishment31>,
11040 #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
11041 pub addtl_rmt_inf: Option<Vec<String>>,
11042}
11043
11044impl StructuredRemittanceInformation161 {
11045 pub fn validate(&self) -> Result<(), ValidationError> {
11046 if let Some(ref vec) = self.rfrd_doc_inf {
11047 for item in vec {
11048 item.validate()?
11049 }
11050 }
11051 if let Some(ref val) = self.rfrd_doc_amt {
11052 val.validate()?
11053 }
11054 if let Some(ref val) = self.cdtr_ref_inf {
11055 val.validate()?
11056 }
11057 if let Some(ref val) = self.invcr {
11058 val.validate()?
11059 }
11060 if let Some(ref val) = self.invcee {
11061 val.validate()?
11062 }
11063 if let Some(ref val) = self.tax_rmt {
11064 val.validate()?
11065 }
11066 if let Some(ref val) = self.grnshmt_rmt {
11067 val.validate()?
11068 }
11069 if let Some(ref vec) = self.addtl_rmt_inf {
11070 for item in vec {
11071 if item.chars().count() < 1 {
11072 return Err(ValidationError::new(
11073 1001,
11074 "addtl_rmt_inf is shorter than the minimum length of 1".to_string(),
11075 ));
11076 }
11077 if item.chars().count() > 140 {
11078 return Err(ValidationError::new(
11079 1002,
11080 "addtl_rmt_inf exceeds the maximum length of 140".to_string(),
11081 ));
11082 }
11083 let pattern = Regex::new(
11084 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11085 )
11086 .unwrap();
11087 if !pattern.is_match(&item) {
11088 return Err(ValidationError::new(
11089 1005,
11090 "addtl_rmt_inf does not match the required pattern".to_string(),
11091 ));
11092 }
11093 }
11094 }
11095 Ok(())
11096 }
11097}
11098
11099#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11101pub struct TaxAmount2 {
11102 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
11103 pub rate: Option<f64>,
11104 #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11105 pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11106 #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
11107 pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11108 #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
11109 pub dtls: Option<Vec<TaxRecordDetails2>>,
11110}
11111
11112impl TaxAmount2 {
11113 pub fn validate(&self) -> Result<(), ValidationError> {
11114 if let Some(ref val) = self.taxbl_base_amt {
11115 val.validate()?
11116 }
11117 if let Some(ref val) = self.ttl_amt {
11118 val.validate()?
11119 }
11120 if let Some(ref vec) = self.dtls {
11121 for item in vec {
11122 item.validate()?
11123 }
11124 }
11125 Ok(())
11126 }
11127}
11128
11129#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11131pub struct TaxAmountAndType11 {
11132 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11133 pub tp: Option<TaxAmountType1Choice1>,
11134 #[serde(rename = "Amt")]
11135 pub amt: ActiveOrHistoricCurrencyAndAmount,
11136}
11137
11138impl TaxAmountAndType11 {
11139 pub fn validate(&self) -> Result<(), ValidationError> {
11140 if let Some(ref val) = self.tp {
11141 val.validate()?
11142 }
11143 self.amt.validate()?;
11144 Ok(())
11145 }
11146}
11147
11148#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11150pub struct TaxAmountType1Choice1 {
11151 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
11152 pub cd: Option<String>,
11153 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11154 pub prtry: Option<String>,
11155}
11156
11157impl TaxAmountType1Choice1 {
11158 pub fn validate(&self) -> Result<(), ValidationError> {
11159 if let Some(ref val) = self.cd {
11160 if val.chars().count() < 1 {
11161 return Err(ValidationError::new(
11162 1001,
11163 "cd is shorter than the minimum length of 1".to_string(),
11164 ));
11165 }
11166 if val.chars().count() > 4 {
11167 return Err(ValidationError::new(
11168 1002,
11169 "cd exceeds the maximum length of 4".to_string(),
11170 ));
11171 }
11172 }
11173 if let Some(ref val) = self.prtry {
11174 if val.chars().count() < 1 {
11175 return Err(ValidationError::new(
11176 1001,
11177 "prtry is shorter than the minimum length of 1".to_string(),
11178 ));
11179 }
11180 if val.chars().count() > 35 {
11181 return Err(ValidationError::new(
11182 1002,
11183 "prtry exceeds the maximum length of 35".to_string(),
11184 ));
11185 }
11186 let pattern = Regex::new(
11187 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11188 )
11189 .unwrap();
11190 if !pattern.is_match(val) {
11191 return Err(ValidationError::new(
11192 1005,
11193 "prtry does not match the required pattern".to_string(),
11194 ));
11195 }
11196 }
11197 Ok(())
11198 }
11199}
11200
11201#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11203pub struct TaxAuthorisation11 {
11204 #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
11205 pub titl: Option<String>,
11206 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
11207 pub nm: Option<String>,
11208}
11209
11210impl TaxAuthorisation11 {
11211 pub fn validate(&self) -> Result<(), ValidationError> {
11212 if let Some(ref val) = self.titl {
11213 if val.chars().count() < 1 {
11214 return Err(ValidationError::new(
11215 1001,
11216 "titl is shorter than the minimum length of 1".to_string(),
11217 ));
11218 }
11219 if val.chars().count() > 35 {
11220 return Err(ValidationError::new(
11221 1002,
11222 "titl exceeds the maximum length of 35".to_string(),
11223 ));
11224 }
11225 let pattern = Regex::new(
11226 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11227 )
11228 .unwrap();
11229 if !pattern.is_match(val) {
11230 return Err(ValidationError::new(
11231 1005,
11232 "titl does not match the required pattern".to_string(),
11233 ));
11234 }
11235 }
11236 if let Some(ref val) = self.nm {
11237 if val.chars().count() < 1 {
11238 return Err(ValidationError::new(
11239 1001,
11240 "nm is shorter than the minimum length of 1".to_string(),
11241 ));
11242 }
11243 if val.chars().count() > 140 {
11244 return Err(ValidationError::new(
11245 1002,
11246 "nm exceeds the maximum length of 140".to_string(),
11247 ));
11248 }
11249 let pattern = Regex::new(
11250 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11251 )
11252 .unwrap();
11253 if !pattern.is_match(val) {
11254 return Err(ValidationError::new(
11255 1005,
11256 "nm does not match the required pattern".to_string(),
11257 ));
11258 }
11259 }
11260 Ok(())
11261 }
11262}
11263
11264#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11266pub struct TaxAuthorisation12 {
11267 #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
11268 pub titl: Option<String>,
11269 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
11270 pub nm: Option<String>,
11271}
11272
11273impl TaxAuthorisation12 {
11274 pub fn validate(&self) -> Result<(), ValidationError> {
11275 if let Some(ref val) = self.titl {
11276 if val.chars().count() < 1 {
11277 return Err(ValidationError::new(
11278 1001,
11279 "titl is shorter than the minimum length of 1".to_string(),
11280 ));
11281 }
11282 if val.chars().count() > 35 {
11283 return Err(ValidationError::new(
11284 1002,
11285 "titl exceeds the maximum length of 35".to_string(),
11286 ));
11287 }
11288 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11289 if !pattern.is_match(val) {
11290 return Err(ValidationError::new(
11291 1005,
11292 "titl does not match the required pattern".to_string(),
11293 ));
11294 }
11295 }
11296 if let Some(ref val) = self.nm {
11297 if val.chars().count() < 1 {
11298 return Err(ValidationError::new(
11299 1001,
11300 "nm is shorter than the minimum length of 1".to_string(),
11301 ));
11302 }
11303 if val.chars().count() > 140 {
11304 return Err(ValidationError::new(
11305 1002,
11306 "nm exceeds the maximum length of 140".to_string(),
11307 ));
11308 }
11309 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11310 if !pattern.is_match(val) {
11311 return Err(ValidationError::new(
11312 1005,
11313 "nm does not match the required pattern".to_string(),
11314 ));
11315 }
11316 }
11317 Ok(())
11318 }
11319}
11320
11321#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11323pub struct TaxCharges21 {
11324 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
11325 pub id: Option<String>,
11326 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
11327 pub rate: Option<f64>,
11328 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
11329 pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11330}
11331
11332impl TaxCharges21 {
11333 pub fn validate(&self) -> Result<(), ValidationError> {
11334 if let Some(ref val) = self.id {
11335 if val.chars().count() < 1 {
11336 return Err(ValidationError::new(
11337 1001,
11338 "id is shorter than the minimum length of 1".to_string(),
11339 ));
11340 }
11341 if val.chars().count() > 35 {
11342 return Err(ValidationError::new(
11343 1002,
11344 "id exceeds the maximum length of 35".to_string(),
11345 ));
11346 }
11347 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11348 if !pattern.is_match(val) {
11349 return Err(ValidationError::new(
11350 1005,
11351 "id does not match the required pattern".to_string(),
11352 ));
11353 }
11354 }
11355 if let Some(ref val) = self.amt {
11356 val.validate()?
11357 }
11358 Ok(())
11359 }
11360}
11361
11362#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11364pub struct TaxInformation71 {
11365 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11366 pub cdtr: Option<TaxParty11>,
11367 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11368 pub dbtr: Option<TaxParty21>,
11369 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
11370 pub ultmt_dbtr: Option<TaxParty21>,
11371 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
11372 pub admstn_zone: Option<String>,
11373 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
11374 pub ref_nb: Option<String>,
11375 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
11376 pub mtd: Option<String>,
11377 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11378 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11379 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
11380 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11381 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
11382 pub dt: Option<String>,
11383 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
11384 pub seq_nb: Option<f64>,
11385 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11386 pub rcrd: Option<Vec<TaxRecord21>>,
11387}
11388
11389impl TaxInformation71 {
11390 pub fn validate(&self) -> Result<(), ValidationError> {
11391 if let Some(ref val) = self.cdtr {
11392 val.validate()?
11393 }
11394 if let Some(ref val) = self.dbtr {
11395 val.validate()?
11396 }
11397 if let Some(ref val) = self.ultmt_dbtr {
11398 val.validate()?
11399 }
11400 if let Some(ref val) = self.admstn_zone {
11401 if val.chars().count() < 1 {
11402 return Err(ValidationError::new(
11403 1001,
11404 "admstn_zone is shorter than the minimum length of 1".to_string(),
11405 ));
11406 }
11407 if val.chars().count() > 35 {
11408 return Err(ValidationError::new(
11409 1002,
11410 "admstn_zone exceeds the maximum length of 35".to_string(),
11411 ));
11412 }
11413 let pattern = Regex::new(
11414 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11415 )
11416 .unwrap();
11417 if !pattern.is_match(val) {
11418 return Err(ValidationError::new(
11419 1005,
11420 "admstn_zone does not match the required pattern".to_string(),
11421 ));
11422 }
11423 }
11424 if let Some(ref val) = self.ref_nb {
11425 if val.chars().count() < 1 {
11426 return Err(ValidationError::new(
11427 1001,
11428 "ref_nb is shorter than the minimum length of 1".to_string(),
11429 ));
11430 }
11431 if val.chars().count() > 140 {
11432 return Err(ValidationError::new(
11433 1002,
11434 "ref_nb exceeds the maximum length of 140".to_string(),
11435 ));
11436 }
11437 let pattern = Regex::new(
11438 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11439 )
11440 .unwrap();
11441 if !pattern.is_match(val) {
11442 return Err(ValidationError::new(
11443 1005,
11444 "ref_nb does not match the required pattern".to_string(),
11445 ));
11446 }
11447 }
11448 if let Some(ref val) = self.mtd {
11449 if val.chars().count() < 1 {
11450 return Err(ValidationError::new(
11451 1001,
11452 "mtd is shorter than the minimum length of 1".to_string(),
11453 ));
11454 }
11455 if val.chars().count() > 35 {
11456 return Err(ValidationError::new(
11457 1002,
11458 "mtd exceeds the maximum length of 35".to_string(),
11459 ));
11460 }
11461 let pattern = Regex::new(
11462 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11463 )
11464 .unwrap();
11465 if !pattern.is_match(val) {
11466 return Err(ValidationError::new(
11467 1005,
11468 "mtd does not match the required pattern".to_string(),
11469 ));
11470 }
11471 }
11472 if let Some(ref val) = self.ttl_taxbl_base_amt {
11473 val.validate()?
11474 }
11475 if let Some(ref val) = self.ttl_tax_amt {
11476 val.validate()?
11477 }
11478 if let Some(ref vec) = self.rcrd {
11479 for item in vec {
11480 item.validate()?
11481 }
11482 }
11483 Ok(())
11484 }
11485}
11486
11487#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11489pub struct TaxInformation81 {
11490 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11491 pub cdtr: Option<TaxParty12>,
11492 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11493 pub dbtr: Option<TaxParty22>,
11494 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
11495 pub admstn_zone: Option<String>,
11496 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
11497 pub ref_nb: Option<String>,
11498 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
11499 pub mtd: Option<String>,
11500 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
11501 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11502 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
11503 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11504 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
11505 pub dt: Option<String>,
11506 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
11507 pub seq_nb: Option<f64>,
11508 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11509 pub rcrd: Option<Vec<TaxRecord22>>,
11510}
11511
11512impl TaxInformation81 {
11513 pub fn validate(&self) -> Result<(), ValidationError> {
11514 if let Some(ref val) = self.cdtr {
11515 val.validate()?
11516 }
11517 if let Some(ref val) = self.dbtr {
11518 val.validate()?
11519 }
11520 if let Some(ref val) = self.admstn_zone {
11521 if val.chars().count() < 1 {
11522 return Err(ValidationError::new(
11523 1001,
11524 "admstn_zone is shorter than the minimum length of 1".to_string(),
11525 ));
11526 }
11527 if val.chars().count() > 35 {
11528 return Err(ValidationError::new(
11529 1002,
11530 "admstn_zone exceeds the maximum length of 35".to_string(),
11531 ));
11532 }
11533 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11534 if !pattern.is_match(val) {
11535 return Err(ValidationError::new(
11536 1005,
11537 "admstn_zone does not match the required pattern".to_string(),
11538 ));
11539 }
11540 }
11541 if let Some(ref val) = self.ref_nb {
11542 if val.chars().count() < 1 {
11543 return Err(ValidationError::new(
11544 1001,
11545 "ref_nb is shorter than the minimum length of 1".to_string(),
11546 ));
11547 }
11548 if val.chars().count() > 140 {
11549 return Err(ValidationError::new(
11550 1002,
11551 "ref_nb exceeds the maximum length of 140".to_string(),
11552 ));
11553 }
11554 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11555 if !pattern.is_match(val) {
11556 return Err(ValidationError::new(
11557 1005,
11558 "ref_nb does not match the required pattern".to_string(),
11559 ));
11560 }
11561 }
11562 if let Some(ref val) = self.mtd {
11563 if val.chars().count() < 1 {
11564 return Err(ValidationError::new(
11565 1001,
11566 "mtd is shorter than the minimum length of 1".to_string(),
11567 ));
11568 }
11569 if val.chars().count() > 35 {
11570 return Err(ValidationError::new(
11571 1002,
11572 "mtd exceeds the maximum length of 35".to_string(),
11573 ));
11574 }
11575 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11576 if !pattern.is_match(val) {
11577 return Err(ValidationError::new(
11578 1005,
11579 "mtd does not match the required pattern".to_string(),
11580 ));
11581 }
11582 }
11583 if let Some(ref val) = self.ttl_taxbl_base_amt {
11584 val.validate()?
11585 }
11586 if let Some(ref val) = self.ttl_tax_amt {
11587 val.validate()?
11588 }
11589 if let Some(ref vec) = self.rcrd {
11590 for item in vec {
11591 item.validate()?
11592 }
11593 }
11594 Ok(())
11595 }
11596}
11597
11598#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11600pub struct TaxParty11 {
11601 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11602 pub tax_id: Option<String>,
11603 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11604 pub regn_id: Option<String>,
11605 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11606 pub tax_tp: Option<String>,
11607}
11608
11609impl TaxParty11 {
11610 pub fn validate(&self) -> Result<(), ValidationError> {
11611 if let Some(ref val) = self.tax_id {
11612 if val.chars().count() < 1 {
11613 return Err(ValidationError::new(
11614 1001,
11615 "tax_id is shorter than the minimum length of 1".to_string(),
11616 ));
11617 }
11618 if val.chars().count() > 35 {
11619 return Err(ValidationError::new(
11620 1002,
11621 "tax_id exceeds the maximum length of 35".to_string(),
11622 ));
11623 }
11624 let pattern = Regex::new(
11625 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11626 )
11627 .unwrap();
11628 if !pattern.is_match(val) {
11629 return Err(ValidationError::new(
11630 1005,
11631 "tax_id does not match the required pattern".to_string(),
11632 ));
11633 }
11634 }
11635 if let Some(ref val) = self.regn_id {
11636 if val.chars().count() < 1 {
11637 return Err(ValidationError::new(
11638 1001,
11639 "regn_id is shorter than the minimum length of 1".to_string(),
11640 ));
11641 }
11642 if val.chars().count() > 35 {
11643 return Err(ValidationError::new(
11644 1002,
11645 "regn_id exceeds the maximum length of 35".to_string(),
11646 ));
11647 }
11648 let pattern = Regex::new(
11649 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11650 )
11651 .unwrap();
11652 if !pattern.is_match(val) {
11653 return Err(ValidationError::new(
11654 1005,
11655 "regn_id does not match the required pattern".to_string(),
11656 ));
11657 }
11658 }
11659 if let Some(ref val) = self.tax_tp {
11660 if val.chars().count() < 1 {
11661 return Err(ValidationError::new(
11662 1001,
11663 "tax_tp is shorter than the minimum length of 1".to_string(),
11664 ));
11665 }
11666 if val.chars().count() > 35 {
11667 return Err(ValidationError::new(
11668 1002,
11669 "tax_tp exceeds the maximum length of 35".to_string(),
11670 ));
11671 }
11672 let pattern = Regex::new(
11673 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11674 )
11675 .unwrap();
11676 if !pattern.is_match(val) {
11677 return Err(ValidationError::new(
11678 1005,
11679 "tax_tp does not match the required pattern".to_string(),
11680 ));
11681 }
11682 }
11683 Ok(())
11684 }
11685}
11686
11687#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11689pub struct TaxParty12 {
11690 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11691 pub tax_id: Option<String>,
11692 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11693 pub regn_id: Option<String>,
11694 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11695 pub tax_tp: Option<String>,
11696}
11697
11698impl TaxParty12 {
11699 pub fn validate(&self) -> Result<(), ValidationError> {
11700 if let Some(ref val) = self.tax_id {
11701 if val.chars().count() < 1 {
11702 return Err(ValidationError::new(
11703 1001,
11704 "tax_id is shorter than the minimum length of 1".to_string(),
11705 ));
11706 }
11707 if val.chars().count() > 35 {
11708 return Err(ValidationError::new(
11709 1002,
11710 "tax_id exceeds the maximum length of 35".to_string(),
11711 ));
11712 }
11713 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11714 if !pattern.is_match(val) {
11715 return Err(ValidationError::new(
11716 1005,
11717 "tax_id does not match the required pattern".to_string(),
11718 ));
11719 }
11720 }
11721 if let Some(ref val) = self.regn_id {
11722 if val.chars().count() < 1 {
11723 return Err(ValidationError::new(
11724 1001,
11725 "regn_id is shorter than the minimum length of 1".to_string(),
11726 ));
11727 }
11728 if val.chars().count() > 35 {
11729 return Err(ValidationError::new(
11730 1002,
11731 "regn_id exceeds the maximum length of 35".to_string(),
11732 ));
11733 }
11734 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11735 if !pattern.is_match(val) {
11736 return Err(ValidationError::new(
11737 1005,
11738 "regn_id does not match the required pattern".to_string(),
11739 ));
11740 }
11741 }
11742 if let Some(ref val) = self.tax_tp {
11743 if val.chars().count() < 1 {
11744 return Err(ValidationError::new(
11745 1001,
11746 "tax_tp is shorter than the minimum length of 1".to_string(),
11747 ));
11748 }
11749 if val.chars().count() > 35 {
11750 return Err(ValidationError::new(
11751 1002,
11752 "tax_tp exceeds the maximum length of 35".to_string(),
11753 ));
11754 }
11755 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11756 if !pattern.is_match(val) {
11757 return Err(ValidationError::new(
11758 1005,
11759 "tax_tp does not match the required pattern".to_string(),
11760 ));
11761 }
11762 }
11763 Ok(())
11764 }
11765}
11766
11767#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11769pub struct TaxParty21 {
11770 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11771 pub tax_id: Option<String>,
11772 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11773 pub regn_id: Option<String>,
11774 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11775 pub tax_tp: Option<String>,
11776 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
11777 pub authstn: Option<TaxAuthorisation11>,
11778}
11779
11780impl TaxParty21 {
11781 pub fn validate(&self) -> Result<(), ValidationError> {
11782 if let Some(ref val) = self.tax_id {
11783 if val.chars().count() < 1 {
11784 return Err(ValidationError::new(
11785 1001,
11786 "tax_id is shorter than the minimum length of 1".to_string(),
11787 ));
11788 }
11789 if val.chars().count() > 35 {
11790 return Err(ValidationError::new(
11791 1002,
11792 "tax_id exceeds the maximum length of 35".to_string(),
11793 ));
11794 }
11795 let pattern = Regex::new(
11796 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11797 )
11798 .unwrap();
11799 if !pattern.is_match(val) {
11800 return Err(ValidationError::new(
11801 1005,
11802 "tax_id does not match the required pattern".to_string(),
11803 ));
11804 }
11805 }
11806 if let Some(ref val) = self.regn_id {
11807 if val.chars().count() < 1 {
11808 return Err(ValidationError::new(
11809 1001,
11810 "regn_id is shorter than the minimum length of 1".to_string(),
11811 ));
11812 }
11813 if val.chars().count() > 35 {
11814 return Err(ValidationError::new(
11815 1002,
11816 "regn_id exceeds the maximum length of 35".to_string(),
11817 ));
11818 }
11819 let pattern = Regex::new(
11820 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11821 )
11822 .unwrap();
11823 if !pattern.is_match(val) {
11824 return Err(ValidationError::new(
11825 1005,
11826 "regn_id does not match the required pattern".to_string(),
11827 ));
11828 }
11829 }
11830 if let Some(ref val) = self.tax_tp {
11831 if val.chars().count() < 1 {
11832 return Err(ValidationError::new(
11833 1001,
11834 "tax_tp is shorter than the minimum length of 1".to_string(),
11835 ));
11836 }
11837 if val.chars().count() > 35 {
11838 return Err(ValidationError::new(
11839 1002,
11840 "tax_tp exceeds the maximum length of 35".to_string(),
11841 ));
11842 }
11843 let pattern = Regex::new(
11844 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
11845 )
11846 .unwrap();
11847 if !pattern.is_match(val) {
11848 return Err(ValidationError::new(
11849 1005,
11850 "tax_tp does not match the required pattern".to_string(),
11851 ));
11852 }
11853 }
11854 if let Some(ref val) = self.authstn {
11855 val.validate()?
11856 }
11857 Ok(())
11858 }
11859}
11860
11861#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11863pub struct TaxParty22 {
11864 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
11865 pub tax_id: Option<String>,
11866 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
11867 pub regn_id: Option<String>,
11868 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
11869 pub tax_tp: Option<String>,
11870 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
11871 pub authstn: Option<TaxAuthorisation12>,
11872}
11873
11874impl TaxParty22 {
11875 pub fn validate(&self) -> Result<(), ValidationError> {
11876 if let Some(ref val) = self.tax_id {
11877 if val.chars().count() < 1 {
11878 return Err(ValidationError::new(
11879 1001,
11880 "tax_id is shorter than the minimum length of 1".to_string(),
11881 ));
11882 }
11883 if val.chars().count() > 35 {
11884 return Err(ValidationError::new(
11885 1002,
11886 "tax_id exceeds the maximum length of 35".to_string(),
11887 ));
11888 }
11889 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11890 if !pattern.is_match(val) {
11891 return Err(ValidationError::new(
11892 1005,
11893 "tax_id does not match the required pattern".to_string(),
11894 ));
11895 }
11896 }
11897 if let Some(ref val) = self.regn_id {
11898 if val.chars().count() < 1 {
11899 return Err(ValidationError::new(
11900 1001,
11901 "regn_id is shorter than the minimum length of 1".to_string(),
11902 ));
11903 }
11904 if val.chars().count() > 35 {
11905 return Err(ValidationError::new(
11906 1002,
11907 "regn_id exceeds the maximum length of 35".to_string(),
11908 ));
11909 }
11910 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11911 if !pattern.is_match(val) {
11912 return Err(ValidationError::new(
11913 1005,
11914 "regn_id does not match the required pattern".to_string(),
11915 ));
11916 }
11917 }
11918 if let Some(ref val) = self.tax_tp {
11919 if val.chars().count() < 1 {
11920 return Err(ValidationError::new(
11921 1001,
11922 "tax_tp is shorter than the minimum length of 1".to_string(),
11923 ));
11924 }
11925 if val.chars().count() > 35 {
11926 return Err(ValidationError::new(
11927 1002,
11928 "tax_tp exceeds the maximum length of 35".to_string(),
11929 ));
11930 }
11931 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11932 if !pattern.is_match(val) {
11933 return Err(ValidationError::new(
11934 1005,
11935 "tax_tp does not match the required pattern".to_string(),
11936 ));
11937 }
11938 }
11939 if let Some(ref val) = self.authstn {
11940 val.validate()?
11941 }
11942 Ok(())
11943 }
11944}
11945
11946#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11948pub struct TaxPeriod2 {
11949 #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
11950 pub yr: Option<String>,
11951 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11952 pub tp: Option<TaxRecordPeriod1Code>,
11953 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
11954 pub fr_to_dt: Option<DatePeriod2>,
11955}
11956
11957impl TaxPeriod2 {
11958 pub fn validate(&self) -> Result<(), ValidationError> {
11959 if let Some(ref val) = self.tp {
11960 val.validate()?
11961 }
11962 if let Some(ref val) = self.fr_to_dt {
11963 val.validate()?
11964 }
11965 Ok(())
11966 }
11967}
11968
11969#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11971pub struct TaxRecord21 {
11972 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
11973 pub tp: Option<String>,
11974 #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
11975 pub ctgy: Option<String>,
11976 #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
11977 pub ctgy_dtls: Option<String>,
11978 #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
11979 pub dbtr_sts: Option<String>,
11980 #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
11981 pub cert_id: Option<String>,
11982 #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
11983 pub frms_cd: Option<String>,
11984 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
11985 pub prd: Option<TaxPeriod2>,
11986 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
11987 pub tax_amt: Option<TaxAmount2>,
11988 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
11989 pub addtl_inf: Option<String>,
11990}
11991
11992impl TaxRecord21 {
11993 pub fn validate(&self) -> Result<(), ValidationError> {
11994 if let Some(ref val) = self.tp {
11995 if val.chars().count() < 1 {
11996 return Err(ValidationError::new(
11997 1001,
11998 "tp is shorter than the minimum length of 1".to_string(),
11999 ));
12000 }
12001 if val.chars().count() > 35 {
12002 return Err(ValidationError::new(
12003 1002,
12004 "tp exceeds the maximum length of 35".to_string(),
12005 ));
12006 }
12007 let pattern = Regex::new(
12008 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12009 )
12010 .unwrap();
12011 if !pattern.is_match(val) {
12012 return Err(ValidationError::new(
12013 1005,
12014 "tp does not match the required pattern".to_string(),
12015 ));
12016 }
12017 }
12018 if let Some(ref val) = self.ctgy {
12019 if val.chars().count() < 1 {
12020 return Err(ValidationError::new(
12021 1001,
12022 "ctgy is shorter than the minimum length of 1".to_string(),
12023 ));
12024 }
12025 if val.chars().count() > 35 {
12026 return Err(ValidationError::new(
12027 1002,
12028 "ctgy exceeds the maximum length of 35".to_string(),
12029 ));
12030 }
12031 let pattern = Regex::new(
12032 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12033 )
12034 .unwrap();
12035 if !pattern.is_match(val) {
12036 return Err(ValidationError::new(
12037 1005,
12038 "ctgy does not match the required pattern".to_string(),
12039 ));
12040 }
12041 }
12042 if let Some(ref val) = self.ctgy_dtls {
12043 if val.chars().count() < 1 {
12044 return Err(ValidationError::new(
12045 1001,
12046 "ctgy_dtls is shorter than the minimum length of 1".to_string(),
12047 ));
12048 }
12049 if val.chars().count() > 35 {
12050 return Err(ValidationError::new(
12051 1002,
12052 "ctgy_dtls exceeds the maximum length of 35".to_string(),
12053 ));
12054 }
12055 let pattern = Regex::new(
12056 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12057 )
12058 .unwrap();
12059 if !pattern.is_match(val) {
12060 return Err(ValidationError::new(
12061 1005,
12062 "ctgy_dtls does not match the required pattern".to_string(),
12063 ));
12064 }
12065 }
12066 if let Some(ref val) = self.dbtr_sts {
12067 if val.chars().count() < 1 {
12068 return Err(ValidationError::new(
12069 1001,
12070 "dbtr_sts is shorter than the minimum length of 1".to_string(),
12071 ));
12072 }
12073 if val.chars().count() > 35 {
12074 return Err(ValidationError::new(
12075 1002,
12076 "dbtr_sts exceeds the maximum length of 35".to_string(),
12077 ));
12078 }
12079 let pattern = Regex::new(
12080 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12081 )
12082 .unwrap();
12083 if !pattern.is_match(val) {
12084 return Err(ValidationError::new(
12085 1005,
12086 "dbtr_sts does not match the required pattern".to_string(),
12087 ));
12088 }
12089 }
12090 if let Some(ref val) = self.cert_id {
12091 if val.chars().count() < 1 {
12092 return Err(ValidationError::new(
12093 1001,
12094 "cert_id is shorter than the minimum length of 1".to_string(),
12095 ));
12096 }
12097 if val.chars().count() > 35 {
12098 return Err(ValidationError::new(
12099 1002,
12100 "cert_id exceeds the maximum length of 35".to_string(),
12101 ));
12102 }
12103 let pattern = Regex::new(
12104 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12105 )
12106 .unwrap();
12107 if !pattern.is_match(val) {
12108 return Err(ValidationError::new(
12109 1005,
12110 "cert_id does not match the required pattern".to_string(),
12111 ));
12112 }
12113 }
12114 if let Some(ref val) = self.frms_cd {
12115 if val.chars().count() < 1 {
12116 return Err(ValidationError::new(
12117 1001,
12118 "frms_cd is shorter than the minimum length of 1".to_string(),
12119 ));
12120 }
12121 if val.chars().count() > 35 {
12122 return Err(ValidationError::new(
12123 1002,
12124 "frms_cd exceeds the maximum length of 35".to_string(),
12125 ));
12126 }
12127 let pattern = Regex::new(
12128 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12129 )
12130 .unwrap();
12131 if !pattern.is_match(val) {
12132 return Err(ValidationError::new(
12133 1005,
12134 "frms_cd does not match the required pattern".to_string(),
12135 ));
12136 }
12137 }
12138 if let Some(ref val) = self.prd {
12139 val.validate()?
12140 }
12141 if let Some(ref val) = self.tax_amt {
12142 val.validate()?
12143 }
12144 if let Some(ref val) = self.addtl_inf {
12145 if val.chars().count() < 1 {
12146 return Err(ValidationError::new(
12147 1001,
12148 "addtl_inf is shorter than the minimum length of 1".to_string(),
12149 ));
12150 }
12151 if val.chars().count() > 140 {
12152 return Err(ValidationError::new(
12153 1002,
12154 "addtl_inf exceeds the maximum length of 140".to_string(),
12155 ));
12156 }
12157 let pattern = Regex::new(
12158 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
12159 )
12160 .unwrap();
12161 if !pattern.is_match(val) {
12162 return Err(ValidationError::new(
12163 1005,
12164 "addtl_inf does not match the required pattern".to_string(),
12165 ));
12166 }
12167 }
12168 Ok(())
12169 }
12170}
12171
12172#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12174pub struct TaxRecord22 {
12175 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
12176 pub tp: Option<String>,
12177 #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
12178 pub ctgy: Option<String>,
12179 #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
12180 pub ctgy_dtls: Option<String>,
12181 #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
12182 pub dbtr_sts: Option<String>,
12183 #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
12184 pub cert_id: Option<String>,
12185 #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
12186 pub frms_cd: Option<String>,
12187 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
12188 pub prd: Option<TaxPeriod2>,
12189 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
12190 pub tax_amt: Option<TaxAmount2>,
12191 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
12192 pub addtl_inf: Option<String>,
12193}
12194
12195impl TaxRecord22 {
12196 pub fn validate(&self) -> Result<(), ValidationError> {
12197 if let Some(ref val) = self.tp {
12198 if val.chars().count() < 1 {
12199 return Err(ValidationError::new(
12200 1001,
12201 "tp is shorter than the minimum length of 1".to_string(),
12202 ));
12203 }
12204 if val.chars().count() > 35 {
12205 return Err(ValidationError::new(
12206 1002,
12207 "tp exceeds the maximum length of 35".to_string(),
12208 ));
12209 }
12210 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12211 if !pattern.is_match(val) {
12212 return Err(ValidationError::new(
12213 1005,
12214 "tp does not match the required pattern".to_string(),
12215 ));
12216 }
12217 }
12218 if let Some(ref val) = self.ctgy {
12219 if val.chars().count() < 1 {
12220 return Err(ValidationError::new(
12221 1001,
12222 "ctgy is shorter than the minimum length of 1".to_string(),
12223 ));
12224 }
12225 if val.chars().count() > 35 {
12226 return Err(ValidationError::new(
12227 1002,
12228 "ctgy exceeds the maximum length of 35".to_string(),
12229 ));
12230 }
12231 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12232 if !pattern.is_match(val) {
12233 return Err(ValidationError::new(
12234 1005,
12235 "ctgy does not match the required pattern".to_string(),
12236 ));
12237 }
12238 }
12239 if let Some(ref val) = self.ctgy_dtls {
12240 if val.chars().count() < 1 {
12241 return Err(ValidationError::new(
12242 1001,
12243 "ctgy_dtls is shorter than the minimum length of 1".to_string(),
12244 ));
12245 }
12246 if val.chars().count() > 35 {
12247 return Err(ValidationError::new(
12248 1002,
12249 "ctgy_dtls exceeds the maximum length of 35".to_string(),
12250 ));
12251 }
12252 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12253 if !pattern.is_match(val) {
12254 return Err(ValidationError::new(
12255 1005,
12256 "ctgy_dtls does not match the required pattern".to_string(),
12257 ));
12258 }
12259 }
12260 if let Some(ref val) = self.dbtr_sts {
12261 if val.chars().count() < 1 {
12262 return Err(ValidationError::new(
12263 1001,
12264 "dbtr_sts is shorter than the minimum length of 1".to_string(),
12265 ));
12266 }
12267 if val.chars().count() > 35 {
12268 return Err(ValidationError::new(
12269 1002,
12270 "dbtr_sts exceeds the maximum length of 35".to_string(),
12271 ));
12272 }
12273 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12274 if !pattern.is_match(val) {
12275 return Err(ValidationError::new(
12276 1005,
12277 "dbtr_sts does not match the required pattern".to_string(),
12278 ));
12279 }
12280 }
12281 if let Some(ref val) = self.cert_id {
12282 if val.chars().count() < 1 {
12283 return Err(ValidationError::new(
12284 1001,
12285 "cert_id is shorter than the minimum length of 1".to_string(),
12286 ));
12287 }
12288 if val.chars().count() > 35 {
12289 return Err(ValidationError::new(
12290 1002,
12291 "cert_id exceeds the maximum length of 35".to_string(),
12292 ));
12293 }
12294 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12295 if !pattern.is_match(val) {
12296 return Err(ValidationError::new(
12297 1005,
12298 "cert_id does not match the required pattern".to_string(),
12299 ));
12300 }
12301 }
12302 if let Some(ref val) = self.frms_cd {
12303 if val.chars().count() < 1 {
12304 return Err(ValidationError::new(
12305 1001,
12306 "frms_cd is shorter than the minimum length of 1".to_string(),
12307 ));
12308 }
12309 if val.chars().count() > 35 {
12310 return Err(ValidationError::new(
12311 1002,
12312 "frms_cd exceeds the maximum length of 35".to_string(),
12313 ));
12314 }
12315 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12316 if !pattern.is_match(val) {
12317 return Err(ValidationError::new(
12318 1005,
12319 "frms_cd does not match the required pattern".to_string(),
12320 ));
12321 }
12322 }
12323 if let Some(ref val) = self.prd {
12324 val.validate()?
12325 }
12326 if let Some(ref val) = self.tax_amt {
12327 val.validate()?
12328 }
12329 if let Some(ref val) = self.addtl_inf {
12330 if val.chars().count() < 1 {
12331 return Err(ValidationError::new(
12332 1001,
12333 "addtl_inf is shorter than the minimum length of 1".to_string(),
12334 ));
12335 }
12336 if val.chars().count() > 140 {
12337 return Err(ValidationError::new(
12338 1002,
12339 "addtl_inf exceeds the maximum length of 140".to_string(),
12340 ));
12341 }
12342 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12343 if !pattern.is_match(val) {
12344 return Err(ValidationError::new(
12345 1005,
12346 "addtl_inf does not match the required pattern".to_string(),
12347 ));
12348 }
12349 }
12350 Ok(())
12351 }
12352}
12353
12354#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12356pub struct TaxRecordDetails2 {
12357 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
12358 pub prd: Option<TaxPeriod2>,
12359 #[serde(rename = "Amt")]
12360 pub amt: ActiveOrHistoricCurrencyAndAmount,
12361}
12362
12363impl TaxRecordDetails2 {
12364 pub fn validate(&self) -> Result<(), ValidationError> {
12365 if let Some(ref val) = self.prd {
12366 val.validate()?
12367 }
12368 self.amt.validate()?;
12369 Ok(())
12370 }
12371}
12372
12373#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12375pub enum TaxRecordPeriod1Code {
12376 #[default]
12377 #[serde(rename = "MM01")]
12378 CodeMM01,
12379 #[serde(rename = "MM02")]
12380 CodeMM02,
12381 #[serde(rename = "MM03")]
12382 CodeMM03,
12383 #[serde(rename = "MM04")]
12384 CodeMM04,
12385 #[serde(rename = "MM05")]
12386 CodeMM05,
12387 #[serde(rename = "MM06")]
12388 CodeMM06,
12389 #[serde(rename = "MM07")]
12390 CodeMM07,
12391 #[serde(rename = "MM08")]
12392 CodeMM08,
12393 #[serde(rename = "MM09")]
12394 CodeMM09,
12395 #[serde(rename = "MM10")]
12396 CodeMM10,
12397 #[serde(rename = "MM11")]
12398 CodeMM11,
12399 #[serde(rename = "MM12")]
12400 CodeMM12,
12401 #[serde(rename = "QTR1")]
12402 CodeQTR1,
12403 #[serde(rename = "QTR2")]
12404 CodeQTR2,
12405 #[serde(rename = "QTR3")]
12406 CodeQTR3,
12407 #[serde(rename = "QTR4")]
12408 CodeQTR4,
12409 #[serde(rename = "HLF1")]
12410 CodeHLF1,
12411 #[serde(rename = "HLF2")]
12412 CodeHLF2,
12413}
12414
12415impl TaxRecordPeriod1Code {
12416 pub fn validate(&self) -> Result<(), ValidationError> {
12417 Ok(())
12418 }
12419}
12420
12421#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12423pub struct TechnicalInputChannel1Choice1 {
12424 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
12425 pub cd: Option<String>,
12426 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12427 pub prtry: Option<String>,
12428}
12429
12430impl TechnicalInputChannel1Choice1 {
12431 pub fn validate(&self) -> Result<(), ValidationError> {
12432 if let Some(ref val) = self.cd {
12433 if val.chars().count() < 1 {
12434 return Err(ValidationError::new(
12435 1001,
12436 "cd is shorter than the minimum length of 1".to_string(),
12437 ));
12438 }
12439 if val.chars().count() > 4 {
12440 return Err(ValidationError::new(
12441 1002,
12442 "cd exceeds the maximum length of 4".to_string(),
12443 ));
12444 }
12445 }
12446 if let Some(ref val) = self.prtry {
12447 if val.chars().count() < 1 {
12448 return Err(ValidationError::new(
12449 1001,
12450 "prtry is shorter than the minimum length of 1".to_string(),
12451 ));
12452 }
12453 if val.chars().count() > 35 {
12454 return Err(ValidationError::new(
12455 1002,
12456 "prtry exceeds the maximum length of 35".to_string(),
12457 ));
12458 }
12459 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12460 if !pattern.is_match(val) {
12461 return Err(ValidationError::new(
12462 1005,
12463 "prtry does not match the required pattern".to_string(),
12464 ));
12465 }
12466 }
12467 Ok(())
12468 }
12469}
12470
12471#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12473pub struct TotalTransactions61 {
12474 #[serde(rename = "TtlNtries", skip_serializing_if = "Option::is_none")]
12475 pub ttl_ntries: Option<NumberAndSumOfTransactions4>,
12476 #[serde(rename = "TtlCdtNtries", skip_serializing_if = "Option::is_none")]
12477 pub ttl_cdt_ntries: Option<NumberAndSumOfTransactions1>,
12478 #[serde(rename = "TtlDbtNtries", skip_serializing_if = "Option::is_none")]
12479 pub ttl_dbt_ntries: Option<NumberAndSumOfTransactions1>,
12480 #[serde(rename = "TtlNtriesPerBkTxCd", skip_serializing_if = "Option::is_none")]
12481 pub ttl_ntries_per_bk_tx_cd: Option<Vec<TotalsPerBankTransactionCode51>>,
12482}
12483
12484impl TotalTransactions61 {
12485 pub fn validate(&self) -> Result<(), ValidationError> {
12486 if let Some(ref val) = self.ttl_ntries {
12487 val.validate()?
12488 }
12489 if let Some(ref val) = self.ttl_cdt_ntries {
12490 val.validate()?
12491 }
12492 if let Some(ref val) = self.ttl_dbt_ntries {
12493 val.validate()?
12494 }
12495 if let Some(ref vec) = self.ttl_ntries_per_bk_tx_cd {
12496 for item in vec {
12497 item.validate()?
12498 }
12499 }
12500 Ok(())
12501 }
12502}
12503
12504#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12506pub struct TotalsPerBankTransactionCode51 {
12507 #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
12508 pub nb_of_ntries: Option<String>,
12509 #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
12510 pub sum: Option<f64>,
12511 #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
12512 pub ttl_net_ntry: Option<AmountAndDirection35>,
12513 #[serde(rename = "CdtNtries", skip_serializing_if = "Option::is_none")]
12514 pub cdt_ntries: Option<NumberAndSumOfTransactions1>,
12515 #[serde(rename = "DbtNtries", skip_serializing_if = "Option::is_none")]
12516 pub dbt_ntries: Option<NumberAndSumOfTransactions1>,
12517 #[serde(rename = "FcstInd", skip_serializing_if = "Option::is_none")]
12518 pub fcst_ind: Option<bool>,
12519 #[serde(rename = "BkTxCd")]
12520 pub bk_tx_cd: BankTransactionCodeStructure41,
12521 #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
12522 pub avlbty: Option<Vec<CashAvailability1>>,
12523 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
12524 pub dt: Option<DateAndDateTime2Choice1>,
12525}
12526
12527impl TotalsPerBankTransactionCode51 {
12528 pub fn validate(&self) -> Result<(), ValidationError> {
12529 if let Some(ref val) = self.nb_of_ntries {
12530 let pattern = Regex::new("[0-9]{1,15}").unwrap();
12531 if !pattern.is_match(val) {
12532 return Err(ValidationError::new(
12533 1005,
12534 "nb_of_ntries does not match the required pattern".to_string(),
12535 ));
12536 }
12537 }
12538 if let Some(ref val) = self.ttl_net_ntry {
12539 val.validate()?
12540 }
12541 if let Some(ref val) = self.cdt_ntries {
12542 val.validate()?
12543 }
12544 if let Some(ref val) = self.dbt_ntries {
12545 val.validate()?
12546 }
12547 self.bk_tx_cd.validate()?;
12548 if let Some(ref vec) = self.avlbty {
12549 for item in vec {
12550 item.validate()?
12551 }
12552 }
12553 if let Some(ref val) = self.dt {
12554 val.validate()?
12555 }
12556 Ok(())
12557 }
12558}
12559
12560#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12562pub struct TrackData11 {
12563 #[serde(rename = "TrckNb", skip_serializing_if = "Option::is_none")]
12564 pub trck_nb: Option<String>,
12565 #[serde(rename = "TrckVal")]
12566 pub trck_val: String,
12567}
12568
12569impl TrackData11 {
12570 pub fn validate(&self) -> Result<(), ValidationError> {
12571 if let Some(ref val) = self.trck_nb {
12572 let pattern = Regex::new("[0-9]").unwrap();
12573 if !pattern.is_match(val) {
12574 return Err(ValidationError::new(
12575 1005,
12576 "trck_nb does not match the required pattern".to_string(),
12577 ));
12578 }
12579 }
12580 if self.trck_val.chars().count() < 1 {
12581 return Err(ValidationError::new(
12582 1001,
12583 "trck_val is shorter than the minimum length of 1".to_string(),
12584 ));
12585 }
12586 if self.trck_val.chars().count() > 140 {
12587 return Err(ValidationError::new(
12588 1002,
12589 "trck_val exceeds the maximum length of 140".to_string(),
12590 ));
12591 }
12592 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12593 if !pattern.is_match(&self.trck_val) {
12594 return Err(ValidationError::new(
12595 1005,
12596 "trck_val does not match the required pattern".to_string(),
12597 ));
12598 }
12599 Ok(())
12600 }
12601}
12602
12603#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12605pub struct TransactionAgents51 {
12606 #[serde(rename = "InstgAgt", skip_serializing_if = "Option::is_none")]
12607 pub instg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12608 #[serde(rename = "InstdAgt", skip_serializing_if = "Option::is_none")]
12609 pub instd_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12610 #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
12611 pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification67>,
12612 #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
12613 pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12614 #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
12615 pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification65>,
12616 #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
12617 pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification65>,
12618 #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
12619 pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification65>,
12620 #[serde(rename = "RcvgAgt", skip_serializing_if = "Option::is_none")]
12621 pub rcvg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12622 #[serde(rename = "DlvrgAgt", skip_serializing_if = "Option::is_none")]
12623 pub dlvrg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12624 #[serde(rename = "IssgAgt", skip_serializing_if = "Option::is_none")]
12625 pub issg_agt: Option<BranchAndFinancialInstitutionIdentification65>,
12626 #[serde(rename = "SttlmPlc", skip_serializing_if = "Option::is_none")]
12627 pub sttlm_plc: Option<BranchAndFinancialInstitutionIdentification65>,
12628 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12629 pub prtry: Option<Vec<ProprietaryAgent41>>,
12630}
12631
12632impl TransactionAgents51 {
12633 pub fn validate(&self) -> Result<(), ValidationError> {
12634 if let Some(ref val) = self.instg_agt {
12635 val.validate()?
12636 }
12637 if let Some(ref val) = self.instd_agt {
12638 val.validate()?
12639 }
12640 if let Some(ref val) = self.dbtr_agt {
12641 val.validate()?
12642 }
12643 if let Some(ref val) = self.cdtr_agt {
12644 val.validate()?
12645 }
12646 if let Some(ref val) = self.intrmy_agt1 {
12647 val.validate()?
12648 }
12649 if let Some(ref val) = self.intrmy_agt2 {
12650 val.validate()?
12651 }
12652 if let Some(ref val) = self.intrmy_agt3 {
12653 val.validate()?
12654 }
12655 if let Some(ref val) = self.rcvg_agt {
12656 val.validate()?
12657 }
12658 if let Some(ref val) = self.dlvrg_agt {
12659 val.validate()?
12660 }
12661 if let Some(ref val) = self.issg_agt {
12662 val.validate()?
12663 }
12664 if let Some(ref val) = self.sttlm_plc {
12665 val.validate()?
12666 }
12667 if let Some(ref vec) = self.prtry {
12668 for item in vec {
12669 item.validate()?
12670 }
12671 }
12672 Ok(())
12673 }
12674}
12675
12676#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12678pub enum TransactionChannel1Code {
12679 #[default]
12680 #[serde(rename = "MAIL")]
12681 CodeMAIL,
12682 #[serde(rename = "TLPH")]
12683 CodeTLPH,
12684 #[serde(rename = "ECOM")]
12685 CodeECOM,
12686 #[serde(rename = "TVPY")]
12687 CodeTVPY,
12688}
12689
12690impl TransactionChannel1Code {
12691 pub fn validate(&self) -> Result<(), ValidationError> {
12692 Ok(())
12693 }
12694}
12695
12696#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12698pub struct TransactionDates31 {
12699 #[serde(rename = "AccptncDtTm", skip_serializing_if = "Option::is_none")]
12700 pub accptnc_dt_tm: Option<String>,
12701 #[serde(
12702 rename = "TradActvtyCtrctlSttlmDt",
12703 skip_serializing_if = "Option::is_none"
12704 )]
12705 pub trad_actvty_ctrctl_sttlm_dt: Option<String>,
12706 #[serde(rename = "TradDt", skip_serializing_if = "Option::is_none")]
12707 pub trad_dt: Option<String>,
12708 #[serde(rename = "IntrBkSttlmDt", skip_serializing_if = "Option::is_none")]
12709 pub intr_bk_sttlm_dt: Option<String>,
12710 #[serde(rename = "StartDt", skip_serializing_if = "Option::is_none")]
12711 pub start_dt: Option<String>,
12712 #[serde(rename = "EndDt", skip_serializing_if = "Option::is_none")]
12713 pub end_dt: Option<String>,
12714 #[serde(rename = "TxDtTm", skip_serializing_if = "Option::is_none")]
12715 pub tx_dt_tm: Option<String>,
12716 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12717 pub prtry: Option<Vec<ProprietaryDate31>>,
12718}
12719
12720impl TransactionDates31 {
12721 pub fn validate(&self) -> Result<(), ValidationError> {
12722 if let Some(ref val) = self.accptnc_dt_tm {
12723 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
12724 if !pattern.is_match(val) {
12725 return Err(ValidationError::new(
12726 1005,
12727 "accptnc_dt_tm does not match the required pattern".to_string(),
12728 ));
12729 }
12730 }
12731 if let Some(ref val) = self.tx_dt_tm {
12732 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
12733 if !pattern.is_match(val) {
12734 return Err(ValidationError::new(
12735 1005,
12736 "tx_dt_tm does not match the required pattern".to_string(),
12737 ));
12738 }
12739 }
12740 if let Some(ref vec) = self.prtry {
12741 for item in vec {
12742 item.validate()?
12743 }
12744 }
12745 Ok(())
12746 }
12747}
12748
12749#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12751pub enum TransactionEnvironment1Code {
12752 #[default]
12753 #[serde(rename = "MERC")]
12754 CodeMERC,
12755 #[serde(rename = "PRIV")]
12756 CodePRIV,
12757 #[serde(rename = "PUBL")]
12758 CodePUBL,
12759}
12760
12761impl TransactionEnvironment1Code {
12762 pub fn validate(&self) -> Result<(), ValidationError> {
12763 Ok(())
12764 }
12765}
12766
12767#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12769pub struct TransactionIdentifier11 {
12770 #[serde(rename = "TxDtTm")]
12771 pub tx_dt_tm: String,
12772 #[serde(rename = "TxRef")]
12773 pub tx_ref: String,
12774}
12775
12776impl TransactionIdentifier11 {
12777 pub fn validate(&self) -> Result<(), ValidationError> {
12778 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
12779 if !pattern.is_match(&self.tx_dt_tm) {
12780 return Err(ValidationError::new(
12781 1005,
12782 "tx_dt_tm does not match the required pattern".to_string(),
12783 ));
12784 }
12785 if self.tx_ref.chars().count() < 1 {
12786 return Err(ValidationError::new(
12787 1001,
12788 "tx_ref is shorter than the minimum length of 1".to_string(),
12789 ));
12790 }
12791 if self.tx_ref.chars().count() > 35 {
12792 return Err(ValidationError::new(
12793 1002,
12794 "tx_ref exceeds the maximum length of 35".to_string(),
12795 ));
12796 }
12797 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12798 if !pattern.is_match(&self.tx_ref) {
12799 return Err(ValidationError::new(
12800 1005,
12801 "tx_ref does not match the required pattern".to_string(),
12802 ));
12803 }
12804 Ok(())
12805 }
12806}
12807
12808#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12810pub struct TransactionInterest41 {
12811 #[serde(rename = "TtlIntrstAndTaxAmt", skip_serializing_if = "Option::is_none")]
12812 pub ttl_intrst_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
12813 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
12814 pub rcrd: Option<Vec<InterestRecord21>>,
12815}
12816
12817impl TransactionInterest41 {
12818 pub fn validate(&self) -> Result<(), ValidationError> {
12819 if let Some(ref val) = self.ttl_intrst_and_tax_amt {
12820 val.validate()?
12821 }
12822 if let Some(ref vec) = self.rcrd {
12823 for item in vec {
12824 item.validate()?
12825 }
12826 }
12827 Ok(())
12828 }
12829}
12830
12831#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12833pub struct TransactionParties61 {
12834 #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
12835 pub initg_pty: Option<Party40Choice1>,
12836 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
12837 pub dbtr: Option<Party40Choice2>,
12838 #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
12839 pub dbtr_acct: Option<CashAccount383>,
12840 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
12841 pub ultmt_dbtr: Option<Party40Choice3>,
12842 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
12843 pub cdtr: Option<Party40Choice4>,
12844 #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
12845 pub cdtr_acct: Option<CashAccount384>,
12846 #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
12847 pub ultmt_cdtr: Option<Party40Choice4>,
12848 #[serde(rename = "TradgPty", skip_serializing_if = "Option::is_none")]
12849 pub tradg_pty: Option<Party40Choice4>,
12850 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12851 pub prtry: Option<Vec<ProprietaryParty51>>,
12852}
12853
12854impl TransactionParties61 {
12855 pub fn validate(&self) -> Result<(), ValidationError> {
12856 if let Some(ref val) = self.initg_pty {
12857 val.validate()?
12858 }
12859 if let Some(ref val) = self.dbtr {
12860 val.validate()?
12861 }
12862 if let Some(ref val) = self.dbtr_acct {
12863 val.validate()?
12864 }
12865 if let Some(ref val) = self.ultmt_dbtr {
12866 val.validate()?
12867 }
12868 if let Some(ref val) = self.cdtr {
12869 val.validate()?
12870 }
12871 if let Some(ref val) = self.cdtr_acct {
12872 val.validate()?
12873 }
12874 if let Some(ref val) = self.ultmt_cdtr {
12875 val.validate()?
12876 }
12877 if let Some(ref val) = self.tradg_pty {
12878 val.validate()?
12879 }
12880 if let Some(ref vec) = self.prtry {
12881 for item in vec {
12882 item.validate()?
12883 }
12884 }
12885 Ok(())
12886 }
12887}
12888
12889#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12891pub struct TransactionPrice4Choice1 {
12892 #[serde(rename = "DealPric", skip_serializing_if = "Option::is_none")]
12893 pub deal_pric: Option<Price7>,
12894 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12895 pub prtry: Option<Vec<ProprietaryPrice21>>,
12896}
12897
12898impl TransactionPrice4Choice1 {
12899 pub fn validate(&self) -> Result<(), ValidationError> {
12900 if let Some(ref val) = self.deal_pric {
12901 val.validate()?
12902 }
12903 if let Some(ref vec) = self.prtry {
12904 for item in vec {
12905 item.validate()?
12906 }
12907 }
12908 Ok(())
12909 }
12910}
12911
12912#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12914pub struct TransactionQuantities3Choice1 {
12915 #[serde(rename = "Qty", skip_serializing_if = "Option::is_none")]
12916 pub qty: Option<FinancialInstrumentQuantity1Choice>,
12917 #[serde(rename = "OrgnlAndCurFaceAmt", skip_serializing_if = "Option::is_none")]
12918 pub orgnl_and_cur_face_amt: Option<OriginalAndCurrentQuantities1>,
12919 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12920 pub prtry: Option<ProprietaryQuantity11>,
12921}
12922
12923impl TransactionQuantities3Choice1 {
12924 pub fn validate(&self) -> Result<(), ValidationError> {
12925 if let Some(ref val) = self.qty {
12926 val.validate()?
12927 }
12928 if let Some(ref val) = self.orgnl_and_cur_face_amt {
12929 val.validate()?
12930 }
12931 if let Some(ref val) = self.prtry {
12932 val.validate()?
12933 }
12934 Ok(())
12935 }
12936}
12937
12938#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
12940pub struct TransactionReferences61 {
12941 #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
12942 pub msg_id: Option<String>,
12943 #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
12944 pub acct_svcr_ref: Option<String>,
12945 #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
12946 pub pmt_inf_id: Option<String>,
12947 #[serde(rename = "InstrId")]
12948 pub instr_id: String,
12949 #[serde(rename = "EndToEndId", skip_serializing_if = "Option::is_none")]
12950 pub end_to_end_id: Option<String>,
12951 #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
12952 pub uetr: Option<String>,
12953 #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
12954 pub tx_id: Option<String>,
12955 #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
12956 pub mndt_id: Option<String>,
12957 #[serde(rename = "ChqNb", skip_serializing_if = "Option::is_none")]
12958 pub chq_nb: Option<String>,
12959 #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
12960 pub clr_sys_ref: Option<String>,
12961 #[serde(rename = "AcctOwnrTxId", skip_serializing_if = "Option::is_none")]
12962 pub acct_ownr_tx_id: Option<String>,
12963 #[serde(rename = "AcctSvcrTxId", skip_serializing_if = "Option::is_none")]
12964 pub acct_svcr_tx_id: Option<String>,
12965 #[serde(rename = "MktInfrstrctrTxId", skip_serializing_if = "Option::is_none")]
12966 pub mkt_infrstrctr_tx_id: Option<String>,
12967 #[serde(rename = "PrcgId", skip_serializing_if = "Option::is_none")]
12968 pub prcg_id: Option<String>,
12969 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
12970 pub prtry: Option<Vec<ProprietaryReference11>>,
12971}
12972
12973impl TransactionReferences61 {
12974 pub fn validate(&self) -> Result<(), ValidationError> {
12975 if let Some(ref val) = self.msg_id {
12976 if val.chars().count() < 1 {
12977 return Err(ValidationError::new(
12978 1001,
12979 "msg_id is shorter than the minimum length of 1".to_string(),
12980 ));
12981 }
12982 if val.chars().count() > 35 {
12983 return Err(ValidationError::new(
12984 1002,
12985 "msg_id exceeds the maximum length of 35".to_string(),
12986 ));
12987 }
12988 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
12989 if !pattern.is_match(val) {
12990 return Err(ValidationError::new(
12991 1005,
12992 "msg_id does not match the required pattern".to_string(),
12993 ));
12994 }
12995 }
12996 if let Some(ref val) = self.acct_svcr_ref {
12997 if val.chars().count() < 1 {
12998 return Err(ValidationError::new(
12999 1001,
13000 "acct_svcr_ref is shorter than the minimum length of 1".to_string(),
13001 ));
13002 }
13003 if val.chars().count() > 35 {
13004 return Err(ValidationError::new(
13005 1002,
13006 "acct_svcr_ref exceeds the maximum length of 35".to_string(),
13007 ));
13008 }
13009 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13010 if !pattern.is_match(val) {
13011 return Err(ValidationError::new(
13012 1005,
13013 "acct_svcr_ref does not match the required pattern".to_string(),
13014 ));
13015 }
13016 }
13017 if let Some(ref val) = self.pmt_inf_id {
13018 if val.chars().count() < 1 {
13019 return Err(ValidationError::new(
13020 1001,
13021 "pmt_inf_id is shorter than the minimum length of 1".to_string(),
13022 ));
13023 }
13024 if val.chars().count() > 35 {
13025 return Err(ValidationError::new(
13026 1002,
13027 "pmt_inf_id exceeds the maximum length of 35".to_string(),
13028 ));
13029 }
13030 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13031 if !pattern.is_match(val) {
13032 return Err(ValidationError::new(
13033 1005,
13034 "pmt_inf_id does not match the required pattern".to_string(),
13035 ));
13036 }
13037 }
13038 if self.instr_id.chars().count() < 1 {
13039 return Err(ValidationError::new(
13040 1001,
13041 "instr_id is shorter than the minimum length of 1".to_string(),
13042 ));
13043 }
13044 if self.instr_id.chars().count() > 35 {
13045 return Err(ValidationError::new(
13046 1002,
13047 "instr_id exceeds the maximum length of 35".to_string(),
13048 ));
13049 }
13050 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13051 if !pattern.is_match(&self.instr_id) {
13052 return Err(ValidationError::new(
13053 1005,
13054 "instr_id does not match the required pattern".to_string(),
13055 ));
13056 }
13057 if let Some(ref val) = self.end_to_end_id {
13058 if val.chars().count() < 1 {
13059 return Err(ValidationError::new(
13060 1001,
13061 "end_to_end_id is shorter than the minimum length of 1".to_string(),
13062 ));
13063 }
13064 if val.chars().count() > 35 {
13065 return Err(ValidationError::new(
13066 1002,
13067 "end_to_end_id exceeds the maximum length of 35".to_string(),
13068 ));
13069 }
13070 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13071 if !pattern.is_match(val) {
13072 return Err(ValidationError::new(
13073 1005,
13074 "end_to_end_id does not match the required pattern".to_string(),
13075 ));
13076 }
13077 }
13078 if let Some(ref val) = self.uetr {
13079 let pattern =
13080 Regex::new("[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}")
13081 .unwrap();
13082 if !pattern.is_match(val) {
13083 return Err(ValidationError::new(
13084 1005,
13085 "uetr does not match the required pattern".to_string(),
13086 ));
13087 }
13088 }
13089 if let Some(ref val) = self.tx_id {
13090 if val.chars().count() < 1 {
13091 return Err(ValidationError::new(
13092 1001,
13093 "tx_id is shorter than the minimum length of 1".to_string(),
13094 ));
13095 }
13096 if val.chars().count() > 35 {
13097 return Err(ValidationError::new(
13098 1002,
13099 "tx_id exceeds the maximum length of 35".to_string(),
13100 ));
13101 }
13102 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13103 if !pattern.is_match(val) {
13104 return Err(ValidationError::new(
13105 1005,
13106 "tx_id does not match the required pattern".to_string(),
13107 ));
13108 }
13109 }
13110 if let Some(ref val) = self.mndt_id {
13111 if val.chars().count() < 1 {
13112 return Err(ValidationError::new(
13113 1001,
13114 "mndt_id is shorter than the minimum length of 1".to_string(),
13115 ));
13116 }
13117 if val.chars().count() > 35 {
13118 return Err(ValidationError::new(
13119 1002,
13120 "mndt_id exceeds the maximum length of 35".to_string(),
13121 ));
13122 }
13123 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13124 if !pattern.is_match(val) {
13125 return Err(ValidationError::new(
13126 1005,
13127 "mndt_id does not match the required pattern".to_string(),
13128 ));
13129 }
13130 }
13131 if let Some(ref val) = self.chq_nb {
13132 if val.chars().count() < 1 {
13133 return Err(ValidationError::new(
13134 1001,
13135 "chq_nb is shorter than the minimum length of 1".to_string(),
13136 ));
13137 }
13138 if val.chars().count() > 35 {
13139 return Err(ValidationError::new(
13140 1002,
13141 "chq_nb exceeds the maximum length of 35".to_string(),
13142 ));
13143 }
13144 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13145 if !pattern.is_match(val) {
13146 return Err(ValidationError::new(
13147 1005,
13148 "chq_nb does not match the required pattern".to_string(),
13149 ));
13150 }
13151 }
13152 if let Some(ref val) = self.clr_sys_ref {
13153 if val.chars().count() < 1 {
13154 return Err(ValidationError::new(
13155 1001,
13156 "clr_sys_ref is shorter than the minimum length of 1".to_string(),
13157 ));
13158 }
13159 if val.chars().count() > 35 {
13160 return Err(ValidationError::new(
13161 1002,
13162 "clr_sys_ref exceeds the maximum length of 35".to_string(),
13163 ));
13164 }
13165 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13166 if !pattern.is_match(val) {
13167 return Err(ValidationError::new(
13168 1005,
13169 "clr_sys_ref does not match the required pattern".to_string(),
13170 ));
13171 }
13172 }
13173 if let Some(ref val) = self.acct_ownr_tx_id {
13174 if val.chars().count() < 1 {
13175 return Err(ValidationError::new(
13176 1001,
13177 "acct_ownr_tx_id is shorter than the minimum length of 1".to_string(),
13178 ));
13179 }
13180 if val.chars().count() > 35 {
13181 return Err(ValidationError::new(
13182 1002,
13183 "acct_ownr_tx_id exceeds the maximum length of 35".to_string(),
13184 ));
13185 }
13186 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13187 if !pattern.is_match(val) {
13188 return Err(ValidationError::new(
13189 1005,
13190 "acct_ownr_tx_id does not match the required pattern".to_string(),
13191 ));
13192 }
13193 }
13194 if let Some(ref val) = self.acct_svcr_tx_id {
13195 if val.chars().count() < 1 {
13196 return Err(ValidationError::new(
13197 1001,
13198 "acct_svcr_tx_id is shorter than the minimum length of 1".to_string(),
13199 ));
13200 }
13201 if val.chars().count() > 35 {
13202 return Err(ValidationError::new(
13203 1002,
13204 "acct_svcr_tx_id exceeds the maximum length of 35".to_string(),
13205 ));
13206 }
13207 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13208 if !pattern.is_match(val) {
13209 return Err(ValidationError::new(
13210 1005,
13211 "acct_svcr_tx_id does not match the required pattern".to_string(),
13212 ));
13213 }
13214 }
13215 if let Some(ref val) = self.mkt_infrstrctr_tx_id {
13216 if val.chars().count() < 1 {
13217 return Err(ValidationError::new(
13218 1001,
13219 "mkt_infrstrctr_tx_id is shorter than the minimum length of 1".to_string(),
13220 ));
13221 }
13222 if val.chars().count() > 35 {
13223 return Err(ValidationError::new(
13224 1002,
13225 "mkt_infrstrctr_tx_id exceeds the maximum length of 35".to_string(),
13226 ));
13227 }
13228 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13229 if !pattern.is_match(val) {
13230 return Err(ValidationError::new(
13231 1005,
13232 "mkt_infrstrctr_tx_id does not match the required pattern".to_string(),
13233 ));
13234 }
13235 }
13236 if let Some(ref val) = self.prcg_id {
13237 if val.chars().count() < 1 {
13238 return Err(ValidationError::new(
13239 1001,
13240 "prcg_id is shorter than the minimum length of 1".to_string(),
13241 ));
13242 }
13243 if val.chars().count() > 35 {
13244 return Err(ValidationError::new(
13245 1002,
13246 "prcg_id exceeds the maximum length of 35".to_string(),
13247 ));
13248 }
13249 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
13250 if !pattern.is_match(val) {
13251 return Err(ValidationError::new(
13252 1005,
13253 "prcg_id does not match the required pattern".to_string(),
13254 ));
13255 }
13256 }
13257 if let Some(ref vec) = self.prtry {
13258 for item in vec {
13259 item.validate()?
13260 }
13261 }
13262 Ok(())
13263 }
13264}
13265
13266#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13268pub enum UnitOfMeasure1Code {
13269 #[default]
13270 #[serde(rename = "PIEC")]
13271 CodePIEC,
13272 #[serde(rename = "TONS")]
13273 CodeTONS,
13274 #[serde(rename = "FOOT")]
13275 CodeFOOT,
13276 #[serde(rename = "GBGA")]
13277 CodeGBGA,
13278 #[serde(rename = "USGA")]
13279 CodeUSGA,
13280 #[serde(rename = "GRAM")]
13281 CodeGRAM,
13282 #[serde(rename = "INCH")]
13283 CodeINCH,
13284 #[serde(rename = "KILO")]
13285 CodeKILO,
13286 #[serde(rename = "PUND")]
13287 CodePUND,
13288 #[serde(rename = "METR")]
13289 CodeMETR,
13290 #[serde(rename = "CMET")]
13291 CodeCMET,
13292 #[serde(rename = "MMET")]
13293 CodeMMET,
13294 #[serde(rename = "LITR")]
13295 CodeLITR,
13296 #[serde(rename = "CELI")]
13297 CodeCELI,
13298 #[serde(rename = "MILI")]
13299 CodeMILI,
13300 #[serde(rename = "GBOU")]
13301 CodeGBOU,
13302 #[serde(rename = "USOU")]
13303 CodeUSOU,
13304 #[serde(rename = "GBQA")]
13305 CodeGBQA,
13306 #[serde(rename = "USQA")]
13307 CodeUSQA,
13308 #[serde(rename = "GBPI")]
13309 CodeGBPI,
13310 #[serde(rename = "USPI")]
13311 CodeUSPI,
13312 #[serde(rename = "MILE")]
13313 CodeMILE,
13314 #[serde(rename = "KMET")]
13315 CodeKMET,
13316 #[serde(rename = "YARD")]
13317 CodeYARD,
13318 #[serde(rename = "SQKI")]
13319 CodeSQKI,
13320 #[serde(rename = "HECT")]
13321 CodeHECT,
13322 #[serde(rename = "ARES")]
13323 CodeARES,
13324 #[serde(rename = "SMET")]
13325 CodeSMET,
13326 #[serde(rename = "SCMT")]
13327 CodeSCMT,
13328 #[serde(rename = "SMIL")]
13329 CodeSMIL,
13330 #[serde(rename = "SQMI")]
13331 CodeSQMI,
13332 #[serde(rename = "SQYA")]
13333 CodeSQYA,
13334 #[serde(rename = "SQFO")]
13335 CodeSQFO,
13336 #[serde(rename = "SQIN")]
13337 CodeSQIN,
13338 #[serde(rename = "ACRE")]
13339 CodeACRE,
13340}
13341
13342impl UnitOfMeasure1Code {
13343 pub fn validate(&self) -> Result<(), ValidationError> {
13344 Ok(())
13345 }
13346}
13347
13348#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13350pub enum UserInterface2Code {
13351 #[default]
13352 #[serde(rename = "MDSP")]
13353 CodeMDSP,
13354 #[serde(rename = "CDSP")]
13355 CodeCDSP,
13356}
13357
13358impl UserInterface2Code {
13359 pub fn validate(&self) -> Result<(), ValidationError> {
13360 Ok(())
13361 }
13362}
13363
13364#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
13366pub struct YieldedOrValueType1Choice {
13367 #[serde(rename = "Yldd", skip_serializing_if = "Option::is_none")]
13368 pub yldd: Option<bool>,
13369 #[serde(rename = "ValTp", skip_serializing_if = "Option::is_none")]
13370 pub val_tp: Option<PriceValueType1Code>,
13371}
13372
13373impl YieldedOrValueType1Choice {
13374 pub fn validate(&self) -> Result<(), ValidationError> {
13375 if let Some(ref val) = self.val_tp {
13376 val.validate()?
13377 }
13378 Ok(())
13379 }
13380}