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 AccountReport251 {
110 #[serde(rename = "Id")]
111 pub id: String,
112 #[serde(rename = "RptPgntn")]
113 pub rpt_pgntn: 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 = "Bal", skip_serializing_if = "Option::is_none")]
135 pub bal: Option<Vec<CashBalance81>>,
136 #[serde(rename = "TxsSummry", skip_serializing_if = "Option::is_none")]
137 pub txs_summry: Option<TotalTransactions61>,
138 #[serde(rename = "Ntry", skip_serializing_if = "Option::is_none")]
139 pub ntry: Option<Vec<ReportEntry101>>,
140 #[serde(rename = "AddtlRptInf", skip_serializing_if = "Option::is_none")]
141 pub addtl_rpt_inf: Option<String>,
142}
143
144impl AccountReport251 {
145 pub fn validate(&self) -> Result<(), ValidationError> {
146 if self.id.chars().count() < 1 {
147 return Err(ValidationError::new(
148 1001,
149 "id is shorter than the minimum length of 1".to_string(),
150 ));
151 }
152 if self.id.chars().count() > 35 {
153 return Err(ValidationError::new(
154 1002,
155 "id exceeds the maximum length of 35".to_string(),
156 ));
157 }
158 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
159 if !pattern.is_match(&self.id) {
160 return Err(ValidationError::new(
161 1005,
162 "id does not match the required pattern".to_string(),
163 ));
164 }
165 self.rpt_pgntn.validate()?;
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 vec) = self.bal {
197 for item in vec {
198 item.validate()?
199 }
200 }
201 if let Some(ref val) = self.txs_summry {
202 val.validate()?
203 }
204 if let Some(ref vec) = self.ntry {
205 for item in vec {
206 item.validate()?
207 }
208 }
209 if let Some(ref val) = self.addtl_rpt_inf {
210 if val.chars().count() < 1 {
211 return Err(ValidationError::new(
212 1001,
213 "addtl_rpt_inf is shorter than the minimum length of 1".to_string(),
214 ));
215 }
216 if val.chars().count() > 500 {
217 return Err(ValidationError::new(
218 1002,
219 "addtl_rpt_inf exceeds the maximum length of 500".to_string(),
220 ));
221 }
222 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
223 if !pattern.is_match(val) {
224 return Err(ValidationError::new(
225 1005,
226 "addtl_rpt_inf does not match the required pattern".to_string(),
227 ));
228 }
229 }
230 Ok(())
231 }
232}
233
234#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
236pub struct AccountSchemeName1Choice1 {
237 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
238 pub cd: Option<String>,
239 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
240 pub prtry: Option<String>,
241}
242
243impl AccountSchemeName1Choice1 {
244 pub fn validate(&self) -> Result<(), ValidationError> {
245 if let Some(ref val) = self.cd {
246 if val.chars().count() < 1 {
247 return Err(ValidationError::new(
248 1001,
249 "cd is shorter than the minimum length of 1".to_string(),
250 ));
251 }
252 if val.chars().count() > 4 {
253 return Err(ValidationError::new(
254 1002,
255 "cd exceeds the maximum length of 4".to_string(),
256 ));
257 }
258 }
259 if let Some(ref val) = self.prtry {
260 if val.chars().count() < 1 {
261 return Err(ValidationError::new(
262 1001,
263 "prtry is shorter than the minimum length of 1".to_string(),
264 ));
265 }
266 if val.chars().count() > 35 {
267 return Err(ValidationError::new(
268 1002,
269 "prtry exceeds the maximum length of 35".to_string(),
270 ));
271 }
272 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
273 if !pattern.is_match(val) {
274 return Err(ValidationError::new(
275 1005,
276 "prtry does not match the required pattern".to_string(),
277 ));
278 }
279 }
280 Ok(())
281 }
282}
283
284#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
286pub struct ActiveOrHistoricCurrencyAndAmount {
287 #[serde(rename = "@Ccy")]
288 pub ccy: String,
289 #[serde(rename = "$value")]
290 pub value: f64,
291}
292
293impl ActiveOrHistoricCurrencyAndAmount {
294 pub fn validate(&self) -> Result<(), ValidationError> {
295 Ok(())
296 }
297}
298
299#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
301pub struct ActiveOrHistoricCurrencyAndAmountRange2 {
302 #[serde(rename = "Amt")]
303 pub amt: ImpliedCurrencyAmountRange1Choice,
304 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
305 pub cdt_dbt_ind: Option<CreditDebitCode>,
306 #[serde(rename = "Ccy")]
307 pub ccy: String,
308}
309
310impl ActiveOrHistoricCurrencyAndAmountRange2 {
311 pub fn validate(&self) -> Result<(), ValidationError> {
312 self.amt.validate()?;
313 if let Some(ref val) = self.cdt_dbt_ind {
314 val.validate()?
315 }
316 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
317 if !pattern.is_match(&self.ccy) {
318 return Err(ValidationError::new(
319 1005,
320 "ccy does not match the required pattern".to_string(),
321 ));
322 }
323 Ok(())
324 }
325}
326
327#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
329pub enum AddressType2Code {
330 #[default]
331 #[serde(rename = "ADDR")]
332 CodeADDR,
333 #[serde(rename = "PBOX")]
334 CodePBOX,
335 #[serde(rename = "HOME")]
336 CodeHOME,
337 #[serde(rename = "BIZZ")]
338 CodeBIZZ,
339 #[serde(rename = "MLTO")]
340 CodeMLTO,
341 #[serde(rename = "DLVY")]
342 CodeDLVY,
343}
344
345impl AddressType2Code {
346 pub fn validate(&self) -> Result<(), ValidationError> {
347 Ok(())
348 }
349}
350
351#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
353pub struct AddressType3Choice1 {
354 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
355 pub cd: Option<AddressType2Code>,
356 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
357 pub prtry: Option<GenericIdentification301>,
358}
359
360impl AddressType3Choice1 {
361 pub fn validate(&self) -> Result<(), ValidationError> {
362 if let Some(ref val) = self.cd {
363 val.validate()?
364 }
365 if let Some(ref val) = self.prtry {
366 val.validate()?
367 }
368 Ok(())
369 }
370}
371
372#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
374pub struct AmountAndCurrencyExchange31 {
375 #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
376 pub instd_amt: Option<AmountAndCurrencyExchangeDetails31>,
377 #[serde(rename = "TxAmt", skip_serializing_if = "Option::is_none")]
378 pub tx_amt: Option<AmountAndCurrencyExchangeDetails31>,
379 #[serde(rename = "CntrValAmt", skip_serializing_if = "Option::is_none")]
380 pub cntr_val_amt: Option<AmountAndCurrencyExchangeDetails31>,
381 #[serde(rename = "AnncdPstngAmt", skip_serializing_if = "Option::is_none")]
382 pub anncd_pstng_amt: Option<AmountAndCurrencyExchangeDetails31>,
383 #[serde(rename = "PrtryAmt", skip_serializing_if = "Option::is_none")]
384 pub prtry_amt: Option<Vec<AmountAndCurrencyExchangeDetails41>>,
385}
386
387impl AmountAndCurrencyExchange31 {
388 pub fn validate(&self) -> Result<(), ValidationError> {
389 if let Some(ref val) = self.instd_amt {
390 val.validate()?
391 }
392 if let Some(ref val) = self.tx_amt {
393 val.validate()?
394 }
395 if let Some(ref val) = self.cntr_val_amt {
396 val.validate()?
397 }
398 if let Some(ref val) = self.anncd_pstng_amt {
399 val.validate()?
400 }
401 if let Some(ref vec) = self.prtry_amt {
402 for item in vec {
403 item.validate()?
404 }
405 }
406 Ok(())
407 }
408}
409
410#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
412pub struct AmountAndCurrencyExchange32 {
413 #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
414 pub instd_amt: Option<AmountAndCurrencyExchangeDetails32>,
415 #[serde(rename = "TxAmt", skip_serializing_if = "Option::is_none")]
416 pub tx_amt: Option<AmountAndCurrencyExchangeDetails32>,
417 #[serde(rename = "CntrValAmt", skip_serializing_if = "Option::is_none")]
418 pub cntr_val_amt: Option<AmountAndCurrencyExchangeDetails32>,
419 #[serde(rename = "AnncdPstngAmt", skip_serializing_if = "Option::is_none")]
420 pub anncd_pstng_amt: Option<AmountAndCurrencyExchangeDetails32>,
421 #[serde(rename = "PrtryAmt", skip_serializing_if = "Option::is_none")]
422 pub prtry_amt: Option<Vec<AmountAndCurrencyExchangeDetails42>>,
423}
424
425impl AmountAndCurrencyExchange32 {
426 pub fn validate(&self) -> Result<(), ValidationError> {
427 if let Some(ref val) = self.instd_amt {
428 val.validate()?
429 }
430 if let Some(ref val) = self.tx_amt {
431 val.validate()?
432 }
433 if let Some(ref val) = self.cntr_val_amt {
434 val.validate()?
435 }
436 if let Some(ref val) = self.anncd_pstng_amt {
437 val.validate()?
438 }
439 if let Some(ref vec) = self.prtry_amt {
440 for item in vec {
441 item.validate()?
442 }
443 }
444 Ok(())
445 }
446}
447
448#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
450pub struct AmountAndCurrencyExchangeDetails31 {
451 #[serde(rename = "Amt")]
452 pub amt: ActiveOrHistoricCurrencyAndAmount,
453 #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
454 pub ccy_xchg: Option<CurrencyExchange51>,
455}
456
457impl AmountAndCurrencyExchangeDetails31 {
458 pub fn validate(&self) -> Result<(), ValidationError> {
459 self.amt.validate()?;
460 if let Some(ref val) = self.ccy_xchg {
461 val.validate()?
462 }
463 Ok(())
464 }
465}
466
467#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
469pub struct AmountAndCurrencyExchangeDetails32 {
470 #[serde(rename = "Amt")]
471 pub amt: ActiveOrHistoricCurrencyAndAmount,
472 #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
473 pub ccy_xchg: Option<CurrencyExchange52>,
474}
475
476impl AmountAndCurrencyExchangeDetails32 {
477 pub fn validate(&self) -> Result<(), ValidationError> {
478 self.amt.validate()?;
479 if let Some(ref val) = self.ccy_xchg {
480 val.validate()?
481 }
482 Ok(())
483 }
484}
485
486#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
488pub struct AmountAndCurrencyExchangeDetails41 {
489 #[serde(rename = "Tp")]
490 pub tp: String,
491 #[serde(rename = "Amt")]
492 pub amt: ActiveOrHistoricCurrencyAndAmount,
493 #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
494 pub ccy_xchg: Option<CurrencyExchange51>,
495}
496
497impl AmountAndCurrencyExchangeDetails41 {
498 pub fn validate(&self) -> Result<(), ValidationError> {
499 if self.tp.chars().count() < 1 {
500 return Err(ValidationError::new(
501 1001,
502 "tp is shorter than the minimum length of 1".to_string(),
503 ));
504 }
505 if self.tp.chars().count() > 35 {
506 return Err(ValidationError::new(
507 1002,
508 "tp exceeds the maximum length of 35".to_string(),
509 ));
510 }
511 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
512 if !pattern.is_match(&self.tp) {
513 return Err(ValidationError::new(
514 1005,
515 "tp does not match the required pattern".to_string(),
516 ));
517 }
518 self.amt.validate()?;
519 if let Some(ref val) = self.ccy_xchg {
520 val.validate()?
521 }
522 Ok(())
523 }
524}
525
526#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
528pub struct AmountAndCurrencyExchangeDetails42 {
529 #[serde(rename = "Tp")]
530 pub tp: String,
531 #[serde(rename = "Amt")]
532 pub amt: ActiveOrHistoricCurrencyAndAmount,
533 #[serde(rename = "CcyXchg", skip_serializing_if = "Option::is_none")]
534 pub ccy_xchg: Option<CurrencyExchange52>,
535}
536
537impl AmountAndCurrencyExchangeDetails42 {
538 pub fn validate(&self) -> Result<(), ValidationError> {
539 if self.tp.chars().count() < 1 {
540 return Err(ValidationError::new(
541 1001,
542 "tp is shorter than the minimum length of 1".to_string(),
543 ));
544 }
545 if self.tp.chars().count() > 35 {
546 return Err(ValidationError::new(
547 1002,
548 "tp exceeds the maximum length of 35".to_string(),
549 ));
550 }
551 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
552 if !pattern.is_match(&self.tp) {
553 return Err(ValidationError::new(
554 1005,
555 "tp does not match the required pattern".to_string(),
556 ));
557 }
558 self.amt.validate()?;
559 if let Some(ref val) = self.ccy_xchg {
560 val.validate()?
561 }
562 Ok(())
563 }
564}
565
566#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
568pub struct AmountAndDirection35 {
569 #[serde(rename = "Amt")]
570 pub amt: f64,
571 #[serde(rename = "CdtDbtInd")]
572 pub cdt_dbt_ind: CreditDebitCode,
573}
574
575impl AmountAndDirection35 {
576 pub fn validate(&self) -> Result<(), ValidationError> {
577 if self.amt < 0.000000 {
578 return Err(ValidationError::new(
579 1003,
580 "amt is less than the minimum value of 0.000000".to_string(),
581 ));
582 }
583 self.cdt_dbt_ind.validate()?;
584 Ok(())
585 }
586}
587
588#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
590pub struct AmountRangeBoundary1 {
591 #[serde(rename = "BdryAmt")]
592 pub bdry_amt: f64,
593 #[serde(rename = "Incl")]
594 pub incl: bool,
595}
596
597impl AmountRangeBoundary1 {
598 pub fn validate(&self) -> Result<(), ValidationError> {
599 if self.bdry_amt < 0.000000 {
600 return Err(ValidationError::new(
601 1003,
602 "bdry_amt is less than the minimum value of 0.000000".to_string(),
603 ));
604 }
605 Ok(())
606 }
607}
608
609#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
611pub enum AttendanceContext1Code {
612 #[default]
613 #[serde(rename = "ATTD")]
614 CodeATTD,
615 #[serde(rename = "SATT")]
616 CodeSATT,
617 #[serde(rename = "UATT")]
618 CodeUATT,
619}
620
621impl AttendanceContext1Code {
622 pub fn validate(&self) -> Result<(), ValidationError> {
623 Ok(())
624 }
625}
626
627#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
629pub enum AuthenticationEntity1Code {
630 #[default]
631 #[serde(rename = "ICCD")]
632 CodeICCD,
633 #[serde(rename = "AGNT")]
634 CodeAGNT,
635 #[serde(rename = "MERC")]
636 CodeMERC,
637}
638
639impl AuthenticationEntity1Code {
640 pub fn validate(&self) -> Result<(), ValidationError> {
641 Ok(())
642 }
643}
644
645#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
647pub enum AuthenticationMethod1Code {
648 #[default]
649 #[serde(rename = "UKNW")]
650 CodeUKNW,
651 #[serde(rename = "BYPS")]
652 CodeBYPS,
653 #[serde(rename = "NPIN")]
654 CodeNPIN,
655 #[serde(rename = "FPIN")]
656 CodeFPIN,
657 #[serde(rename = "CPSG")]
658 CodeCPSG,
659 #[serde(rename = "PPSG")]
660 CodePPSG,
661 #[serde(rename = "MANU")]
662 CodeMANU,
663 #[serde(rename = "MERC")]
664 CodeMERC,
665 #[serde(rename = "SCRT")]
666 CodeSCRT,
667 #[serde(rename = "SNCT")]
668 CodeSNCT,
669 #[serde(rename = "SCNL")]
670 CodeSCNL,
671}
672
673impl AuthenticationMethod1Code {
674 pub fn validate(&self) -> Result<(), ValidationError> {
675 Ok(())
676 }
677}
678
679#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
681pub struct BalanceSubType1Choice1 {
682 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
683 pub cd: Option<String>,
684 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
685 pub prtry: Option<String>,
686}
687
688impl BalanceSubType1Choice1 {
689 pub fn validate(&self) -> Result<(), ValidationError> {
690 if let Some(ref val) = self.cd {
691 if val.chars().count() < 1 {
692 return Err(ValidationError::new(
693 1001,
694 "cd is shorter than the minimum length of 1".to_string(),
695 ));
696 }
697 if val.chars().count() > 4 {
698 return Err(ValidationError::new(
699 1002,
700 "cd exceeds the maximum length of 4".to_string(),
701 ));
702 }
703 }
704 if let Some(ref val) = self.prtry {
705 if val.chars().count() < 1 {
706 return Err(ValidationError::new(
707 1001,
708 "prtry is shorter than the minimum length of 1".to_string(),
709 ));
710 }
711 if val.chars().count() > 35 {
712 return Err(ValidationError::new(
713 1002,
714 "prtry exceeds the maximum length of 35".to_string(),
715 ));
716 }
717 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
718 if !pattern.is_match(val) {
719 return Err(ValidationError::new(
720 1005,
721 "prtry does not match the required pattern".to_string(),
722 ));
723 }
724 }
725 Ok(())
726 }
727}
728
729#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
731pub struct BalanceType10Choice1 {
732 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
733 pub cd: Option<String>,
734 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
735 pub prtry: Option<String>,
736}
737
738impl BalanceType10Choice1 {
739 pub fn validate(&self) -> Result<(), ValidationError> {
740 if let Some(ref val) = self.cd {
741 if val.chars().count() < 1 {
742 return Err(ValidationError::new(
743 1001,
744 "cd is shorter than the minimum length of 1".to_string(),
745 ));
746 }
747 if val.chars().count() > 4 {
748 return Err(ValidationError::new(
749 1002,
750 "cd exceeds the maximum length of 4".to_string(),
751 ));
752 }
753 }
754 if let Some(ref val) = self.prtry {
755 if val.chars().count() < 1 {
756 return Err(ValidationError::new(
757 1001,
758 "prtry is shorter than the minimum length of 1".to_string(),
759 ));
760 }
761 if val.chars().count() > 35 {
762 return Err(ValidationError::new(
763 1002,
764 "prtry exceeds the maximum length of 35".to_string(),
765 ));
766 }
767 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
768 if !pattern.is_match(val) {
769 return Err(ValidationError::new(
770 1005,
771 "prtry does not match the required pattern".to_string(),
772 ));
773 }
774 }
775 Ok(())
776 }
777}
778
779#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
781pub struct BalanceType131 {
782 #[serde(rename = "CdOrPrtry")]
783 pub cd_or_prtry: BalanceType10Choice1,
784 #[serde(rename = "SubTp", skip_serializing_if = "Option::is_none")]
785 pub sub_tp: Option<BalanceSubType1Choice1>,
786}
787
788impl BalanceType131 {
789 pub fn validate(&self) -> Result<(), ValidationError> {
790 self.cd_or_prtry.validate()?;
791 if let Some(ref val) = self.sub_tp {
792 val.validate()?
793 }
794 Ok(())
795 }
796}
797
798#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
800pub struct BankToCustomerAccountReportV08 {
801 #[serde(rename = "GrpHdr")]
802 pub grp_hdr: GroupHeader811,
803 #[serde(rename = "Rpt")]
804 pub rpt: AccountReport251,
805}
806
807impl BankToCustomerAccountReportV08 {
808 pub fn validate(&self) -> Result<(), ValidationError> {
809 self.grp_hdr.validate()?;
810 self.rpt.validate()?;
811 Ok(())
812 }
813}
814
815#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
817pub struct BankTransactionCodeStructure41 {
818 #[serde(rename = "Domn", skip_serializing_if = "Option::is_none")]
819 pub domn: Option<BankTransactionCodeStructure5>,
820 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
821 pub prtry: Option<ProprietaryBankTransactionCodeStructure11>,
822}
823
824impl BankTransactionCodeStructure41 {
825 pub fn validate(&self) -> Result<(), ValidationError> {
826 if let Some(ref val) = self.domn {
827 val.validate()?
828 }
829 if let Some(ref val) = self.prtry {
830 val.validate()?
831 }
832 Ok(())
833 }
834}
835
836#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
838pub struct BankTransactionCodeStructure5 {
839 #[serde(rename = "Cd")]
840 pub cd: String,
841 #[serde(rename = "Fmly")]
842 pub fmly: BankTransactionCodeStructure6,
843}
844
845impl BankTransactionCodeStructure5 {
846 pub fn validate(&self) -> Result<(), ValidationError> {
847 if self.cd.chars().count() < 1 {
848 return Err(ValidationError::new(
849 1001,
850 "cd is shorter than the minimum length of 1".to_string(),
851 ));
852 }
853 if self.cd.chars().count() > 4 {
854 return Err(ValidationError::new(
855 1002,
856 "cd exceeds the maximum length of 4".to_string(),
857 ));
858 }
859 self.fmly.validate()?;
860 Ok(())
861 }
862}
863
864#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
866pub struct BankTransactionCodeStructure6 {
867 #[serde(rename = "Cd")]
868 pub cd: String,
869 #[serde(rename = "SubFmlyCd")]
870 pub sub_fmly_cd: String,
871}
872
873impl BankTransactionCodeStructure6 {
874 pub fn validate(&self) -> Result<(), ValidationError> {
875 if self.cd.chars().count() < 1 {
876 return Err(ValidationError::new(
877 1001,
878 "cd is shorter than the minimum length of 1".to_string(),
879 ));
880 }
881 if self.cd.chars().count() > 4 {
882 return Err(ValidationError::new(
883 1002,
884 "cd exceeds the maximum length of 4".to_string(),
885 ));
886 }
887 if self.sub_fmly_cd.chars().count() < 1 {
888 return Err(ValidationError::new(
889 1001,
890 "sub_fmly_cd is shorter than the minimum length of 1".to_string(),
891 ));
892 }
893 if self.sub_fmly_cd.chars().count() > 4 {
894 return Err(ValidationError::new(
895 1002,
896 "sub_fmly_cd exceeds the maximum length of 4".to_string(),
897 ));
898 }
899 Ok(())
900 }
901}
902
903#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
905pub struct BatchInformation21 {
906 #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
907 pub msg_id: Option<String>,
908 #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
909 pub pmt_inf_id: Option<String>,
910 #[serde(rename = "NbOfTxs", skip_serializing_if = "Option::is_none")]
911 pub nb_of_txs: Option<String>,
912 #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
913 pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
914 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
915 pub cdt_dbt_ind: Option<CreditDebitCode>,
916}
917
918impl BatchInformation21 {
919 pub fn validate(&self) -> Result<(), ValidationError> {
920 if let Some(ref val) = self.msg_id {
921 if val.chars().count() < 1 {
922 return Err(ValidationError::new(
923 1001,
924 "msg_id is shorter than the minimum length of 1".to_string(),
925 ));
926 }
927 if val.chars().count() > 35 {
928 return Err(ValidationError::new(
929 1002,
930 "msg_id exceeds the maximum length of 35".to_string(),
931 ));
932 }
933 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
934 if !pattern.is_match(val) {
935 return Err(ValidationError::new(
936 1005,
937 "msg_id does not match the required pattern".to_string(),
938 ));
939 }
940 }
941 if let Some(ref val) = self.pmt_inf_id {
942 if val.chars().count() < 1 {
943 return Err(ValidationError::new(
944 1001,
945 "pmt_inf_id is shorter than the minimum length of 1".to_string(),
946 ));
947 }
948 if val.chars().count() > 35 {
949 return Err(ValidationError::new(
950 1002,
951 "pmt_inf_id exceeds the maximum length of 35".to_string(),
952 ));
953 }
954 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
955 if !pattern.is_match(val) {
956 return Err(ValidationError::new(
957 1005,
958 "pmt_inf_id does not match the required pattern".to_string(),
959 ));
960 }
961 }
962 if let Some(ref val) = self.nb_of_txs {
963 let pattern = Regex::new("[0-9]{1,15}").unwrap();
964 if !pattern.is_match(val) {
965 return Err(ValidationError::new(
966 1005,
967 "nb_of_txs does not match the required pattern".to_string(),
968 ));
969 }
970 }
971 if let Some(ref val) = self.ttl_amt {
972 val.validate()?
973 }
974 if let Some(ref val) = self.cdt_dbt_ind {
975 val.validate()?
976 }
977 Ok(())
978 }
979}
980
981#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
985pub struct BranchAndFinancialInstitutionIdentification61 {
986 #[serde(rename = "FinInstnId")]
987 pub fin_instn_id: FinancialInstitutionIdentification181,
988 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
989 pub brnch_id: Option<BranchData31>,
990}
991
992impl BranchAndFinancialInstitutionIdentification61 {
993 pub fn validate(&self) -> Result<(), ValidationError> {
994 self.fin_instn_id.validate()?;
995 if let Some(ref val) = self.brnch_id {
996 val.validate()?
997 }
998 Ok(())
999 }
1000}
1001
1002#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1006pub struct BranchAndFinancialInstitutionIdentification62 {
1007 #[serde(rename = "FinInstnId")]
1008 pub fin_instn_id: FinancialInstitutionIdentification181,
1009 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
1010 pub brnch_id: Option<BranchData32>,
1011}
1012
1013impl BranchAndFinancialInstitutionIdentification62 {
1014 pub fn validate(&self) -> Result<(), ValidationError> {
1015 self.fin_instn_id.validate()?;
1016 if let Some(ref val) = self.brnch_id {
1017 val.validate()?
1018 }
1019 Ok(())
1020 }
1021}
1022
1023#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1027pub struct BranchAndFinancialInstitutionIdentification63 {
1028 #[serde(rename = "FinInstnId")]
1029 pub fin_instn_id: FinancialInstitutionIdentification182,
1030 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
1031 pub brnch_id: Option<BranchData32>,
1032}
1033
1034impl BranchAndFinancialInstitutionIdentification63 {
1035 pub fn validate(&self) -> Result<(), ValidationError> {
1036 self.fin_instn_id.validate()?;
1037 if let Some(ref val) = self.brnch_id {
1038 val.validate()?
1039 }
1040 Ok(())
1041 }
1042}
1043
1044#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1048pub struct BranchAndFinancialInstitutionIdentification64 {
1049 #[serde(rename = "FinInstnId")]
1050 pub fin_instn_id: FinancialInstitutionIdentification181,
1051 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
1052 pub brnch_id: Option<BranchData33>,
1053}
1054
1055impl BranchAndFinancialInstitutionIdentification64 {
1056 pub fn validate(&self) -> Result<(), ValidationError> {
1057 self.fin_instn_id.validate()?;
1058 if let Some(ref val) = self.brnch_id {
1059 val.validate()?
1060 }
1061 Ok(())
1062 }
1063}
1064
1065#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1067pub struct BranchData31 {
1068 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1069 pub id: Option<String>,
1070 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1071 pub lei: Option<String>,
1072 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1073 pub nm: Option<String>,
1074 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1075 pub pstl_adr: Option<PostalAddress242>,
1076}
1077
1078impl BranchData31 {
1079 pub fn validate(&self) -> Result<(), ValidationError> {
1080 if let Some(ref val) = self.id {
1081 if val.chars().count() < 1 {
1082 return Err(ValidationError::new(
1083 1001,
1084 "id is shorter than the minimum length of 1".to_string(),
1085 ));
1086 }
1087 if val.chars().count() > 35 {
1088 return Err(ValidationError::new(
1089 1002,
1090 "id exceeds the maximum length of 35".to_string(),
1091 ));
1092 }
1093 }
1094 if let Some(ref val) = self.lei {
1095 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1096 if !pattern.is_match(val) {
1097 return Err(ValidationError::new(
1098 1005,
1099 "lei does not match the required pattern".to_string(),
1100 ));
1101 }
1102 }
1103 if let Some(ref val) = self.nm {
1104 if val.chars().count() < 1 {
1105 return Err(ValidationError::new(
1106 1001,
1107 "nm is shorter than the minimum length of 1".to_string(),
1108 ));
1109 }
1110 if val.chars().count() > 140 {
1111 return Err(ValidationError::new(
1112 1002,
1113 "nm exceeds the maximum length of 140".to_string(),
1114 ));
1115 }
1116 let pattern = Regex::new(
1117 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1118 )
1119 .unwrap();
1120 if !pattern.is_match(val) {
1121 return Err(ValidationError::new(
1122 1005,
1123 "nm does not match the required pattern".to_string(),
1124 ));
1125 }
1126 }
1127 if let Some(ref val) = self.pstl_adr {
1128 val.validate()?
1129 }
1130 Ok(())
1131 }
1132}
1133
1134#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1136pub struct BranchData32 {
1137 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1138 pub id: Option<String>,
1139 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1140 pub lei: Option<String>,
1141 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1142 pub nm: Option<String>,
1143 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1144 pub pstl_adr: Option<PostalAddress241>,
1145}
1146
1147impl BranchData32 {
1148 pub fn validate(&self) -> Result<(), ValidationError> {
1149 if let Some(ref val) = self.id {
1150 if val.chars().count() < 1 {
1151 return Err(ValidationError::new(
1152 1001,
1153 "id is shorter than the minimum length of 1".to_string(),
1154 ));
1155 }
1156 if val.chars().count() > 35 {
1157 return Err(ValidationError::new(
1158 1002,
1159 "id exceeds the maximum length of 35".to_string(),
1160 ));
1161 }
1162 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1163 if !pattern.is_match(val) {
1164 return Err(ValidationError::new(
1165 1005,
1166 "id does not match the required pattern".to_string(),
1167 ));
1168 }
1169 }
1170 if let Some(ref val) = self.lei {
1171 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1172 if !pattern.is_match(val) {
1173 return Err(ValidationError::new(
1174 1005,
1175 "lei does not match the required pattern".to_string(),
1176 ));
1177 }
1178 }
1179 if let Some(ref val) = self.nm {
1180 if val.chars().count() < 1 {
1181 return Err(ValidationError::new(
1182 1001,
1183 "nm is shorter than the minimum length of 1".to_string(),
1184 ));
1185 }
1186 if val.chars().count() > 140 {
1187 return Err(ValidationError::new(
1188 1002,
1189 "nm exceeds the maximum length of 140".to_string(),
1190 ));
1191 }
1192 let pattern = Regex::new(
1193 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1194 )
1195 .unwrap();
1196 if !pattern.is_match(val) {
1197 return Err(ValidationError::new(
1198 1005,
1199 "nm does not match the required pattern".to_string(),
1200 ));
1201 }
1202 }
1203 if let Some(ref val) = self.pstl_adr {
1204 val.validate()?
1205 }
1206 Ok(())
1207 }
1208}
1209
1210#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1212pub struct BranchData33 {
1213 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1214 pub id: Option<String>,
1215 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1216 pub lei: Option<String>,
1217 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1218 pub nm: Option<String>,
1219 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1220 pub pstl_adr: Option<PostalAddress241>,
1221}
1222
1223impl BranchData33 {
1224 pub fn validate(&self) -> Result<(), ValidationError> {
1225 if let Some(ref val) = self.id {
1226 if val.chars().count() < 1 {
1227 return Err(ValidationError::new(
1228 1001,
1229 "id is shorter than the minimum length of 1".to_string(),
1230 ));
1231 }
1232 if val.chars().count() > 35 {
1233 return Err(ValidationError::new(
1234 1002,
1235 "id exceeds the maximum length of 35".to_string(),
1236 ));
1237 }
1238 }
1239 if let Some(ref val) = self.lei {
1240 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1241 if !pattern.is_match(val) {
1242 return Err(ValidationError::new(
1243 1005,
1244 "lei does not match the required pattern".to_string(),
1245 ));
1246 }
1247 }
1248 if let Some(ref val) = self.nm {
1249 if val.chars().count() < 1 {
1250 return Err(ValidationError::new(
1251 1001,
1252 "nm is shorter than the minimum length of 1".to_string(),
1253 ));
1254 }
1255 if val.chars().count() > 140 {
1256 return Err(ValidationError::new(
1257 1002,
1258 "nm exceeds the maximum length of 140".to_string(),
1259 ));
1260 }
1261 let pattern = Regex::new(
1262 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1263 )
1264 .unwrap();
1265 if !pattern.is_match(val) {
1266 return Err(ValidationError::new(
1267 1005,
1268 "nm does not match the required pattern".to_string(),
1269 ));
1270 }
1271 }
1272 if let Some(ref val) = self.pstl_adr {
1273 val.validate()?
1274 }
1275 Ok(())
1276 }
1277}
1278
1279#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1281pub enum CSCManagement1Code {
1282 #[default]
1283 #[serde(rename = "PRST")]
1284 CodePRST,
1285 #[serde(rename = "BYPS")]
1286 CodeBYPS,
1287 #[serde(rename = "UNRD")]
1288 CodeUNRD,
1289 #[serde(rename = "NCSC")]
1290 CodeNCSC,
1291}
1292
1293impl CSCManagement1Code {
1294 pub fn validate(&self) -> Result<(), ValidationError> {
1295 Ok(())
1296 }
1297}
1298
1299#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1301pub struct CardAggregated21 {
1302 #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1303 pub addtl_svc: Option<CardPaymentServiceType2Code>,
1304 #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1305 pub tx_ctgy: Option<String>,
1306 #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1307 pub sale_rcncltn_id: Option<String>,
1308 #[serde(rename = "SeqNbRg", skip_serializing_if = "Option::is_none")]
1309 pub seq_nb_rg: Option<CardSequenceNumberRange11>,
1310 #[serde(rename = "TxDtRg", skip_serializing_if = "Option::is_none")]
1311 pub tx_dt_rg: Option<DateOrDateTimePeriod1Choice1>,
1312}
1313
1314impl CardAggregated21 {
1315 pub fn validate(&self) -> Result<(), ValidationError> {
1316 if let Some(ref val) = self.addtl_svc {
1317 val.validate()?
1318 }
1319 if let Some(ref val) = self.tx_ctgy {
1320 if val.chars().count() < 1 {
1321 return Err(ValidationError::new(
1322 1001,
1323 "tx_ctgy is shorter than the minimum length of 1".to_string(),
1324 ));
1325 }
1326 if val.chars().count() > 4 {
1327 return Err(ValidationError::new(
1328 1002,
1329 "tx_ctgy exceeds the maximum length of 4".to_string(),
1330 ));
1331 }
1332 }
1333 if let Some(ref val) = self.sale_rcncltn_id {
1334 if val.chars().count() < 1 {
1335 return Err(ValidationError::new(
1336 1001,
1337 "sale_rcncltn_id is shorter than the minimum length of 1".to_string(),
1338 ));
1339 }
1340 if val.chars().count() > 35 {
1341 return Err(ValidationError::new(
1342 1002,
1343 "sale_rcncltn_id exceeds the maximum length of 35".to_string(),
1344 ));
1345 }
1346 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1347 if !pattern.is_match(val) {
1348 return Err(ValidationError::new(
1349 1005,
1350 "sale_rcncltn_id does not match the required pattern".to_string(),
1351 ));
1352 }
1353 }
1354 if let Some(ref val) = self.seq_nb_rg {
1355 val.validate()?
1356 }
1357 if let Some(ref val) = self.tx_dt_rg {
1358 val.validate()?
1359 }
1360 Ok(())
1361 }
1362}
1363
1364#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1366pub enum CardDataReading1Code {
1367 #[default]
1368 #[serde(rename = "TAGC")]
1369 CodeTAGC,
1370 #[serde(rename = "PHYS")]
1371 CodePHYS,
1372 #[serde(rename = "BRCD")]
1373 CodeBRCD,
1374 #[serde(rename = "MGST")]
1375 CodeMGST,
1376 #[serde(rename = "CICC")]
1377 CodeCICC,
1378 #[serde(rename = "DFLE")]
1379 CodeDFLE,
1380 #[serde(rename = "CTLS")]
1381 CodeCTLS,
1382 #[serde(rename = "ECTL")]
1383 CodeECTL,
1384}
1385
1386impl CardDataReading1Code {
1387 pub fn validate(&self) -> Result<(), ValidationError> {
1388 Ok(())
1389 }
1390}
1391
1392#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1394pub struct CardEntry41 {
1395 #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1396 pub card: Option<PaymentCard41>,
1397 #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1398 pub poi: Option<PointOfInteraction11>,
1399 #[serde(rename = "AggtdNtry", skip_serializing_if = "Option::is_none")]
1400 pub aggtd_ntry: Option<CardAggregated21>,
1401 #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1402 pub pre_pd_acct: Option<CashAccount382>,
1403}
1404
1405impl CardEntry41 {
1406 pub fn validate(&self) -> Result<(), ValidationError> {
1407 if let Some(ref val) = self.card {
1408 val.validate()?
1409 }
1410 if let Some(ref val) = self.poi {
1411 val.validate()?
1412 }
1413 if let Some(ref val) = self.aggtd_ntry {
1414 val.validate()?
1415 }
1416 if let Some(ref val) = self.pre_pd_acct {
1417 val.validate()?
1418 }
1419 Ok(())
1420 }
1421}
1422
1423#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1426pub struct CardIndividualTransaction21 {
1427 #[serde(rename = "ICCRltdData", skip_serializing_if = "Option::is_none")]
1428 pub icc_rltd_data: Option<String>,
1429 #[serde(rename = "PmtCntxt", skip_serializing_if = "Option::is_none")]
1430 pub pmt_cntxt: Option<PaymentContext3>,
1431 #[serde(rename = "AddtlSvc", skip_serializing_if = "Option::is_none")]
1432 pub addtl_svc: Option<CardPaymentServiceType2Code>,
1433 #[serde(rename = "TxCtgy", skip_serializing_if = "Option::is_none")]
1434 pub tx_ctgy: Option<String>,
1435 #[serde(rename = "SaleRcncltnId", skip_serializing_if = "Option::is_none")]
1436 pub sale_rcncltn_id: Option<String>,
1437 #[serde(rename = "SaleRefNb", skip_serializing_if = "Option::is_none")]
1438 pub sale_ref_nb: Option<String>,
1439 #[serde(rename = "RePresntmntRsn", skip_serializing_if = "Option::is_none")]
1440 pub re_presntmnt_rsn: Option<String>,
1441 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
1442 pub seq_nb: Option<String>,
1443 #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
1444 pub tx_id: Option<TransactionIdentifier11>,
1445 #[serde(rename = "Pdct", skip_serializing_if = "Option::is_none")]
1446 pub pdct: Option<Product21>,
1447 #[serde(rename = "VldtnDt", skip_serializing_if = "Option::is_none")]
1448 pub vldtn_dt: Option<String>,
1449 #[serde(rename = "VldtnSeqNb", skip_serializing_if = "Option::is_none")]
1450 pub vldtn_seq_nb: Option<String>,
1451}
1452
1453impl CardIndividualTransaction21 {
1454 pub fn validate(&self) -> Result<(), ValidationError> {
1455 if let Some(ref val) = self.icc_rltd_data {
1456 if val.chars().count() < 1 {
1457 return Err(ValidationError::new(
1458 1001,
1459 "icc_rltd_data is shorter than the minimum length of 1".to_string(),
1460 ));
1461 }
1462 if val.chars().count() > 1025 {
1463 return Err(ValidationError::new(
1464 1002,
1465 "icc_rltd_data exceeds the maximum length of 1025".to_string(),
1466 ));
1467 }
1468 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1469 if !pattern.is_match(val) {
1470 return Err(ValidationError::new(
1471 1005,
1472 "icc_rltd_data does not match the required pattern".to_string(),
1473 ));
1474 }
1475 }
1476 if let Some(ref val) = self.pmt_cntxt {
1477 val.validate()?
1478 }
1479 if let Some(ref val) = self.addtl_svc {
1480 val.validate()?
1481 }
1482 if let Some(ref val) = self.tx_ctgy {
1483 if val.chars().count() < 1 {
1484 return Err(ValidationError::new(
1485 1001,
1486 "tx_ctgy is shorter than the minimum length of 1".to_string(),
1487 ));
1488 }
1489 if val.chars().count() > 4 {
1490 return Err(ValidationError::new(
1491 1002,
1492 "tx_ctgy exceeds the maximum length of 4".to_string(),
1493 ));
1494 }
1495 }
1496 if let Some(ref val) = self.sale_rcncltn_id {
1497 if val.chars().count() < 1 {
1498 return Err(ValidationError::new(
1499 1001,
1500 "sale_rcncltn_id is shorter than the minimum length of 1".to_string(),
1501 ));
1502 }
1503 if val.chars().count() > 35 {
1504 return Err(ValidationError::new(
1505 1002,
1506 "sale_rcncltn_id exceeds the maximum length of 35".to_string(),
1507 ));
1508 }
1509 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1510 if !pattern.is_match(val) {
1511 return Err(ValidationError::new(
1512 1005,
1513 "sale_rcncltn_id does not match the required pattern".to_string(),
1514 ));
1515 }
1516 }
1517 if let Some(ref val) = self.sale_ref_nb {
1518 if val.chars().count() < 1 {
1519 return Err(ValidationError::new(
1520 1001,
1521 "sale_ref_nb is shorter than the minimum length of 1".to_string(),
1522 ));
1523 }
1524 if val.chars().count() > 35 {
1525 return Err(ValidationError::new(
1526 1002,
1527 "sale_ref_nb exceeds the maximum length of 35".to_string(),
1528 ));
1529 }
1530 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1531 if !pattern.is_match(val) {
1532 return Err(ValidationError::new(
1533 1005,
1534 "sale_ref_nb does not match the required pattern".to_string(),
1535 ));
1536 }
1537 }
1538 if let Some(ref val) = self.re_presntmnt_rsn {
1539 if val.chars().count() < 1 {
1540 return Err(ValidationError::new(
1541 1001,
1542 "re_presntmnt_rsn is shorter than the minimum length of 1".to_string(),
1543 ));
1544 }
1545 if val.chars().count() > 4 {
1546 return Err(ValidationError::new(
1547 1002,
1548 "re_presntmnt_rsn exceeds the maximum length of 4".to_string(),
1549 ));
1550 }
1551 }
1552 if let Some(ref val) = self.seq_nb {
1553 if val.chars().count() < 1 {
1554 return Err(ValidationError::new(
1555 1001,
1556 "seq_nb is shorter than the minimum length of 1".to_string(),
1557 ));
1558 }
1559 if val.chars().count() > 35 {
1560 return Err(ValidationError::new(
1561 1002,
1562 "seq_nb exceeds the maximum length of 35".to_string(),
1563 ));
1564 }
1565 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1566 if !pattern.is_match(val) {
1567 return Err(ValidationError::new(
1568 1005,
1569 "seq_nb does not match the required pattern".to_string(),
1570 ));
1571 }
1572 }
1573 if let Some(ref val) = self.tx_id {
1574 val.validate()?
1575 }
1576 if let Some(ref val) = self.pdct {
1577 val.validate()?
1578 }
1579 if let Some(ref val) = self.vldtn_seq_nb {
1580 if val.chars().count() < 1 {
1581 return Err(ValidationError::new(
1582 1001,
1583 "vldtn_seq_nb is shorter than the minimum length of 1".to_string(),
1584 ));
1585 }
1586 if val.chars().count() > 35 {
1587 return Err(ValidationError::new(
1588 1002,
1589 "vldtn_seq_nb exceeds the maximum length of 35".to_string(),
1590 ));
1591 }
1592 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1593 if !pattern.is_match(val) {
1594 return Err(ValidationError::new(
1595 1005,
1596 "vldtn_seq_nb does not match the required pattern".to_string(),
1597 ));
1598 }
1599 }
1600 Ok(())
1601 }
1602}
1603
1604#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1606pub enum CardPaymentServiceType2Code {
1607 #[default]
1608 #[serde(rename = "AGGR")]
1609 CodeAGGR,
1610 #[serde(rename = "DCCV")]
1611 CodeDCCV,
1612 #[serde(rename = "GRTT")]
1613 CodeGRTT,
1614 #[serde(rename = "INSP")]
1615 CodeINSP,
1616 #[serde(rename = "LOYT")]
1617 CodeLOYT,
1618 #[serde(rename = "NRES")]
1619 CodeNRES,
1620 #[serde(rename = "PUCO")]
1621 CodePUCO,
1622 #[serde(rename = "RECP")]
1623 CodeRECP,
1624 #[serde(rename = "SOAF")]
1625 CodeSOAF,
1626 #[serde(rename = "UNAF")]
1627 CodeUNAF,
1628 #[serde(rename = "VCAU")]
1629 CodeVCAU,
1630}
1631
1632impl CardPaymentServiceType2Code {
1633 pub fn validate(&self) -> Result<(), ValidationError> {
1634 Ok(())
1635 }
1636}
1637
1638#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1640pub struct CardSecurityInformation1 {
1641 #[serde(rename = "CSCMgmt")]
1642 pub csc_mgmt: CSCManagement1Code,
1643 #[serde(rename = "CSCVal", skip_serializing_if = "Option::is_none")]
1644 pub csc_val: Option<String>,
1645}
1646
1647impl CardSecurityInformation1 {
1648 pub fn validate(&self) -> Result<(), ValidationError> {
1649 self.csc_mgmt.validate()?;
1650 if let Some(ref val) = self.csc_val {
1651 let pattern = Regex::new("[0-9]{3,4}").unwrap();
1652 if !pattern.is_match(val) {
1653 return Err(ValidationError::new(
1654 1005,
1655 "csc_val does not match the required pattern".to_string(),
1656 ));
1657 }
1658 }
1659 Ok(())
1660 }
1661}
1662
1663#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1665pub struct CardSequenceNumberRange11 {
1666 #[serde(rename = "FrstTx", skip_serializing_if = "Option::is_none")]
1667 pub frst_tx: Option<String>,
1668 #[serde(rename = "LastTx", skip_serializing_if = "Option::is_none")]
1669 pub last_tx: Option<String>,
1670}
1671
1672impl CardSequenceNumberRange11 {
1673 pub fn validate(&self) -> Result<(), ValidationError> {
1674 if let Some(ref val) = self.frst_tx {
1675 if val.chars().count() < 1 {
1676 return Err(ValidationError::new(
1677 1001,
1678 "frst_tx is shorter than the minimum length of 1".to_string(),
1679 ));
1680 }
1681 if val.chars().count() > 35 {
1682 return Err(ValidationError::new(
1683 1002,
1684 "frst_tx exceeds the maximum length of 35".to_string(),
1685 ));
1686 }
1687 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1688 if !pattern.is_match(val) {
1689 return Err(ValidationError::new(
1690 1005,
1691 "frst_tx does not match the required pattern".to_string(),
1692 ));
1693 }
1694 }
1695 if let Some(ref val) = self.last_tx {
1696 if val.chars().count() < 1 {
1697 return Err(ValidationError::new(
1698 1001,
1699 "last_tx is shorter than the minimum length of 1".to_string(),
1700 ));
1701 }
1702 if val.chars().count() > 35 {
1703 return Err(ValidationError::new(
1704 1002,
1705 "last_tx exceeds the maximum length of 35".to_string(),
1706 ));
1707 }
1708 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1709 if !pattern.is_match(val) {
1710 return Err(ValidationError::new(
1711 1005,
1712 "last_tx does not match the required pattern".to_string(),
1713 ));
1714 }
1715 }
1716 Ok(())
1717 }
1718}
1719
1720#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1722pub struct CardTransaction171 {
1723 #[serde(rename = "Card", skip_serializing_if = "Option::is_none")]
1724 pub card: Option<PaymentCard41>,
1725 #[serde(rename = "POI", skip_serializing_if = "Option::is_none")]
1726 pub poi: Option<PointOfInteraction11>,
1727 #[serde(rename = "Tx", skip_serializing_if = "Option::is_none")]
1728 pub tx: Option<CardTransaction3Choice1>,
1729 #[serde(rename = "PrePdAcct", skip_serializing_if = "Option::is_none")]
1730 pub pre_pd_acct: Option<CashAccount382>,
1731}
1732
1733impl CardTransaction171 {
1734 pub fn validate(&self) -> Result<(), ValidationError> {
1735 if let Some(ref val) = self.card {
1736 val.validate()?
1737 }
1738 if let Some(ref val) = self.poi {
1739 val.validate()?
1740 }
1741 if let Some(ref val) = self.tx {
1742 val.validate()?
1743 }
1744 if let Some(ref val) = self.pre_pd_acct {
1745 val.validate()?
1746 }
1747 Ok(())
1748 }
1749}
1750
1751#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1753pub struct CardTransaction3Choice1 {
1754 #[serde(rename = "Aggtd", skip_serializing_if = "Option::is_none")]
1755 pub aggtd: Option<CardAggregated21>,
1756 #[serde(rename = "Indv", skip_serializing_if = "Option::is_none")]
1757 pub indv: Option<CardIndividualTransaction21>,
1758}
1759
1760impl CardTransaction3Choice1 {
1761 pub fn validate(&self) -> Result<(), ValidationError> {
1762 if let Some(ref val) = self.aggtd {
1763 val.validate()?
1764 }
1765 if let Some(ref val) = self.indv {
1766 val.validate()?
1767 }
1768 Ok(())
1769 }
1770}
1771
1772#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1774pub struct CardholderAuthentication2 {
1775 #[serde(rename = "AuthntcnMtd")]
1776 pub authntcn_mtd: AuthenticationMethod1Code,
1777 #[serde(rename = "AuthntcnNtty")]
1778 pub authntcn_ntty: AuthenticationEntity1Code,
1779}
1780
1781impl CardholderAuthentication2 {
1782 pub fn validate(&self) -> Result<(), ValidationError> {
1783 self.authntcn_mtd.validate()?;
1784 self.authntcn_ntty.validate()?;
1785 Ok(())
1786 }
1787}
1788
1789#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1791pub enum CardholderVerificationCapability1Code {
1792 #[default]
1793 #[serde(rename = "MNSG")]
1794 CodeMNSG,
1795 #[serde(rename = "NPIN")]
1796 CodeNPIN,
1797 #[serde(rename = "FCPN")]
1798 CodeFCPN,
1799 #[serde(rename = "FEPN")]
1800 CodeFEPN,
1801 #[serde(rename = "FDSG")]
1802 CodeFDSG,
1803 #[serde(rename = "FBIO")]
1804 CodeFBIO,
1805 #[serde(rename = "MNVR")]
1806 CodeMNVR,
1807 #[serde(rename = "FBIG")]
1808 CodeFBIG,
1809 #[serde(rename = "APKI")]
1810 CodeAPKI,
1811 #[serde(rename = "PKIS")]
1812 CodePKIS,
1813 #[serde(rename = "CHDT")]
1814 CodeCHDT,
1815 #[serde(rename = "SCEC")]
1816 CodeSCEC,
1817}
1818
1819impl CardholderVerificationCapability1Code {
1820 pub fn validate(&self) -> Result<(), ValidationError> {
1821 Ok(())
1822 }
1823}
1824
1825#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1827pub struct CashAccount381 {
1828 #[serde(rename = "Id")]
1829 pub id: AccountIdentification4Choice1,
1830 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1831 pub tp: Option<CashAccountType2Choice1>,
1832 #[serde(rename = "Ccy")]
1833 pub ccy: String,
1834 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1835 pub nm: Option<String>,
1836 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1837 pub prxy: Option<ProxyAccountIdentification11>,
1838}
1839
1840impl CashAccount381 {
1841 pub fn validate(&self) -> Result<(), ValidationError> {
1842 self.id.validate()?;
1843 if let Some(ref val) = self.tp {
1844 val.validate()?
1845 }
1846 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
1847 if !pattern.is_match(&self.ccy) {
1848 return Err(ValidationError::new(
1849 1005,
1850 "ccy does not match the required pattern".to_string(),
1851 ));
1852 }
1853 if let Some(ref val) = self.nm {
1854 if val.chars().count() < 1 {
1855 return Err(ValidationError::new(
1856 1001,
1857 "nm is shorter than the minimum length of 1".to_string(),
1858 ));
1859 }
1860 if val.chars().count() > 70 {
1861 return Err(ValidationError::new(
1862 1002,
1863 "nm exceeds the maximum length of 70".to_string(),
1864 ));
1865 }
1866 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1867 if !pattern.is_match(val) {
1868 return Err(ValidationError::new(
1869 1005,
1870 "nm does not match the required pattern".to_string(),
1871 ));
1872 }
1873 }
1874 if let Some(ref val) = self.prxy {
1875 val.validate()?
1876 }
1877 Ok(())
1878 }
1879}
1880
1881#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1883pub struct CashAccount382 {
1884 #[serde(rename = "Id")]
1885 pub id: AccountIdentification4Choice1,
1886 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1887 pub tp: Option<CashAccountType2Choice1>,
1888 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
1889 pub ccy: Option<String>,
1890 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1891 pub nm: Option<String>,
1892 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1893 pub prxy: Option<ProxyAccountIdentification11>,
1894}
1895
1896impl CashAccount382 {
1897 pub fn validate(&self) -> Result<(), ValidationError> {
1898 self.id.validate()?;
1899 if let Some(ref val) = self.tp {
1900 val.validate()?
1901 }
1902 if let Some(ref val) = self.ccy {
1903 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
1904 if !pattern.is_match(val) {
1905 return Err(ValidationError::new(
1906 1005,
1907 "ccy does not match the required pattern".to_string(),
1908 ));
1909 }
1910 }
1911 if let Some(ref val) = self.nm {
1912 if val.chars().count() < 1 {
1913 return Err(ValidationError::new(
1914 1001,
1915 "nm is shorter than the minimum length of 1".to_string(),
1916 ));
1917 }
1918 if val.chars().count() > 70 {
1919 return Err(ValidationError::new(
1920 1002,
1921 "nm exceeds the maximum length of 70".to_string(),
1922 ));
1923 }
1924 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1925 if !pattern.is_match(val) {
1926 return Err(ValidationError::new(
1927 1005,
1928 "nm does not match the required pattern".to_string(),
1929 ));
1930 }
1931 }
1932 if let Some(ref val) = self.prxy {
1933 val.validate()?
1934 }
1935 Ok(())
1936 }
1937}
1938
1939#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1941pub struct CashAccount391 {
1942 #[serde(rename = "Id")]
1943 pub id: AccountIdentification4Choice1,
1944 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1945 pub tp: Option<CashAccountType2Choice1>,
1946 #[serde(rename = "Ccy")]
1947 pub ccy: String,
1948 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1949 pub nm: Option<String>,
1950 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
1951 pub prxy: Option<ProxyAccountIdentification11>,
1952 #[serde(rename = "Ownr", skip_serializing_if = "Option::is_none")]
1953 pub ownr: Option<PartyIdentification1352>,
1954 #[serde(rename = "Svcr", skip_serializing_if = "Option::is_none")]
1955 pub svcr: Option<BranchAndFinancialInstitutionIdentification61>,
1956}
1957
1958impl CashAccount391 {
1959 pub fn validate(&self) -> Result<(), ValidationError> {
1960 self.id.validate()?;
1961 if let Some(ref val) = self.tp {
1962 val.validate()?
1963 }
1964 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
1965 if !pattern.is_match(&self.ccy) {
1966 return Err(ValidationError::new(
1967 1005,
1968 "ccy does not match the required pattern".to_string(),
1969 ));
1970 }
1971 if let Some(ref val) = self.nm {
1972 if val.chars().count() < 1 {
1973 return Err(ValidationError::new(
1974 1001,
1975 "nm is shorter than the minimum length of 1".to_string(),
1976 ));
1977 }
1978 if val.chars().count() > 70 {
1979 return Err(ValidationError::new(
1980 1002,
1981 "nm exceeds the maximum length of 70".to_string(),
1982 ));
1983 }
1984 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1985 if !pattern.is_match(val) {
1986 return Err(ValidationError::new(
1987 1005,
1988 "nm does not match the required pattern".to_string(),
1989 ));
1990 }
1991 }
1992 if let Some(ref val) = self.prxy {
1993 val.validate()?
1994 }
1995 if let Some(ref val) = self.ownr {
1996 val.validate()?
1997 }
1998 if let Some(ref val) = self.svcr {
1999 val.validate()?
2000 }
2001 Ok(())
2002 }
2003}
2004
2005#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2007pub struct CashAccountType2Choice1 {
2008 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2009 pub cd: Option<String>,
2010 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2011 pub prtry: Option<String>,
2012}
2013
2014impl CashAccountType2Choice1 {
2015 pub fn validate(&self) -> Result<(), ValidationError> {
2016 if let Some(ref val) = self.cd {
2017 if val.chars().count() < 1 {
2018 return Err(ValidationError::new(
2019 1001,
2020 "cd is shorter than the minimum length of 1".to_string(),
2021 ));
2022 }
2023 if val.chars().count() > 4 {
2024 return Err(ValidationError::new(
2025 1002,
2026 "cd exceeds the maximum length of 4".to_string(),
2027 ));
2028 }
2029 }
2030 if let Some(ref val) = self.prtry {
2031 if val.chars().count() < 1 {
2032 return Err(ValidationError::new(
2033 1001,
2034 "prtry is shorter than the minimum length of 1".to_string(),
2035 ));
2036 }
2037 if val.chars().count() > 35 {
2038 return Err(ValidationError::new(
2039 1002,
2040 "prtry exceeds the maximum length of 35".to_string(),
2041 ));
2042 }
2043 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2044 if !pattern.is_match(val) {
2045 return Err(ValidationError::new(
2046 1005,
2047 "prtry does not match the required pattern".to_string(),
2048 ));
2049 }
2050 }
2051 Ok(())
2052 }
2053}
2054
2055#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2058pub struct CashAvailability1 {
2059 #[serde(rename = "Dt")]
2060 pub dt: CashAvailabilityDate1Choice,
2061 #[serde(rename = "Amt")]
2062 pub amt: ActiveOrHistoricCurrencyAndAmount,
2063 #[serde(rename = "CdtDbtInd")]
2064 pub cdt_dbt_ind: CreditDebitCode,
2065}
2066
2067impl CashAvailability1 {
2068 pub fn validate(&self) -> Result<(), ValidationError> {
2069 self.dt.validate()?;
2070 self.amt.validate()?;
2071 self.cdt_dbt_ind.validate()?;
2072 Ok(())
2073 }
2074}
2075
2076#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2078pub struct CashAvailabilityDate1Choice {
2079 #[serde(rename = "NbOfDays", skip_serializing_if = "Option::is_none")]
2080 pub nb_of_days: Option<String>,
2081 #[serde(rename = "ActlDt", skip_serializing_if = "Option::is_none")]
2082 pub actl_dt: Option<String>,
2083}
2084
2085impl CashAvailabilityDate1Choice {
2086 pub fn validate(&self) -> Result<(), ValidationError> {
2087 if let Some(ref val) = self.nb_of_days {
2088 let pattern = Regex::new("[\\+]{0,1}[0-9]{1,15}").unwrap();
2089 if !pattern.is_match(val) {
2090 return Err(ValidationError::new(
2091 1005,
2092 "nb_of_days does not match the required pattern".to_string(),
2093 ));
2094 }
2095 }
2096 Ok(())
2097 }
2098}
2099
2100#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2105pub struct CashBalance81 {
2106 #[serde(rename = "Tp")]
2107 pub tp: BalanceType131,
2108 #[serde(rename = "CdtLine", skip_serializing_if = "Option::is_none")]
2109 pub cdt_line: Option<Vec<CreditLine31>>,
2110 #[serde(rename = "Amt")]
2111 pub amt: ActiveOrHistoricCurrencyAndAmount,
2112 #[serde(rename = "CdtDbtInd")]
2113 pub cdt_dbt_ind: CreditDebitCode,
2114 #[serde(rename = "Dt")]
2115 pub dt: DateAndDateTime2Choice1,
2116 #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
2117 pub avlbty: Option<Vec<CashAvailability1>>,
2118}
2119
2120impl CashBalance81 {
2121 pub fn validate(&self) -> Result<(), ValidationError> {
2122 self.tp.validate()?;
2123 if let Some(ref vec) = self.cdt_line {
2124 for item in vec {
2125 item.validate()?
2126 }
2127 }
2128 self.amt.validate()?;
2129 self.cdt_dbt_ind.validate()?;
2130 self.dt.validate()?;
2131 if let Some(ref vec) = self.avlbty {
2132 for item in vec {
2133 item.validate()?
2134 }
2135 }
2136 Ok(())
2137 }
2138}
2139
2140#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2142pub struct CashDeposit11 {
2143 #[serde(rename = "NoteDnmtn")]
2144 pub note_dnmtn: ActiveOrHistoricCurrencyAndAmount,
2145 #[serde(rename = "NbOfNotes")]
2146 pub nb_of_notes: String,
2147 #[serde(rename = "Amt")]
2148 pub amt: ActiveOrHistoricCurrencyAndAmount,
2149}
2150
2151impl CashDeposit11 {
2152 pub fn validate(&self) -> Result<(), ValidationError> {
2153 self.note_dnmtn.validate()?;
2154 let pattern = Regex::new("[0-9]{1,15}").unwrap();
2155 if !pattern.is_match(&self.nb_of_notes) {
2156 return Err(ValidationError::new(
2157 1005,
2158 "nb_of_notes does not match the required pattern".to_string(),
2159 ));
2160 }
2161 self.amt.validate()?;
2162 Ok(())
2163 }
2164}
2165
2166#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2168pub enum ChargeBearerType1Code {
2169 #[default]
2170 #[serde(rename = "DEBT")]
2171 CodeDEBT,
2172 #[serde(rename = "CRED")]
2173 CodeCRED,
2174 #[serde(rename = "SHAR")]
2175 CodeSHAR,
2176 #[serde(rename = "SLEV")]
2177 CodeSLEV,
2178}
2179
2180impl ChargeBearerType1Code {
2181 pub fn validate(&self) -> Result<(), ValidationError> {
2182 Ok(())
2183 }
2184}
2185
2186#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2188pub struct ChargeType3Choice1 {
2189 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2190 pub cd: Option<String>,
2191 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2192 pub prtry: Option<GenericIdentification31>,
2193}
2194
2195impl ChargeType3Choice1 {
2196 pub fn validate(&self) -> Result<(), ValidationError> {
2197 if let Some(ref val) = self.cd {
2198 if val.chars().count() < 1 {
2199 return Err(ValidationError::new(
2200 1001,
2201 "cd is shorter than the minimum length of 1".to_string(),
2202 ));
2203 }
2204 if val.chars().count() > 4 {
2205 return Err(ValidationError::new(
2206 1002,
2207 "cd exceeds the maximum length of 4".to_string(),
2208 ));
2209 }
2210 }
2211 if let Some(ref val) = self.prtry {
2212 val.validate()?
2213 }
2214 Ok(())
2215 }
2216}
2217
2218#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2220pub struct Charges61 {
2221 #[serde(rename = "TtlChrgsAndTaxAmt", skip_serializing_if = "Option::is_none")]
2222 pub ttl_chrgs_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2223 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
2224 pub rcrd: Option<Vec<ChargesRecord31>>,
2225}
2226
2227impl Charges61 {
2228 pub fn validate(&self) -> Result<(), ValidationError> {
2229 if let Some(ref val) = self.ttl_chrgs_and_tax_amt {
2230 val.validate()?
2231 }
2232 if let Some(ref vec) = self.rcrd {
2233 for item in vec {
2234 item.validate()?
2235 }
2236 }
2237 Ok(())
2238 }
2239}
2240
2241#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2243pub struct ChargesRecord31 {
2244 #[serde(rename = "Amt")]
2245 pub amt: ActiveOrHistoricCurrencyAndAmount,
2246 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
2247 pub cdt_dbt_ind: Option<CreditDebitCode>,
2248 #[serde(rename = "ChrgInclInd", skip_serializing_if = "Option::is_none")]
2249 pub chrg_incl_ind: Option<bool>,
2250 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2251 pub tp: Option<ChargeType3Choice1>,
2252 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
2253 pub rate: Option<f64>,
2254 #[serde(rename = "Br", skip_serializing_if = "Option::is_none")]
2255 pub br: Option<ChargeBearerType1Code>,
2256 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
2257 pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
2258 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
2259 pub tax: Option<TaxCharges21>,
2260}
2261
2262impl ChargesRecord31 {
2263 pub fn validate(&self) -> Result<(), ValidationError> {
2264 self.amt.validate()?;
2265 if let Some(ref val) = self.cdt_dbt_ind {
2266 val.validate()?
2267 }
2268 if let Some(ref val) = self.tp {
2269 val.validate()?
2270 }
2271 if let Some(ref val) = self.br {
2272 val.validate()?
2273 }
2274 if let Some(ref val) = self.agt {
2275 val.validate()?
2276 }
2277 if let Some(ref val) = self.tax {
2278 val.validate()?
2279 }
2280 Ok(())
2281 }
2282}
2283
2284#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2286pub struct ClearingSystemIdentification2Choice1 {
2287 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2288 pub cd: Option<String>,
2289}
2290
2291impl ClearingSystemIdentification2Choice1 {
2292 pub fn validate(&self) -> Result<(), ValidationError> {
2293 if let Some(ref val) = self.cd {
2294 if val.chars().count() < 1 {
2295 return Err(ValidationError::new(
2296 1001,
2297 "cd is shorter than the minimum length of 1".to_string(),
2298 ));
2299 }
2300 if val.chars().count() > 5 {
2301 return Err(ValidationError::new(
2302 1002,
2303 "cd exceeds the maximum length of 5".to_string(),
2304 ));
2305 }
2306 }
2307 Ok(())
2308 }
2309}
2310
2311#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2313pub struct ClearingSystemMemberIdentification21 {
2314 #[serde(rename = "ClrSysId")]
2315 pub clr_sys_id: ClearingSystemIdentification2Choice1,
2316 #[serde(rename = "MmbId")]
2317 pub mmb_id: String,
2318}
2319
2320impl ClearingSystemMemberIdentification21 {
2321 pub fn validate(&self) -> Result<(), ValidationError> {
2322 self.clr_sys_id.validate()?;
2323 if self.mmb_id.chars().count() < 1 {
2324 return Err(ValidationError::new(
2325 1001,
2326 "mmb_id is shorter than the minimum length of 1".to_string(),
2327 ));
2328 }
2329 if self.mmb_id.chars().count() > 28 {
2330 return Err(ValidationError::new(
2331 1002,
2332 "mmb_id exceeds the maximum length of 28".to_string(),
2333 ));
2334 }
2335 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2336 if !pattern.is_match(&self.mmb_id) {
2337 return Err(ValidationError::new(
2338 1005,
2339 "mmb_id does not match the required pattern".to_string(),
2340 ));
2341 }
2342 Ok(())
2343 }
2344}
2345
2346#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2348pub struct ClearingSystemMemberIdentification22 {
2349 #[serde(rename = "ClrSysId")]
2350 pub clr_sys_id: ClearingSystemIdentification2Choice1,
2351 #[serde(rename = "MmbId")]
2352 pub mmb_id: String,
2353}
2354
2355impl ClearingSystemMemberIdentification22 {
2356 pub fn validate(&self) -> Result<(), ValidationError> {
2357 self.clr_sys_id.validate()?;
2358 if self.mmb_id.chars().count() < 1 {
2359 return Err(ValidationError::new(
2360 1001,
2361 "mmb_id is shorter than the minimum length of 1".to_string(),
2362 ));
2363 }
2364 if self.mmb_id.chars().count() > 35 {
2365 return Err(ValidationError::new(
2366 1002,
2367 "mmb_id exceeds the maximum length of 35".to_string(),
2368 ));
2369 }
2370 Ok(())
2371 }
2372}
2373
2374#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2376pub struct Contact41 {
2377 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2378 pub nm: Option<String>,
2379}
2380
2381impl Contact41 {
2382 pub fn validate(&self) -> Result<(), ValidationError> {
2383 if let Some(ref val) = self.nm {
2384 if val.chars().count() < 1 {
2385 return Err(ValidationError::new(
2386 1001,
2387 "nm is shorter than the minimum length of 1".to_string(),
2388 ));
2389 }
2390 if val.chars().count() > 140 {
2391 return Err(ValidationError::new(
2392 1002,
2393 "nm exceeds the maximum length of 140".to_string(),
2394 ));
2395 }
2396 }
2397 Ok(())
2398 }
2399}
2400
2401#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2403pub struct Contact42 {
2404 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2405 pub nm: Option<String>,
2406}
2407
2408impl Contact42 {
2409 pub fn validate(&self) -> Result<(), ValidationError> {
2410 if let Some(ref val) = self.nm {
2411 if val.chars().count() < 1 {
2412 return Err(ValidationError::new(
2413 1001,
2414 "nm is shorter than the minimum length of 1".to_string(),
2415 ));
2416 }
2417 if val.chars().count() > 140 {
2418 return Err(ValidationError::new(
2419 1002,
2420 "nm exceeds the maximum length of 140".to_string(),
2421 ));
2422 }
2423 let pattern = Regex::new(
2424 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2425 )
2426 .unwrap();
2427 if !pattern.is_match(val) {
2428 return Err(ValidationError::new(
2429 1005,
2430 "nm does not match the required pattern".to_string(),
2431 ));
2432 }
2433 }
2434 Ok(())
2435 }
2436}
2437
2438#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2440pub struct Contact43 {
2441 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2442 pub nm: Option<String>,
2443 #[serde(rename = "PrefrdMtd", skip_serializing_if = "Option::is_none")]
2444 pub prefrd_mtd: Option<PreferredContactMethod1Code>,
2445}
2446
2447impl Contact43 {
2448 pub fn validate(&self) -> Result<(), ValidationError> {
2449 if let Some(ref val) = self.nm {
2450 if val.chars().count() < 1 {
2451 return Err(ValidationError::new(
2452 1001,
2453 "nm is shorter than the minimum length of 1".to_string(),
2454 ));
2455 }
2456 if val.chars().count() > 140 {
2457 return Err(ValidationError::new(
2458 1002,
2459 "nm exceeds the maximum length of 140".to_string(),
2460 ));
2461 }
2462 let pattern = Regex::new(
2463 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2464 )
2465 .unwrap();
2466 if !pattern.is_match(val) {
2467 return Err(ValidationError::new(
2468 1005,
2469 "nm does not match the required pattern".to_string(),
2470 ));
2471 }
2472 }
2473 if let Some(ref val) = self.prefrd_mtd {
2474 val.validate()?
2475 }
2476 Ok(())
2477 }
2478}
2479
2480#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2482pub enum CopyDuplicate1Code {
2483 #[default]
2484 #[serde(rename = "CODU")]
2485 CodeCODU,
2486 #[serde(rename = "COPY")]
2487 CodeCOPY,
2488 #[serde(rename = "DUPL")]
2489 CodeDUPL,
2490}
2491
2492impl CopyDuplicate1Code {
2493 pub fn validate(&self) -> Result<(), ValidationError> {
2494 Ok(())
2495 }
2496}
2497
2498#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2500pub struct CorporateAction91 {
2501 #[serde(rename = "EvtTp")]
2502 pub evt_tp: String,
2503 #[serde(rename = "EvtId")]
2504 pub evt_id: String,
2505}
2506
2507impl CorporateAction91 {
2508 pub fn validate(&self) -> Result<(), ValidationError> {
2509 if self.evt_tp.chars().count() < 1 {
2510 return Err(ValidationError::new(
2511 1001,
2512 "evt_tp is shorter than the minimum length of 1".to_string(),
2513 ));
2514 }
2515 if self.evt_tp.chars().count() > 35 {
2516 return Err(ValidationError::new(
2517 1002,
2518 "evt_tp exceeds the maximum length of 35".to_string(),
2519 ));
2520 }
2521 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2522 if !pattern.is_match(&self.evt_tp) {
2523 return Err(ValidationError::new(
2524 1005,
2525 "evt_tp does not match the required pattern".to_string(),
2526 ));
2527 }
2528 if self.evt_id.chars().count() < 1 {
2529 return Err(ValidationError::new(
2530 1001,
2531 "evt_id is shorter than the minimum length of 1".to_string(),
2532 ));
2533 }
2534 if self.evt_id.chars().count() > 35 {
2535 return Err(ValidationError::new(
2536 1002,
2537 "evt_id exceeds the maximum length of 35".to_string(),
2538 ));
2539 }
2540 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2541 if !pattern.is_match(&self.evt_id) {
2542 return Err(ValidationError::new(
2543 1005,
2544 "evt_id does not match the required pattern".to_string(),
2545 ));
2546 }
2547 Ok(())
2548 }
2549}
2550
2551#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2553pub enum CreditDebitCode {
2554 #[default]
2555 #[serde(rename = "CRDT")]
2556 CodeCRDT,
2557 #[serde(rename = "DBIT")]
2558 CodeDBIT,
2559}
2560
2561impl CreditDebitCode {
2562 pub fn validate(&self) -> Result<(), ValidationError> {
2563 Ok(())
2564 }
2565}
2566
2567#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2569pub struct CreditLine31 {
2570 #[serde(rename = "Incl")]
2571 pub incl: bool,
2572 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2573 pub tp: Option<CreditLineType1Choice1>,
2574 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
2575 pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2576 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2577 pub dt: Option<DateAndDateTime2Choice1>,
2578}
2579
2580impl CreditLine31 {
2581 pub fn validate(&self) -> Result<(), ValidationError> {
2582 if let Some(ref val) = self.tp {
2583 val.validate()?
2584 }
2585 if let Some(ref val) = self.amt {
2586 val.validate()?
2587 }
2588 if let Some(ref val) = self.dt {
2589 val.validate()?
2590 }
2591 Ok(())
2592 }
2593}
2594
2595#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2597pub struct CreditLineType1Choice1 {
2598 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2599 pub cd: Option<String>,
2600 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2601 pub prtry: Option<String>,
2602}
2603
2604impl CreditLineType1Choice1 {
2605 pub fn validate(&self) -> Result<(), ValidationError> {
2606 if let Some(ref val) = self.cd {
2607 if val.chars().count() < 1 {
2608 return Err(ValidationError::new(
2609 1001,
2610 "cd is shorter than the minimum length of 1".to_string(),
2611 ));
2612 }
2613 if val.chars().count() > 4 {
2614 return Err(ValidationError::new(
2615 1002,
2616 "cd exceeds the maximum length of 4".to_string(),
2617 ));
2618 }
2619 }
2620 if let Some(ref val) = self.prtry {
2621 if val.chars().count() < 1 {
2622 return Err(ValidationError::new(
2623 1001,
2624 "prtry is shorter than the minimum length of 1".to_string(),
2625 ));
2626 }
2627 if val.chars().count() > 35 {
2628 return Err(ValidationError::new(
2629 1002,
2630 "prtry exceeds the maximum length of 35".to_string(),
2631 ));
2632 }
2633 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2634 if !pattern.is_match(val) {
2635 return Err(ValidationError::new(
2636 1005,
2637 "prtry does not match the required pattern".to_string(),
2638 ));
2639 }
2640 }
2641 Ok(())
2642 }
2643}
2644
2645#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2651pub struct CreditorReferenceInformation21 {
2652 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2653 pub tp: Option<CreditorReferenceType21>,
2654 #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
2655 pub ref_attr: Option<String>,
2656}
2657
2658impl CreditorReferenceInformation21 {
2659 pub fn validate(&self) -> Result<(), ValidationError> {
2660 if let Some(ref val) = self.tp {
2661 val.validate()?
2662 }
2663 if let Some(ref val) = self.ref_attr {
2664 if val.chars().count() < 1 {
2665 return Err(ValidationError::new(
2666 1001,
2667 "ref_attr is shorter than the minimum length of 1".to_string(),
2668 ));
2669 }
2670 if val.chars().count() > 35 {
2671 return Err(ValidationError::new(
2672 1002,
2673 "ref_attr exceeds the maximum length of 35".to_string(),
2674 ));
2675 }
2676 let pattern = Regex::new(
2677 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2678 )
2679 .unwrap();
2680 if !pattern.is_match(val) {
2681 return Err(ValidationError::new(
2682 1005,
2683 "ref_attr does not match the required pattern".to_string(),
2684 ));
2685 }
2686 }
2687 Ok(())
2688 }
2689}
2690
2691#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2693pub struct CreditorReferenceType1Choice1 {
2694 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2695 pub cd: Option<DocumentType3Code>,
2696 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2697 pub prtry: Option<String>,
2698}
2699
2700impl CreditorReferenceType1Choice1 {
2701 pub fn validate(&self) -> Result<(), ValidationError> {
2702 if let Some(ref val) = self.cd {
2703 val.validate()?
2704 }
2705 if let Some(ref val) = self.prtry {
2706 if val.chars().count() < 1 {
2707 return Err(ValidationError::new(
2708 1001,
2709 "prtry is shorter than the minimum length of 1".to_string(),
2710 ));
2711 }
2712 if val.chars().count() > 35 {
2713 return Err(ValidationError::new(
2714 1002,
2715 "prtry exceeds the maximum length of 35".to_string(),
2716 ));
2717 }
2718 let pattern = Regex::new(
2719 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2720 )
2721 .unwrap();
2722 if !pattern.is_match(val) {
2723 return Err(ValidationError::new(
2724 1005,
2725 "prtry does not match the required pattern".to_string(),
2726 ));
2727 }
2728 }
2729 Ok(())
2730 }
2731}
2732
2733#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2735pub struct CreditorReferenceType21 {
2736 #[serde(rename = "CdOrPrtry")]
2737 pub cd_or_prtry: CreditorReferenceType1Choice1,
2738 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2739 pub issr: Option<String>,
2740}
2741
2742impl CreditorReferenceType21 {
2743 pub fn validate(&self) -> Result<(), ValidationError> {
2744 self.cd_or_prtry.validate()?;
2745 if let Some(ref val) = self.issr {
2746 if val.chars().count() < 1 {
2747 return Err(ValidationError::new(
2748 1001,
2749 "issr is shorter than the minimum length of 1".to_string(),
2750 ));
2751 }
2752 if val.chars().count() > 35 {
2753 return Err(ValidationError::new(
2754 1002,
2755 "issr exceeds the maximum length of 35".to_string(),
2756 ));
2757 }
2758 let pattern = Regex::new(
2759 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2760 )
2761 .unwrap();
2762 if !pattern.is_match(val) {
2763 return Err(ValidationError::new(
2764 1005,
2765 "issr does not match the required pattern".to_string(),
2766 ));
2767 }
2768 }
2769 Ok(())
2770 }
2771}
2772
2773#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2775pub struct CurrencyExchange51 {
2776 #[serde(rename = "SrcCcy")]
2777 pub src_ccy: String,
2778 #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2779 pub trgt_ccy: Option<String>,
2780 #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2781 pub unit_ccy: Option<String>,
2782 #[serde(rename = "XchgRate")]
2783 pub xchg_rate: f64,
2784 #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2785 pub ctrct_id: Option<String>,
2786 #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2787 pub qtn_dt: Option<String>,
2788}
2789
2790impl CurrencyExchange51 {
2791 pub fn validate(&self) -> Result<(), ValidationError> {
2792 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2793 if !pattern.is_match(&self.src_ccy) {
2794 return Err(ValidationError::new(
2795 1005,
2796 "src_ccy does not match the required pattern".to_string(),
2797 ));
2798 }
2799 if let Some(ref val) = self.trgt_ccy {
2800 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2801 if !pattern.is_match(val) {
2802 return Err(ValidationError::new(
2803 1005,
2804 "trgt_ccy does not match the required pattern".to_string(),
2805 ));
2806 }
2807 }
2808 if let Some(ref val) = self.unit_ccy {
2809 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2810 if !pattern.is_match(val) {
2811 return Err(ValidationError::new(
2812 1005,
2813 "unit_ccy does not match the required pattern".to_string(),
2814 ));
2815 }
2816 }
2817 if let Some(ref val) = self.ctrct_id {
2818 if val.chars().count() < 1 {
2819 return Err(ValidationError::new(
2820 1001,
2821 "ctrct_id is shorter than the minimum length of 1".to_string(),
2822 ));
2823 }
2824 if val.chars().count() > 35 {
2825 return Err(ValidationError::new(
2826 1002,
2827 "ctrct_id exceeds the maximum length of 35".to_string(),
2828 ));
2829 }
2830 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2831 if !pattern.is_match(val) {
2832 return Err(ValidationError::new(
2833 1005,
2834 "ctrct_id does not match the required pattern".to_string(),
2835 ));
2836 }
2837 }
2838 if let Some(ref val) = self.qtn_dt {
2839 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
2840 if !pattern.is_match(val) {
2841 return Err(ValidationError::new(
2842 1005,
2843 "qtn_dt does not match the required pattern".to_string(),
2844 ));
2845 }
2846 }
2847 Ok(())
2848 }
2849}
2850
2851#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2853pub struct CurrencyExchange52 {
2854 #[serde(rename = "SrcCcy")]
2855 pub src_ccy: String,
2856 #[serde(rename = "TrgtCcy", skip_serializing_if = "Option::is_none")]
2857 pub trgt_ccy: Option<String>,
2858 #[serde(rename = "UnitCcy", skip_serializing_if = "Option::is_none")]
2859 pub unit_ccy: Option<String>,
2860 #[serde(rename = "XchgRate")]
2861 pub xchg_rate: f64,
2862 #[serde(rename = "CtrctId", skip_serializing_if = "Option::is_none")]
2863 pub ctrct_id: Option<String>,
2864 #[serde(rename = "QtnDt", skip_serializing_if = "Option::is_none")]
2865 pub qtn_dt: Option<String>,
2866}
2867
2868impl CurrencyExchange52 {
2869 pub fn validate(&self) -> Result<(), ValidationError> {
2870 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2871 if !pattern.is_match(&self.src_ccy) {
2872 return Err(ValidationError::new(
2873 1005,
2874 "src_ccy does not match the required pattern".to_string(),
2875 ));
2876 }
2877 if let Some(ref val) = self.trgt_ccy {
2878 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2879 if !pattern.is_match(val) {
2880 return Err(ValidationError::new(
2881 1005,
2882 "trgt_ccy does not match the required pattern".to_string(),
2883 ));
2884 }
2885 }
2886 if let Some(ref val) = self.unit_ccy {
2887 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
2888 if !pattern.is_match(val) {
2889 return Err(ValidationError::new(
2890 1005,
2891 "unit_ccy does not match the required pattern".to_string(),
2892 ));
2893 }
2894 }
2895 if let Some(ref val) = self.ctrct_id {
2896 if val.chars().count() < 1 {
2897 return Err(ValidationError::new(
2898 1001,
2899 "ctrct_id is shorter than the minimum length of 1".to_string(),
2900 ));
2901 }
2902 if val.chars().count() > 35 {
2903 return Err(ValidationError::new(
2904 1002,
2905 "ctrct_id exceeds the maximum length of 35".to_string(),
2906 ));
2907 }
2908 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2909 if !pattern.is_match(val) {
2910 return Err(ValidationError::new(
2911 1005,
2912 "ctrct_id does not match the required pattern".to_string(),
2913 ));
2914 }
2915 }
2916 Ok(())
2917 }
2918}
2919
2920#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2922pub struct DateAndDateTime2Choice1 {
2923 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2924 pub dt: Option<String>,
2925 #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
2926 pub dt_tm: Option<String>,
2927}
2928
2929impl DateAndDateTime2Choice1 {
2930 pub fn validate(&self) -> Result<(), ValidationError> {
2931 if let Some(ref val) = self.dt_tm {
2932 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
2933 if !pattern.is_match(val) {
2934 return Err(ValidationError::new(
2935 1005,
2936 "dt_tm does not match the required pattern".to_string(),
2937 ));
2938 }
2939 }
2940 Ok(())
2941 }
2942}
2943
2944#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2946pub struct DateAndPlaceOfBirth1 {
2947 #[serde(rename = "BirthDt")]
2948 pub birth_dt: String,
2949 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
2950 pub prvc_of_birth: Option<String>,
2951 #[serde(rename = "CityOfBirth")]
2952 pub city_of_birth: String,
2953 #[serde(rename = "CtryOfBirth")]
2954 pub ctry_of_birth: String,
2955}
2956
2957impl DateAndPlaceOfBirth1 {
2958 pub fn validate(&self) -> Result<(), ValidationError> {
2959 if let Some(ref val) = self.prvc_of_birth {
2960 if val.chars().count() < 1 {
2961 return Err(ValidationError::new(
2962 1001,
2963 "prvc_of_birth is shorter than the minimum length of 1".to_string(),
2964 ));
2965 }
2966 if val.chars().count() > 35 {
2967 return Err(ValidationError::new(
2968 1002,
2969 "prvc_of_birth exceeds the maximum length of 35".to_string(),
2970 ));
2971 }
2972 }
2973 if self.city_of_birth.chars().count() < 1 {
2974 return Err(ValidationError::new(
2975 1001,
2976 "city_of_birth is shorter than the minimum length of 1".to_string(),
2977 ));
2978 }
2979 if self.city_of_birth.chars().count() > 35 {
2980 return Err(ValidationError::new(
2981 1002,
2982 "city_of_birth exceeds the maximum length of 35".to_string(),
2983 ));
2984 }
2985 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
2986 if !pattern.is_match(&self.ctry_of_birth) {
2987 return Err(ValidationError::new(
2988 1005,
2989 "ctry_of_birth does not match the required pattern".to_string(),
2990 ));
2991 }
2992 Ok(())
2993 }
2994}
2995
2996#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2998pub struct DateAndPlaceOfBirth11 {
2999 #[serde(rename = "BirthDt")]
3000 pub birth_dt: String,
3001 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
3002 pub prvc_of_birth: Option<String>,
3003 #[serde(rename = "CityOfBirth")]
3004 pub city_of_birth: String,
3005 #[serde(rename = "CtryOfBirth")]
3006 pub ctry_of_birth: String,
3007}
3008
3009impl DateAndPlaceOfBirth11 {
3010 pub fn validate(&self) -> Result<(), ValidationError> {
3011 if let Some(ref val) = self.prvc_of_birth {
3012 if val.chars().count() < 1 {
3013 return Err(ValidationError::new(
3014 1001,
3015 "prvc_of_birth is shorter than the minimum length of 1".to_string(),
3016 ));
3017 }
3018 if val.chars().count() > 35 {
3019 return Err(ValidationError::new(
3020 1002,
3021 "prvc_of_birth exceeds the maximum length of 35".to_string(),
3022 ));
3023 }
3024 let pattern = Regex::new(
3025 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3026 )
3027 .unwrap();
3028 if !pattern.is_match(val) {
3029 return Err(ValidationError::new(
3030 1005,
3031 "prvc_of_birth does not match the required pattern".to_string(),
3032 ));
3033 }
3034 }
3035 if self.city_of_birth.chars().count() < 1 {
3036 return Err(ValidationError::new(
3037 1001,
3038 "city_of_birth is shorter than the minimum length of 1".to_string(),
3039 ));
3040 }
3041 if self.city_of_birth.chars().count() > 35 {
3042 return Err(ValidationError::new(
3043 1002,
3044 "city_of_birth exceeds the maximum length of 35".to_string(),
3045 ));
3046 }
3047 let pattern =
3048 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
3049 .unwrap();
3050 if !pattern.is_match(&self.city_of_birth) {
3051 return Err(ValidationError::new(
3052 1005,
3053 "city_of_birth does not match the required pattern".to_string(),
3054 ));
3055 }
3056 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
3057 if !pattern.is_match(&self.ctry_of_birth) {
3058 return Err(ValidationError::new(
3059 1005,
3060 "ctry_of_birth does not match the required pattern".to_string(),
3061 ));
3062 }
3063 Ok(())
3064 }
3065}
3066
3067#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3069pub struct DateOrDateTimePeriod1Choice1 {
3070 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
3071 pub dt: Option<DatePeriod2>,
3072 #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
3073 pub dt_tm: Option<DateTimePeriod11>,
3074}
3075
3076impl DateOrDateTimePeriod1Choice1 {
3077 pub fn validate(&self) -> Result<(), ValidationError> {
3078 if let Some(ref val) = self.dt {
3079 val.validate()?
3080 }
3081 if let Some(ref val) = self.dt_tm {
3082 val.validate()?
3083 }
3084 Ok(())
3085 }
3086}
3087
3088#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3090pub struct DatePeriod2 {
3091 #[serde(rename = "FrDt")]
3092 pub fr_dt: String,
3093 #[serde(rename = "ToDt")]
3094 pub to_dt: String,
3095}
3096
3097impl DatePeriod2 {
3098 pub fn validate(&self) -> Result<(), ValidationError> {
3099 Ok(())
3100 }
3101}
3102
3103#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3105pub struct DateTimePeriod11 {
3106 #[serde(rename = "FrDtTm")]
3107 pub fr_dt_tm: String,
3108 #[serde(rename = "ToDtTm")]
3109 pub to_dt_tm: String,
3110}
3111
3112impl DateTimePeriod11 {
3113 pub fn validate(&self) -> Result<(), ValidationError> {
3114 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
3115 if !pattern.is_match(&self.fr_dt_tm) {
3116 return Err(ValidationError::new(
3117 1005,
3118 "fr_dt_tm does not match the required pattern".to_string(),
3119 ));
3120 }
3121 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
3122 if !pattern.is_match(&self.to_dt_tm) {
3123 return Err(ValidationError::new(
3124 1005,
3125 "to_dt_tm does not match the required pattern".to_string(),
3126 ));
3127 }
3128 Ok(())
3129 }
3130}
3131
3132#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3134pub struct DiscountAmountAndType1 {
3135 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3136 pub tp: Option<DiscountAmountType1Choice>,
3137 #[serde(rename = "Amt")]
3138 pub amt: ActiveOrHistoricCurrencyAndAmount,
3139}
3140
3141impl DiscountAmountAndType1 {
3142 pub fn validate(&self) -> Result<(), ValidationError> {
3143 if let Some(ref val) = self.tp {
3144 val.validate()?
3145 }
3146 self.amt.validate()?;
3147 Ok(())
3148 }
3149}
3150
3151#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3153pub struct DiscountAmountAndType11 {
3154 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3155 pub tp: Option<DiscountAmountType1Choice1>,
3156 #[serde(rename = "Amt")]
3157 pub amt: ActiveOrHistoricCurrencyAndAmount,
3158}
3159
3160impl DiscountAmountAndType11 {
3161 pub fn validate(&self) -> Result<(), ValidationError> {
3162 if let Some(ref val) = self.tp {
3163 val.validate()?
3164 }
3165 self.amt.validate()?;
3166 Ok(())
3167 }
3168}
3169
3170#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3172pub struct DiscountAmountType1Choice {
3173 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3174 pub cd: Option<String>,
3175 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3176 pub prtry: Option<String>,
3177}
3178
3179impl DiscountAmountType1Choice {
3180 pub fn validate(&self) -> Result<(), ValidationError> {
3181 if let Some(ref val) = self.cd {
3182 if val.chars().count() < 1 {
3183 return Err(ValidationError::new(
3184 1001,
3185 "cd is shorter than the minimum length of 1".to_string(),
3186 ));
3187 }
3188 if val.chars().count() > 4 {
3189 return Err(ValidationError::new(
3190 1002,
3191 "cd exceeds the maximum length of 4".to_string(),
3192 ));
3193 }
3194 }
3195 if let Some(ref val) = self.prtry {
3196 if val.chars().count() < 1 {
3197 return Err(ValidationError::new(
3198 1001,
3199 "prtry is shorter than the minimum length of 1".to_string(),
3200 ));
3201 }
3202 if val.chars().count() > 35 {
3203 return Err(ValidationError::new(
3204 1002,
3205 "prtry exceeds the maximum length of 35".to_string(),
3206 ));
3207 }
3208 }
3209 Ok(())
3210 }
3211}
3212
3213#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3215pub struct DiscountAmountType1Choice1 {
3216 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3217 pub cd: Option<String>,
3218 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3219 pub prtry: Option<String>,
3220}
3221
3222impl DiscountAmountType1Choice1 {
3223 pub fn validate(&self) -> Result<(), ValidationError> {
3224 if let Some(ref val) = self.cd {
3225 if val.chars().count() < 1 {
3226 return Err(ValidationError::new(
3227 1001,
3228 "cd is shorter than the minimum length of 1".to_string(),
3229 ));
3230 }
3231 if val.chars().count() > 4 {
3232 return Err(ValidationError::new(
3233 1002,
3234 "cd exceeds the maximum length of 4".to_string(),
3235 ));
3236 }
3237 }
3238 if let Some(ref val) = self.prtry {
3239 if val.chars().count() < 1 {
3240 return Err(ValidationError::new(
3241 1001,
3242 "prtry is shorter than the minimum length of 1".to_string(),
3243 ));
3244 }
3245 if val.chars().count() > 35 {
3246 return Err(ValidationError::new(
3247 1002,
3248 "prtry exceeds the maximum length of 35".to_string(),
3249 ));
3250 }
3251 let pattern = Regex::new(
3252 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3253 )
3254 .unwrap();
3255 if !pattern.is_match(val) {
3256 return Err(ValidationError::new(
3257 1005,
3258 "prtry does not match the required pattern".to_string(),
3259 ));
3260 }
3261 }
3262 Ok(())
3263 }
3264}
3265
3266#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3268pub struct DisplayCapabilities1 {
3269 #[serde(rename = "DispTp")]
3270 pub disp_tp: UserInterface2Code,
3271 #[serde(rename = "NbOfLines")]
3272 pub nb_of_lines: String,
3273 #[serde(rename = "LineWidth")]
3274 pub line_width: String,
3275}
3276
3277impl DisplayCapabilities1 {
3278 pub fn validate(&self) -> Result<(), ValidationError> {
3279 self.disp_tp.validate()?;
3280 let pattern = Regex::new("[0-9]{1,3}").unwrap();
3281 if !pattern.is_match(&self.nb_of_lines) {
3282 return Err(ValidationError::new(
3283 1005,
3284 "nb_of_lines does not match the required pattern".to_string(),
3285 ));
3286 }
3287 let pattern = Regex::new("[0-9]{1,3}").unwrap();
3288 if !pattern.is_match(&self.line_width) {
3289 return Err(ValidationError::new(
3290 1005,
3291 "line_width does not match the required pattern".to_string(),
3292 ));
3293 }
3294 Ok(())
3295 }
3296}
3297
3298#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3300pub struct DocumentAdjustment11 {
3301 #[serde(rename = "Amt")]
3302 pub amt: ActiveOrHistoricCurrencyAndAmount,
3303 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
3304 pub cdt_dbt_ind: Option<CreditDebitCode>,
3305 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
3306 pub rsn: Option<String>,
3307 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
3308 pub addtl_inf: Option<String>,
3309}
3310
3311impl DocumentAdjustment11 {
3312 pub fn validate(&self) -> Result<(), ValidationError> {
3313 self.amt.validate()?;
3314 if let Some(ref val) = self.cdt_dbt_ind {
3315 val.validate()?
3316 }
3317 if let Some(ref val) = self.rsn {
3318 if val.chars().count() < 1 {
3319 return Err(ValidationError::new(
3320 1001,
3321 "rsn is shorter than the minimum length of 1".to_string(),
3322 ));
3323 }
3324 if val.chars().count() > 4 {
3325 return Err(ValidationError::new(
3326 1002,
3327 "rsn exceeds the maximum length of 4".to_string(),
3328 ));
3329 }
3330 let pattern = Regex::new(
3331 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3332 )
3333 .unwrap();
3334 if !pattern.is_match(val) {
3335 return Err(ValidationError::new(
3336 1005,
3337 "rsn does not match the required pattern".to_string(),
3338 ));
3339 }
3340 }
3341 if let Some(ref val) = self.addtl_inf {
3342 if val.chars().count() < 1 {
3343 return Err(ValidationError::new(
3344 1001,
3345 "addtl_inf is shorter than the minimum length of 1".to_string(),
3346 ));
3347 }
3348 if val.chars().count() > 140 {
3349 return Err(ValidationError::new(
3350 1002,
3351 "addtl_inf exceeds the maximum length of 140".to_string(),
3352 ));
3353 }
3354 let pattern = Regex::new(
3355 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3356 )
3357 .unwrap();
3358 if !pattern.is_match(val) {
3359 return Err(ValidationError::new(
3360 1005,
3361 "addtl_inf does not match the required pattern".to_string(),
3362 ));
3363 }
3364 }
3365 Ok(())
3366 }
3367}
3368
3369#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3371pub struct DocumentLineIdentification11 {
3372 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
3373 pub tp: Option<DocumentLineType11>,
3374 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
3375 pub nb: Option<String>,
3376 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
3377 pub rltd_dt: Option<String>,
3378}
3379
3380impl DocumentLineIdentification11 {
3381 pub fn validate(&self) -> Result<(), ValidationError> {
3382 if let Some(ref val) = self.tp {
3383 val.validate()?
3384 }
3385 if let Some(ref val) = self.nb {
3386 if val.chars().count() < 1 {
3387 return Err(ValidationError::new(
3388 1001,
3389 "nb is shorter than the minimum length of 1".to_string(),
3390 ));
3391 }
3392 if val.chars().count() > 35 {
3393 return Err(ValidationError::new(
3394 1002,
3395 "nb exceeds the maximum length of 35".to_string(),
3396 ));
3397 }
3398 let pattern = Regex::new(
3399 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3400 )
3401 .unwrap();
3402 if !pattern.is_match(val) {
3403 return Err(ValidationError::new(
3404 1005,
3405 "nb does not match the required pattern".to_string(),
3406 ));
3407 }
3408 }
3409 Ok(())
3410 }
3411}
3412
3413#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3415pub struct DocumentLineInformation11 {
3416 #[serde(rename = "Id")]
3417 pub id: Vec<DocumentLineIdentification11>,
3418 #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
3419 pub desc: Option<String>,
3420 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
3421 pub amt: Option<RemittanceAmount31>,
3422}
3423
3424impl DocumentLineInformation11 {
3425 pub fn validate(&self) -> Result<(), ValidationError> {
3426 for item in &self.id {
3427 item.validate()?
3428 }
3429 if let Some(ref val) = self.desc {
3430 if val.chars().count() < 1 {
3431 return Err(ValidationError::new(
3432 1001,
3433 "desc is shorter than the minimum length of 1".to_string(),
3434 ));
3435 }
3436 if val.chars().count() > 2048 {
3437 return Err(ValidationError::new(
3438 1002,
3439 "desc exceeds the maximum length of 2048".to_string(),
3440 ));
3441 }
3442 let pattern = Regex::new(
3443 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3444 )
3445 .unwrap();
3446 if !pattern.is_match(val) {
3447 return Err(ValidationError::new(
3448 1005,
3449 "desc does not match the required pattern".to_string(),
3450 ));
3451 }
3452 }
3453 if let Some(ref val) = self.amt {
3454 val.validate()?
3455 }
3456 Ok(())
3457 }
3458}
3459
3460#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3462pub struct DocumentLineType1Choice1 {
3463 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3464 pub cd: Option<String>,
3465 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3466 pub prtry: Option<String>,
3467}
3468
3469impl DocumentLineType1Choice1 {
3470 pub fn validate(&self) -> Result<(), ValidationError> {
3471 if let Some(ref val) = self.cd {
3472 if val.chars().count() < 1 {
3473 return Err(ValidationError::new(
3474 1001,
3475 "cd is shorter than the minimum length of 1".to_string(),
3476 ));
3477 }
3478 if val.chars().count() > 4 {
3479 return Err(ValidationError::new(
3480 1002,
3481 "cd exceeds the maximum length of 4".to_string(),
3482 ));
3483 }
3484 }
3485 if let Some(ref val) = self.prtry {
3486 if val.chars().count() < 1 {
3487 return Err(ValidationError::new(
3488 1001,
3489 "prtry is shorter than the minimum length of 1".to_string(),
3490 ));
3491 }
3492 if val.chars().count() > 35 {
3493 return Err(ValidationError::new(
3494 1002,
3495 "prtry exceeds the maximum length of 35".to_string(),
3496 ));
3497 }
3498 let pattern = Regex::new(
3499 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3500 )
3501 .unwrap();
3502 if !pattern.is_match(val) {
3503 return Err(ValidationError::new(
3504 1005,
3505 "prtry does not match the required pattern".to_string(),
3506 ));
3507 }
3508 }
3509 Ok(())
3510 }
3511}
3512
3513#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3515pub struct DocumentLineType11 {
3516 #[serde(rename = "CdOrPrtry")]
3517 pub cd_or_prtry: DocumentLineType1Choice1,
3518 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3519 pub issr: Option<String>,
3520}
3521
3522impl DocumentLineType11 {
3523 pub fn validate(&self) -> Result<(), ValidationError> {
3524 self.cd_or_prtry.validate()?;
3525 if let Some(ref val) = self.issr {
3526 if val.chars().count() < 1 {
3527 return Err(ValidationError::new(
3528 1001,
3529 "issr is shorter than the minimum length of 1".to_string(),
3530 ));
3531 }
3532 if val.chars().count() > 35 {
3533 return Err(ValidationError::new(
3534 1002,
3535 "issr exceeds the maximum length of 35".to_string(),
3536 ));
3537 }
3538 let pattern = Regex::new(
3539 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3540 )
3541 .unwrap();
3542 if !pattern.is_match(val) {
3543 return Err(ValidationError::new(
3544 1005,
3545 "issr does not match the required pattern".to_string(),
3546 ));
3547 }
3548 }
3549 Ok(())
3550 }
3551}
3552
3553#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3555pub enum DocumentType3Code {
3556 #[default]
3557 #[serde(rename = "RADM")]
3558 CodeRADM,
3559 #[serde(rename = "RPIN")]
3560 CodeRPIN,
3561 #[serde(rename = "FXDR")]
3562 CodeFXDR,
3563 #[serde(rename = "DISP")]
3564 CodeDISP,
3565 #[serde(rename = "PUOR")]
3566 CodePUOR,
3567 #[serde(rename = "SCOR")]
3568 CodeSCOR,
3569}
3570
3571impl DocumentType3Code {
3572 pub fn validate(&self) -> Result<(), ValidationError> {
3573 Ok(())
3574 }
3575}
3576
3577#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3579pub enum DocumentType6Code {
3580 #[default]
3581 #[serde(rename = "MSIN")]
3582 CodeMSIN,
3583 #[serde(rename = "CNFA")]
3584 CodeCNFA,
3585 #[serde(rename = "DNFA")]
3586 CodeDNFA,
3587 #[serde(rename = "CINV")]
3588 CodeCINV,
3589 #[serde(rename = "CREN")]
3590 CodeCREN,
3591 #[serde(rename = "DEBN")]
3592 CodeDEBN,
3593 #[serde(rename = "HIRI")]
3594 CodeHIRI,
3595 #[serde(rename = "SBIN")]
3596 CodeSBIN,
3597 #[serde(rename = "CMCN")]
3598 CodeCMCN,
3599 #[serde(rename = "SOAC")]
3600 CodeSOAC,
3601 #[serde(rename = "DISP")]
3602 CodeDISP,
3603 #[serde(rename = "BOLD")]
3604 CodeBOLD,
3605 #[serde(rename = "VCHR")]
3606 CodeVCHR,
3607 #[serde(rename = "AROI")]
3608 CodeAROI,
3609 #[serde(rename = "TSUT")]
3610 CodeTSUT,
3611 #[serde(rename = "PUOR")]
3612 CodePUOR,
3613}
3614
3615impl DocumentType6Code {
3616 pub fn validate(&self) -> Result<(), ValidationError> {
3617 Ok(())
3618 }
3619}
3620
3621#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3623pub struct EntryDetails91 {
3624 #[serde(rename = "Btch", skip_serializing_if = "Option::is_none")]
3625 pub btch: Option<BatchInformation21>,
3626 #[serde(rename = "TxDtls")]
3627 pub tx_dtls: EntryTransaction101,
3628}
3629
3630impl EntryDetails91 {
3631 pub fn validate(&self) -> Result<(), ValidationError> {
3632 if let Some(ref val) = self.btch {
3633 val.validate()?
3634 }
3635 self.tx_dtls.validate()?;
3636 Ok(())
3637 }
3638}
3639
3640#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3642pub struct EntryStatus1Choice1 {
3643 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3644 pub cd: Option<String>,
3645}
3646
3647impl EntryStatus1Choice1 {
3648 pub fn validate(&self) -> Result<(), ValidationError> {
3649 if let Some(ref val) = self.cd {
3650 if val.chars().count() < 1 {
3651 return Err(ValidationError::new(
3652 1001,
3653 "cd is shorter than the minimum length of 1".to_string(),
3654 ));
3655 }
3656 if val.chars().count() > 4 {
3657 return Err(ValidationError::new(
3658 1002,
3659 "cd exceeds the maximum length of 4".to_string(),
3660 ));
3661 }
3662 }
3663 Ok(())
3664 }
3665}
3666
3667#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3669pub struct EntryTransaction101 {
3670 #[serde(rename = "Refs")]
3671 pub refs: TransactionReferences61,
3672 #[serde(rename = "Amt")]
3673 pub amt: ActiveOrHistoricCurrencyAndAmount,
3674 #[serde(rename = "CdtDbtInd")]
3675 pub cdt_dbt_ind: CreditDebitCode,
3676 #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
3677 pub amt_dtls: Option<AmountAndCurrencyExchange32>,
3678 #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
3679 pub avlbty: Option<Vec<CashAvailability1>>,
3680 #[serde(rename = "BkTxCd", skip_serializing_if = "Option::is_none")]
3681 pub bk_tx_cd: Option<BankTransactionCodeStructure41>,
3682 #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
3683 pub chrgs: Option<Charges61>,
3684 #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
3685 pub intrst: Option<TransactionInterest41>,
3686 #[serde(rename = "RltdPties", skip_serializing_if = "Option::is_none")]
3687 pub rltd_pties: Option<TransactionParties61>,
3688 #[serde(rename = "RltdAgts", skip_serializing_if = "Option::is_none")]
3689 pub rltd_agts: Option<TransactionAgents51>,
3690 #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3691 pub lcl_instrm: Option<LocalInstrument2Choice1>,
3692 #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
3693 pub purp: Option<Purpose2Choice1>,
3694 #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
3695 pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
3696 #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
3697 pub rmt_inf: Option<RemittanceInformation161>,
3698 #[serde(rename = "RltdDts", skip_serializing_if = "Option::is_none")]
3699 pub rltd_dts: Option<TransactionDates31>,
3700 #[serde(rename = "RltdPric", skip_serializing_if = "Option::is_none")]
3701 pub rltd_pric: Option<TransactionPrice4Choice1>,
3702 #[serde(rename = "RltdQties", skip_serializing_if = "Option::is_none")]
3703 pub rltd_qties: Option<Vec<TransactionQuantities3Choice1>>,
3704 #[serde(rename = "FinInstrmId", skip_serializing_if = "Option::is_none")]
3705 pub fin_instrm_id: Option<SecurityIdentification191>,
3706 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
3707 pub tax: Option<TaxInformation81>,
3708 #[serde(rename = "RtrInf", skip_serializing_if = "Option::is_none")]
3709 pub rtr_inf: Option<PaymentReturnReason51>,
3710 #[serde(rename = "CorpActn", skip_serializing_if = "Option::is_none")]
3711 pub corp_actn: Option<CorporateAction91>,
3712 #[serde(rename = "SfkpgAcct", skip_serializing_if = "Option::is_none")]
3713 pub sfkpg_acct: Option<SecuritiesAccount191>,
3714 #[serde(rename = "CshDpst", skip_serializing_if = "Option::is_none")]
3715 pub csh_dpst: Option<Vec<CashDeposit11>>,
3716 #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
3717 pub card_tx: Option<CardTransaction171>,
3718 #[serde(rename = "AddtlTxInf", skip_serializing_if = "Option::is_none")]
3719 pub addtl_tx_inf: Option<String>,
3720}
3721
3722impl EntryTransaction101 {
3723 pub fn validate(&self) -> Result<(), ValidationError> {
3724 self.refs.validate()?;
3725 self.amt.validate()?;
3726 self.cdt_dbt_ind.validate()?;
3727 if let Some(ref val) = self.amt_dtls {
3728 val.validate()?
3729 }
3730 if let Some(ref vec) = self.avlbty {
3731 for item in vec {
3732 item.validate()?
3733 }
3734 }
3735 if let Some(ref val) = self.bk_tx_cd {
3736 val.validate()?
3737 }
3738 if let Some(ref val) = self.chrgs {
3739 val.validate()?
3740 }
3741 if let Some(ref val) = self.intrst {
3742 val.validate()?
3743 }
3744 if let Some(ref val) = self.rltd_pties {
3745 val.validate()?
3746 }
3747 if let Some(ref val) = self.rltd_agts {
3748 val.validate()?
3749 }
3750 if let Some(ref val) = self.lcl_instrm {
3751 val.validate()?
3752 }
3753 if let Some(ref val) = self.purp {
3754 val.validate()?
3755 }
3756 if let Some(ref vec) = self.rltd_rmt_inf {
3757 for item in vec {
3758 item.validate()?
3759 }
3760 }
3761 if let Some(ref val) = self.rmt_inf {
3762 val.validate()?
3763 }
3764 if let Some(ref val) = self.rltd_dts {
3765 val.validate()?
3766 }
3767 if let Some(ref val) = self.rltd_pric {
3768 val.validate()?
3769 }
3770 if let Some(ref vec) = self.rltd_qties {
3771 for item in vec {
3772 item.validate()?
3773 }
3774 }
3775 if let Some(ref val) = self.fin_instrm_id {
3776 val.validate()?
3777 }
3778 if let Some(ref val) = self.tax {
3779 val.validate()?
3780 }
3781 if let Some(ref val) = self.rtr_inf {
3782 val.validate()?
3783 }
3784 if let Some(ref val) = self.corp_actn {
3785 val.validate()?
3786 }
3787 if let Some(ref val) = self.sfkpg_acct {
3788 val.validate()?
3789 }
3790 if let Some(ref vec) = self.csh_dpst {
3791 for item in vec {
3792 item.validate()?
3793 }
3794 }
3795 if let Some(ref val) = self.card_tx {
3796 val.validate()?
3797 }
3798 if let Some(ref val) = self.addtl_tx_inf {
3799 if val.chars().count() < 1 {
3800 return Err(ValidationError::new(
3801 1001,
3802 "addtl_tx_inf is shorter than the minimum length of 1".to_string(),
3803 ));
3804 }
3805 if val.chars().count() > 500 {
3806 return Err(ValidationError::new(
3807 1002,
3808 "addtl_tx_inf exceeds the maximum length of 500".to_string(),
3809 ));
3810 }
3811 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3812 if !pattern.is_match(val) {
3813 return Err(ValidationError::new(
3814 1005,
3815 "addtl_tx_inf does not match the required pattern".to_string(),
3816 ));
3817 }
3818 }
3819 Ok(())
3820 }
3821}
3822
3823#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3825pub struct FinancialIdentificationSchemeName1Choice1 {
3826 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3827 pub cd: Option<String>,
3828 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3829 pub prtry: Option<String>,
3830}
3831
3832impl FinancialIdentificationSchemeName1Choice1 {
3833 pub fn validate(&self) -> Result<(), ValidationError> {
3834 if let Some(ref val) = self.cd {
3835 if val.chars().count() < 1 {
3836 return Err(ValidationError::new(
3837 1001,
3838 "cd is shorter than the minimum length of 1".to_string(),
3839 ));
3840 }
3841 if val.chars().count() > 4 {
3842 return Err(ValidationError::new(
3843 1002,
3844 "cd exceeds the maximum length of 4".to_string(),
3845 ));
3846 }
3847 }
3848 if let Some(ref val) = self.prtry {
3849 if val.chars().count() < 1 {
3850 return Err(ValidationError::new(
3851 1001,
3852 "prtry is shorter than the minimum length of 1".to_string(),
3853 ));
3854 }
3855 if val.chars().count() > 35 {
3856 return Err(ValidationError::new(
3857 1002,
3858 "prtry exceeds the maximum length of 35".to_string(),
3859 ));
3860 }
3861 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3862 if !pattern.is_match(val) {
3863 return Err(ValidationError::new(
3864 1005,
3865 "prtry does not match the required pattern".to_string(),
3866 ));
3867 }
3868 }
3869 Ok(())
3870 }
3871}
3872
3873#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3875pub struct FinancialInstitutionIdentification181 {
3876 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
3877 pub bicfi: Option<String>,
3878 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
3879 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
3880 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3881 pub lei: Option<String>,
3882 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3883 pub nm: Option<String>,
3884 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3885 pub pstl_adr: Option<PostalAddress241>,
3886 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3887 pub othr: Option<GenericFinancialIdentification11>,
3888}
3889
3890impl FinancialInstitutionIdentification181 {
3891 pub fn validate(&self) -> Result<(), ValidationError> {
3892 if let Some(ref val) = self.bicfi {
3893 let pattern =
3894 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
3895 if !pattern.is_match(val) {
3896 return Err(ValidationError::new(
3897 1005,
3898 "bicfi does not match the required pattern".to_string(),
3899 ));
3900 }
3901 }
3902 if let Some(ref val) = self.clr_sys_mmb_id {
3903 val.validate()?
3904 }
3905 if let Some(ref val) = self.lei {
3906 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
3907 if !pattern.is_match(val) {
3908 return Err(ValidationError::new(
3909 1005,
3910 "lei does not match the required pattern".to_string(),
3911 ));
3912 }
3913 }
3914 if let Some(ref val) = self.nm {
3915 if val.chars().count() < 1 {
3916 return Err(ValidationError::new(
3917 1001,
3918 "nm is shorter than the minimum length of 1".to_string(),
3919 ));
3920 }
3921 if val.chars().count() > 140 {
3922 return Err(ValidationError::new(
3923 1002,
3924 "nm exceeds the maximum length of 140".to_string(),
3925 ));
3926 }
3927 let pattern = Regex::new(
3928 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3929 )
3930 .unwrap();
3931 if !pattern.is_match(val) {
3932 return Err(ValidationError::new(
3933 1005,
3934 "nm does not match the required pattern".to_string(),
3935 ));
3936 }
3937 }
3938 if let Some(ref val) = self.pstl_adr {
3939 val.validate()?
3940 }
3941 if let Some(ref val) = self.othr {
3942 val.validate()?
3943 }
3944 Ok(())
3945 }
3946}
3947
3948#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3950pub struct FinancialInstitutionIdentification182 {
3951 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
3952 pub bicfi: Option<String>,
3953 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
3954 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
3955 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3956 pub lei: Option<String>,
3957 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3958 pub nm: Option<String>,
3959 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3960 pub pstl_adr: Option<PostalAddress241>,
3961 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3962 pub othr: Option<GenericFinancialIdentification11>,
3963}
3964
3965impl FinancialInstitutionIdentification182 {
3966 pub fn validate(&self) -> Result<(), ValidationError> {
3967 if let Some(ref val) = self.bicfi {
3968 let pattern =
3969 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
3970 if !pattern.is_match(val) {
3971 return Err(ValidationError::new(
3972 1005,
3973 "bicfi does not match the required pattern".to_string(),
3974 ));
3975 }
3976 }
3977 if let Some(ref val) = self.clr_sys_mmb_id {
3978 val.validate()?
3979 }
3980 if let Some(ref val) = self.lei {
3981 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
3982 if !pattern.is_match(val) {
3983 return Err(ValidationError::new(
3984 1005,
3985 "lei does not match the required pattern".to_string(),
3986 ));
3987 }
3988 }
3989 if let Some(ref val) = self.nm {
3990 if val.chars().count() < 1 {
3991 return Err(ValidationError::new(
3992 1001,
3993 "nm is shorter than the minimum length of 1".to_string(),
3994 ));
3995 }
3996 if val.chars().count() > 140 {
3997 return Err(ValidationError::new(
3998 1002,
3999 "nm exceeds the maximum length of 140".to_string(),
4000 ));
4001 }
4002 let pattern = Regex::new(
4003 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4004 )
4005 .unwrap();
4006 if !pattern.is_match(val) {
4007 return Err(ValidationError::new(
4008 1005,
4009 "nm does not match the required pattern".to_string(),
4010 ));
4011 }
4012 }
4013 if let Some(ref val) = self.pstl_adr {
4014 val.validate()?
4015 }
4016 if let Some(ref val) = self.othr {
4017 val.validate()?
4018 }
4019 Ok(())
4020 }
4021}
4022
4023#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4025pub struct FinancialInstrumentQuantity1Choice {
4026 #[serde(rename = "Unit", skip_serializing_if = "Option::is_none")]
4027 pub unit: Option<f64>,
4028 #[serde(rename = "FaceAmt", skip_serializing_if = "Option::is_none")]
4029 pub face_amt: Option<f64>,
4030 #[serde(rename = "AmtsdVal", skip_serializing_if = "Option::is_none")]
4031 pub amtsd_val: Option<f64>,
4032}
4033
4034impl FinancialInstrumentQuantity1Choice {
4035 pub fn validate(&self) -> Result<(), ValidationError> {
4036 if let Some(ref val) = self.face_amt {
4037 if *val < 0.000000 {
4038 return Err(ValidationError::new(
4039 1003,
4040 "face_amt is less than the minimum value of 0.000000".to_string(),
4041 ));
4042 }
4043 }
4044 if let Some(ref val) = self.amtsd_val {
4045 if *val < 0.000000 {
4046 return Err(ValidationError::new(
4047 1003,
4048 "amtsd_val is less than the minimum value of 0.000000".to_string(),
4049 ));
4050 }
4051 }
4052 Ok(())
4053 }
4054}
4055
4056#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4058pub struct FromToAmountRange1 {
4059 #[serde(rename = "FrAmt")]
4060 pub fr_amt: AmountRangeBoundary1,
4061 #[serde(rename = "ToAmt")]
4062 pub to_amt: AmountRangeBoundary1,
4063}
4064
4065impl FromToAmountRange1 {
4066 pub fn validate(&self) -> Result<(), ValidationError> {
4067 self.fr_amt.validate()?;
4068 self.to_amt.validate()?;
4069 Ok(())
4070 }
4071}
4072
4073#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4075pub struct Garnishment31 {
4076 #[serde(rename = "Tp")]
4077 pub tp: GarnishmentType11,
4078 #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
4079 pub grnshee: Option<PartyIdentification1355>,
4080 #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
4081 pub grnshmt_admstr: Option<PartyIdentification1356>,
4082 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
4083 pub ref_nb: Option<String>,
4084 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
4085 pub dt: Option<String>,
4086 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
4087 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
4088 #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
4089 pub fmly_mdcl_insrnc_ind: Option<bool>,
4090 #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
4091 pub mplyee_termntn_ind: Option<bool>,
4092}
4093
4094impl Garnishment31 {
4095 pub fn validate(&self) -> Result<(), ValidationError> {
4096 self.tp.validate()?;
4097 if let Some(ref val) = self.grnshee {
4098 val.validate()?
4099 }
4100 if let Some(ref val) = self.grnshmt_admstr {
4101 val.validate()?
4102 }
4103 if let Some(ref val) = self.ref_nb {
4104 if val.chars().count() < 1 {
4105 return Err(ValidationError::new(
4106 1001,
4107 "ref_nb is shorter than the minimum length of 1".to_string(),
4108 ));
4109 }
4110 if val.chars().count() > 140 {
4111 return Err(ValidationError::new(
4112 1002,
4113 "ref_nb exceeds the maximum length of 140".to_string(),
4114 ));
4115 }
4116 let pattern = Regex::new(
4117 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4118 )
4119 .unwrap();
4120 if !pattern.is_match(val) {
4121 return Err(ValidationError::new(
4122 1005,
4123 "ref_nb does not match the required pattern".to_string(),
4124 ));
4125 }
4126 }
4127 if let Some(ref val) = self.rmtd_amt {
4128 val.validate()?
4129 }
4130 Ok(())
4131 }
4132}
4133
4134#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4136pub struct GarnishmentType1Choice1 {
4137 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4138 pub cd: Option<String>,
4139 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4140 pub prtry: Option<String>,
4141}
4142
4143impl GarnishmentType1Choice1 {
4144 pub fn validate(&self) -> Result<(), ValidationError> {
4145 if let Some(ref val) = self.cd {
4146 if val.chars().count() < 1 {
4147 return Err(ValidationError::new(
4148 1001,
4149 "cd is shorter than the minimum length of 1".to_string(),
4150 ));
4151 }
4152 if val.chars().count() > 4 {
4153 return Err(ValidationError::new(
4154 1002,
4155 "cd exceeds the maximum length of 4".to_string(),
4156 ));
4157 }
4158 }
4159 if let Some(ref val) = self.prtry {
4160 if val.chars().count() < 1 {
4161 return Err(ValidationError::new(
4162 1001,
4163 "prtry is shorter than the minimum length of 1".to_string(),
4164 ));
4165 }
4166 if val.chars().count() > 35 {
4167 return Err(ValidationError::new(
4168 1002,
4169 "prtry exceeds the maximum length of 35".to_string(),
4170 ));
4171 }
4172 let pattern = Regex::new(
4173 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4174 )
4175 .unwrap();
4176 if !pattern.is_match(val) {
4177 return Err(ValidationError::new(
4178 1005,
4179 "prtry does not match the required pattern".to_string(),
4180 ));
4181 }
4182 }
4183 Ok(())
4184 }
4185}
4186
4187#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4189pub struct GarnishmentType11 {
4190 #[serde(rename = "CdOrPrtry")]
4191 pub cd_or_prtry: GarnishmentType1Choice1,
4192 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4193 pub issr: Option<String>,
4194}
4195
4196impl GarnishmentType11 {
4197 pub fn validate(&self) -> Result<(), ValidationError> {
4198 self.cd_or_prtry.validate()?;
4199 if let Some(ref val) = self.issr {
4200 if val.chars().count() < 1 {
4201 return Err(ValidationError::new(
4202 1001,
4203 "issr is shorter than the minimum length of 1".to_string(),
4204 ));
4205 }
4206 if val.chars().count() > 35 {
4207 return Err(ValidationError::new(
4208 1002,
4209 "issr exceeds the maximum length of 35".to_string(),
4210 ));
4211 }
4212 let pattern = Regex::new(
4213 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4214 )
4215 .unwrap();
4216 if !pattern.is_match(val) {
4217 return Err(ValidationError::new(
4218 1005,
4219 "issr does not match the required pattern".to_string(),
4220 ));
4221 }
4222 }
4223 Ok(())
4224 }
4225}
4226
4227#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4229pub struct GenericAccountIdentification11 {
4230 #[serde(rename = "Id")]
4231 pub id: String,
4232 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4233 pub schme_nm: Option<AccountSchemeName1Choice1>,
4234 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4235 pub issr: Option<String>,
4236}
4237
4238impl GenericAccountIdentification11 {
4239 pub fn validate(&self) -> Result<(), ValidationError> {
4240 if self.id.chars().count() < 1 {
4241 return Err(ValidationError::new(
4242 1001,
4243 "id is shorter than the minimum length of 1".to_string(),
4244 ));
4245 }
4246 if self.id.chars().count() > 34 {
4247 return Err(ValidationError::new(
4248 1002,
4249 "id exceeds the maximum length of 34".to_string(),
4250 ));
4251 }
4252 let pattern = Regex::new("([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)").unwrap();
4253 if !pattern.is_match(&self.id) {
4254 return Err(ValidationError::new(
4255 1005,
4256 "id does not match the required pattern".to_string(),
4257 ));
4258 }
4259 if let Some(ref val) = self.schme_nm {
4260 val.validate()?
4261 }
4262 if let Some(ref val) = self.issr {
4263 if val.chars().count() < 1 {
4264 return Err(ValidationError::new(
4265 1001,
4266 "issr is shorter than the minimum length of 1".to_string(),
4267 ));
4268 }
4269 if val.chars().count() > 35 {
4270 return Err(ValidationError::new(
4271 1002,
4272 "issr exceeds the maximum length of 35".to_string(),
4273 ));
4274 }
4275 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4276 if !pattern.is_match(val) {
4277 return Err(ValidationError::new(
4278 1005,
4279 "issr does not match the required pattern".to_string(),
4280 ));
4281 }
4282 }
4283 Ok(())
4284 }
4285}
4286
4287#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4289pub struct GenericFinancialIdentification11 {
4290 #[serde(rename = "Id")]
4291 pub id: String,
4292 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4293 pub schme_nm: Option<FinancialIdentificationSchemeName1Choice1>,
4294 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4295 pub issr: Option<String>,
4296}
4297
4298impl GenericFinancialIdentification11 {
4299 pub fn validate(&self) -> Result<(), ValidationError> {
4300 if self.id.chars().count() < 1 {
4301 return Err(ValidationError::new(
4302 1001,
4303 "id is shorter than the minimum length of 1".to_string(),
4304 ));
4305 }
4306 if self.id.chars().count() > 35 {
4307 return Err(ValidationError::new(
4308 1002,
4309 "id exceeds the maximum length of 35".to_string(),
4310 ));
4311 }
4312 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4313 if !pattern.is_match(&self.id) {
4314 return Err(ValidationError::new(
4315 1005,
4316 "id does not match the required pattern".to_string(),
4317 ));
4318 }
4319 if let Some(ref val) = self.schme_nm {
4320 val.validate()?
4321 }
4322 if let Some(ref val) = self.issr {
4323 if val.chars().count() < 1 {
4324 return Err(ValidationError::new(
4325 1001,
4326 "issr is shorter than the minimum length of 1".to_string(),
4327 ));
4328 }
4329 if val.chars().count() > 35 {
4330 return Err(ValidationError::new(
4331 1002,
4332 "issr exceeds the maximum length of 35".to_string(),
4333 ));
4334 }
4335 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4336 if !pattern.is_match(val) {
4337 return Err(ValidationError::new(
4338 1005,
4339 "issr does not match the required pattern".to_string(),
4340 ));
4341 }
4342 }
4343 Ok(())
4344 }
4345}
4346
4347#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4349pub struct GenericIdentification11 {
4350 #[serde(rename = "Id")]
4351 pub id: String,
4352 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4353 pub schme_nm: Option<String>,
4354 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4355 pub issr: Option<String>,
4356}
4357
4358impl GenericIdentification11 {
4359 pub fn validate(&self) -> Result<(), ValidationError> {
4360 if self.id.chars().count() < 1 {
4361 return Err(ValidationError::new(
4362 1001,
4363 "id is shorter than the minimum length of 1".to_string(),
4364 ));
4365 }
4366 if self.id.chars().count() > 35 {
4367 return Err(ValidationError::new(
4368 1002,
4369 "id exceeds the maximum length of 35".to_string(),
4370 ));
4371 }
4372 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4373 if !pattern.is_match(&self.id) {
4374 return Err(ValidationError::new(
4375 1005,
4376 "id does not match the required pattern".to_string(),
4377 ));
4378 }
4379 if let Some(ref val) = self.schme_nm {
4380 if val.chars().count() < 1 {
4381 return Err(ValidationError::new(
4382 1001,
4383 "schme_nm is shorter than the minimum length of 1".to_string(),
4384 ));
4385 }
4386 if val.chars().count() > 35 {
4387 return Err(ValidationError::new(
4388 1002,
4389 "schme_nm exceeds the maximum length of 35".to_string(),
4390 ));
4391 }
4392 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4393 if !pattern.is_match(val) {
4394 return Err(ValidationError::new(
4395 1005,
4396 "schme_nm does not match the required pattern".to_string(),
4397 ));
4398 }
4399 }
4400 if let Some(ref val) = self.issr {
4401 if val.chars().count() < 1 {
4402 return Err(ValidationError::new(
4403 1001,
4404 "issr is shorter than the minimum length of 1".to_string(),
4405 ));
4406 }
4407 if val.chars().count() > 35 {
4408 return Err(ValidationError::new(
4409 1002,
4410 "issr exceeds the maximum length of 35".to_string(),
4411 ));
4412 }
4413 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4414 if !pattern.is_match(val) {
4415 return Err(ValidationError::new(
4416 1005,
4417 "issr does not match the required pattern".to_string(),
4418 ));
4419 }
4420 }
4421 Ok(())
4422 }
4423}
4424
4425#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4427pub struct GenericIdentification301 {
4428 #[serde(rename = "Id")]
4429 pub id: String,
4430 #[serde(rename = "Issr")]
4431 pub issr: String,
4432 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4433 pub schme_nm: Option<String>,
4434}
4435
4436impl GenericIdentification301 {
4437 pub fn validate(&self) -> Result<(), ValidationError> {
4438 let pattern = Regex::new("[a-zA-Z0-9]{4}").unwrap();
4439 if !pattern.is_match(&self.id) {
4440 return Err(ValidationError::new(
4441 1005,
4442 "id does not match the required pattern".to_string(),
4443 ));
4444 }
4445 if self.issr.chars().count() < 1 {
4446 return Err(ValidationError::new(
4447 1001,
4448 "issr is shorter than the minimum length of 1".to_string(),
4449 ));
4450 }
4451 if self.issr.chars().count() > 35 {
4452 return Err(ValidationError::new(
4453 1002,
4454 "issr exceeds the maximum length of 35".to_string(),
4455 ));
4456 }
4457 let pattern =
4458 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
4459 .unwrap();
4460 if !pattern.is_match(&self.issr) {
4461 return Err(ValidationError::new(
4462 1005,
4463 "issr does not match the required pattern".to_string(),
4464 ));
4465 }
4466 if let Some(ref val) = self.schme_nm {
4467 if val.chars().count() < 1 {
4468 return Err(ValidationError::new(
4469 1001,
4470 "schme_nm is shorter than the minimum length of 1".to_string(),
4471 ));
4472 }
4473 if val.chars().count() > 35 {
4474 return Err(ValidationError::new(
4475 1002,
4476 "schme_nm exceeds the maximum length of 35".to_string(),
4477 ));
4478 }
4479 let pattern = Regex::new(
4480 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4481 )
4482 .unwrap();
4483 if !pattern.is_match(val) {
4484 return Err(ValidationError::new(
4485 1005,
4486 "schme_nm does not match the required pattern".to_string(),
4487 ));
4488 }
4489 }
4490 Ok(())
4491 }
4492}
4493
4494#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4496pub struct GenericIdentification302 {
4497 #[serde(rename = "Id")]
4498 pub id: String,
4499 #[serde(rename = "Issr")]
4500 pub issr: String,
4501 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4502 pub schme_nm: Option<String>,
4503}
4504
4505impl GenericIdentification302 {
4506 pub fn validate(&self) -> Result<(), ValidationError> {
4507 let pattern = Regex::new("[a-zA-Z0-9]{4}").unwrap();
4508 if !pattern.is_match(&self.id) {
4509 return Err(ValidationError::new(
4510 1005,
4511 "id does not match the required pattern".to_string(),
4512 ));
4513 }
4514 if self.issr.chars().count() < 1 {
4515 return Err(ValidationError::new(
4516 1001,
4517 "issr is shorter than the minimum length of 1".to_string(),
4518 ));
4519 }
4520 if self.issr.chars().count() > 35 {
4521 return Err(ValidationError::new(
4522 1002,
4523 "issr exceeds the maximum length of 35".to_string(),
4524 ));
4525 }
4526 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4527 if !pattern.is_match(&self.issr) {
4528 return Err(ValidationError::new(
4529 1005,
4530 "issr does not match the required pattern".to_string(),
4531 ));
4532 }
4533 if let Some(ref val) = self.schme_nm {
4534 if val.chars().count() < 1 {
4535 return Err(ValidationError::new(
4536 1001,
4537 "schme_nm is shorter than the minimum length of 1".to_string(),
4538 ));
4539 }
4540 if val.chars().count() > 35 {
4541 return Err(ValidationError::new(
4542 1002,
4543 "schme_nm exceeds the maximum length of 35".to_string(),
4544 ));
4545 }
4546 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4547 if !pattern.is_match(val) {
4548 return Err(ValidationError::new(
4549 1005,
4550 "schme_nm does not match the required pattern".to_string(),
4551 ));
4552 }
4553 }
4554 Ok(())
4555 }
4556}
4557
4558#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4560pub struct GenericIdentification321 {
4561 #[serde(rename = "Id")]
4562 pub id: String,
4563 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4564 pub tp: Option<PartyType3Code>,
4565 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4566 pub issr: Option<PartyType4Code>,
4567 #[serde(rename = "ShrtNm", skip_serializing_if = "Option::is_none")]
4568 pub shrt_nm: Option<String>,
4569}
4570
4571impl GenericIdentification321 {
4572 pub fn validate(&self) -> Result<(), ValidationError> {
4573 if self.id.chars().count() < 1 {
4574 return Err(ValidationError::new(
4575 1001,
4576 "id is shorter than the minimum length of 1".to_string(),
4577 ));
4578 }
4579 if self.id.chars().count() > 35 {
4580 return Err(ValidationError::new(
4581 1002,
4582 "id exceeds the maximum length of 35".to_string(),
4583 ));
4584 }
4585 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4586 if !pattern.is_match(&self.id) {
4587 return Err(ValidationError::new(
4588 1005,
4589 "id does not match the required pattern".to_string(),
4590 ));
4591 }
4592 if let Some(ref val) = self.tp {
4593 val.validate()?
4594 }
4595 if let Some(ref val) = self.issr {
4596 val.validate()?
4597 }
4598 if let Some(ref val) = self.shrt_nm {
4599 if val.chars().count() < 1 {
4600 return Err(ValidationError::new(
4601 1001,
4602 "shrt_nm is shorter than the minimum length of 1".to_string(),
4603 ));
4604 }
4605 if val.chars().count() > 35 {
4606 return Err(ValidationError::new(
4607 1002,
4608 "shrt_nm exceeds the maximum length of 35".to_string(),
4609 ));
4610 }
4611 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4612 if !pattern.is_match(val) {
4613 return Err(ValidationError::new(
4614 1005,
4615 "shrt_nm does not match the required pattern".to_string(),
4616 ));
4617 }
4618 }
4619 Ok(())
4620 }
4621}
4622
4623#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4625pub struct GenericIdentification31 {
4626 #[serde(rename = "Id")]
4627 pub id: String,
4628 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4629 pub issr: Option<String>,
4630}
4631
4632impl GenericIdentification31 {
4633 pub fn validate(&self) -> Result<(), ValidationError> {
4634 if self.id.chars().count() < 1 {
4635 return Err(ValidationError::new(
4636 1001,
4637 "id is shorter than the minimum length of 1".to_string(),
4638 ));
4639 }
4640 if self.id.chars().count() > 35 {
4641 return Err(ValidationError::new(
4642 1002,
4643 "id exceeds the maximum length of 35".to_string(),
4644 ));
4645 }
4646 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4647 if !pattern.is_match(&self.id) {
4648 return Err(ValidationError::new(
4649 1005,
4650 "id does not match the required pattern".to_string(),
4651 ));
4652 }
4653 if let Some(ref val) = self.issr {
4654 if val.chars().count() < 1 {
4655 return Err(ValidationError::new(
4656 1001,
4657 "issr is shorter than the minimum length of 1".to_string(),
4658 ));
4659 }
4660 if val.chars().count() > 35 {
4661 return Err(ValidationError::new(
4662 1002,
4663 "issr exceeds the maximum length of 35".to_string(),
4664 ));
4665 }
4666 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4667 if !pattern.is_match(val) {
4668 return Err(ValidationError::new(
4669 1005,
4670 "issr does not match the required pattern".to_string(),
4671 ));
4672 }
4673 }
4674 Ok(())
4675 }
4676}
4677
4678#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4680pub struct GenericOrganisationIdentification11 {
4681 #[serde(rename = "Id")]
4682 pub id: String,
4683 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4684 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
4685 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4686 pub issr: Option<String>,
4687}
4688
4689impl GenericOrganisationIdentification11 {
4690 pub fn validate(&self) -> Result<(), ValidationError> {
4691 if self.id.chars().count() < 1 {
4692 return Err(ValidationError::new(
4693 1001,
4694 "id is shorter than the minimum length of 1".to_string(),
4695 ));
4696 }
4697 if self.id.chars().count() > 35 {
4698 return Err(ValidationError::new(
4699 1002,
4700 "id exceeds the maximum length of 35".to_string(),
4701 ));
4702 }
4703 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4704 if !pattern.is_match(&self.id) {
4705 return Err(ValidationError::new(
4706 1005,
4707 "id does not match the required pattern".to_string(),
4708 ));
4709 }
4710 if let Some(ref val) = self.schme_nm {
4711 val.validate()?
4712 }
4713 if let Some(ref val) = self.issr {
4714 if val.chars().count() < 1 {
4715 return Err(ValidationError::new(
4716 1001,
4717 "issr is shorter than the minimum length of 1".to_string(),
4718 ));
4719 }
4720 if val.chars().count() > 35 {
4721 return Err(ValidationError::new(
4722 1002,
4723 "issr exceeds the maximum length of 35".to_string(),
4724 ));
4725 }
4726 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4727 if !pattern.is_match(val) {
4728 return Err(ValidationError::new(
4729 1005,
4730 "issr does not match the required pattern".to_string(),
4731 ));
4732 }
4733 }
4734 Ok(())
4735 }
4736}
4737
4738#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4740pub struct GenericOrganisationIdentification12 {
4741 #[serde(rename = "Id")]
4742 pub id: String,
4743 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4744 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice2>,
4745 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4746 pub issr: Option<String>,
4747}
4748
4749impl GenericOrganisationIdentification12 {
4750 pub fn validate(&self) -> Result<(), ValidationError> {
4751 if self.id.chars().count() < 1 {
4752 return Err(ValidationError::new(
4753 1001,
4754 "id is shorter than the minimum length of 1".to_string(),
4755 ));
4756 }
4757 if self.id.chars().count() > 35 {
4758 return Err(ValidationError::new(
4759 1002,
4760 "id exceeds the maximum length of 35".to_string(),
4761 ));
4762 }
4763 let pattern =
4764 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
4765 .unwrap();
4766 if !pattern.is_match(&self.id) {
4767 return Err(ValidationError::new(
4768 1005,
4769 "id does not match the required pattern".to_string(),
4770 ));
4771 }
4772 if let Some(ref val) = self.schme_nm {
4773 val.validate()?
4774 }
4775 if let Some(ref val) = self.issr {
4776 if val.chars().count() < 1 {
4777 return Err(ValidationError::new(
4778 1001,
4779 "issr is shorter than the minimum length of 1".to_string(),
4780 ));
4781 }
4782 if val.chars().count() > 35 {
4783 return Err(ValidationError::new(
4784 1002,
4785 "issr exceeds the maximum length of 35".to_string(),
4786 ));
4787 }
4788 let pattern = Regex::new(
4789 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4790 )
4791 .unwrap();
4792 if !pattern.is_match(val) {
4793 return Err(ValidationError::new(
4794 1005,
4795 "issr does not match the required pattern".to_string(),
4796 ));
4797 }
4798 }
4799 Ok(())
4800 }
4801}
4802
4803#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4805pub struct GenericPersonIdentification11 {
4806 #[serde(rename = "Id")]
4807 pub id: String,
4808 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4809 pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
4810 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4811 pub issr: Option<String>,
4812}
4813
4814impl GenericPersonIdentification11 {
4815 pub fn validate(&self) -> Result<(), ValidationError> {
4816 if self.id.chars().count() < 1 {
4817 return Err(ValidationError::new(
4818 1001,
4819 "id is shorter than the minimum length of 1".to_string(),
4820 ));
4821 }
4822 if self.id.chars().count() > 35 {
4823 return Err(ValidationError::new(
4824 1002,
4825 "id exceeds the maximum length of 35".to_string(),
4826 ));
4827 }
4828 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4829 if !pattern.is_match(&self.id) {
4830 return Err(ValidationError::new(
4831 1005,
4832 "id does not match the required pattern".to_string(),
4833 ));
4834 }
4835 if let Some(ref val) = self.schme_nm {
4836 val.validate()?
4837 }
4838 if let Some(ref val) = self.issr {
4839 if val.chars().count() < 1 {
4840 return Err(ValidationError::new(
4841 1001,
4842 "issr is shorter than the minimum length of 1".to_string(),
4843 ));
4844 }
4845 if val.chars().count() > 35 {
4846 return Err(ValidationError::new(
4847 1002,
4848 "issr exceeds the maximum length of 35".to_string(),
4849 ));
4850 }
4851 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4852 if !pattern.is_match(val) {
4853 return Err(ValidationError::new(
4854 1005,
4855 "issr does not match the required pattern".to_string(),
4856 ));
4857 }
4858 }
4859 Ok(())
4860 }
4861}
4862
4863#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4865pub struct GenericPersonIdentification12 {
4866 #[serde(rename = "Id")]
4867 pub id: String,
4868 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
4869 pub schme_nm: Option<PersonIdentificationSchemeName1Choice2>,
4870 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4871 pub issr: Option<String>,
4872}
4873
4874impl GenericPersonIdentification12 {
4875 pub fn validate(&self) -> Result<(), ValidationError> {
4876 if self.id.chars().count() < 1 {
4877 return Err(ValidationError::new(
4878 1001,
4879 "id is shorter than the minimum length of 1".to_string(),
4880 ));
4881 }
4882 if self.id.chars().count() > 35 {
4883 return Err(ValidationError::new(
4884 1002,
4885 "id exceeds the maximum length of 35".to_string(),
4886 ));
4887 }
4888 let pattern =
4889 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
4890 .unwrap();
4891 if !pattern.is_match(&self.id) {
4892 return Err(ValidationError::new(
4893 1005,
4894 "id does not match the required pattern".to_string(),
4895 ));
4896 }
4897 if let Some(ref val) = self.schme_nm {
4898 val.validate()?
4899 }
4900 if let Some(ref val) = self.issr {
4901 if val.chars().count() < 1 {
4902 return Err(ValidationError::new(
4903 1001,
4904 "issr is shorter than the minimum length of 1".to_string(),
4905 ));
4906 }
4907 if val.chars().count() > 35 {
4908 return Err(ValidationError::new(
4909 1002,
4910 "issr exceeds the maximum length of 35".to_string(),
4911 ));
4912 }
4913 let pattern = Regex::new(
4914 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4915 )
4916 .unwrap();
4917 if !pattern.is_match(val) {
4918 return Err(ValidationError::new(
4919 1005,
4920 "issr does not match the required pattern".to_string(),
4921 ));
4922 }
4923 }
4924 Ok(())
4925 }
4926}
4927
4928#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4930pub struct GroupHeader811 {
4931 #[serde(rename = "MsgId")]
4932 pub msg_id: String,
4933 #[serde(rename = "CreDtTm")]
4934 pub cre_dt_tm: String,
4935 #[serde(rename = "MsgRcpt", skip_serializing_if = "Option::is_none")]
4936 pub msg_rcpt: Option<PartyIdentification1351>,
4937 #[serde(rename = "OrgnlBizQry", skip_serializing_if = "Option::is_none")]
4938 pub orgnl_biz_qry: Option<OriginalBusinessQuery11>,
4939 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
4940 pub addtl_inf: Option<String>,
4941}
4942
4943impl GroupHeader811 {
4944 pub fn validate(&self) -> Result<(), ValidationError> {
4945 if self.msg_id.chars().count() < 1 {
4946 return Err(ValidationError::new(
4947 1001,
4948 "msg_id is shorter than the minimum length of 1".to_string(),
4949 ));
4950 }
4951 if self.msg_id.chars().count() > 35 {
4952 return Err(ValidationError::new(
4953 1002,
4954 "msg_id exceeds the maximum length of 35".to_string(),
4955 ));
4956 }
4957 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4958 if !pattern.is_match(&self.msg_id) {
4959 return Err(ValidationError::new(
4960 1005,
4961 "msg_id does not match the required pattern".to_string(),
4962 ));
4963 }
4964 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
4965 if !pattern.is_match(&self.cre_dt_tm) {
4966 return Err(ValidationError::new(
4967 1005,
4968 "cre_dt_tm does not match the required pattern".to_string(),
4969 ));
4970 }
4971 if let Some(ref val) = self.msg_rcpt {
4972 val.validate()?
4973 }
4974 if let Some(ref val) = self.orgnl_biz_qry {
4975 val.validate()?
4976 }
4977 if let Some(ref val) = self.addtl_inf {
4978 if val.chars().count() < 1 {
4979 return Err(ValidationError::new(
4980 1001,
4981 "addtl_inf is shorter than the minimum length of 1".to_string(),
4982 ));
4983 }
4984 if val.chars().count() > 500 {
4985 return Err(ValidationError::new(
4986 1002,
4987 "addtl_inf exceeds the maximum length of 500".to_string(),
4988 ));
4989 }
4990 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4991 if !pattern.is_match(val) {
4992 return Err(ValidationError::new(
4993 1005,
4994 "addtl_inf does not match the required pattern".to_string(),
4995 ));
4996 }
4997 }
4998 Ok(())
4999 }
5000}
5001
5002#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5004pub struct IdentificationSource3Choice1 {
5005 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5006 pub cd: Option<String>,
5007 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5008 pub prtry: Option<String>,
5009}
5010
5011impl IdentificationSource3Choice1 {
5012 pub fn validate(&self) -> Result<(), ValidationError> {
5013 if let Some(ref val) = self.cd {
5014 if val.chars().count() < 1 {
5015 return Err(ValidationError::new(
5016 1001,
5017 "cd is shorter than the minimum length of 1".to_string(),
5018 ));
5019 }
5020 if val.chars().count() > 4 {
5021 return Err(ValidationError::new(
5022 1002,
5023 "cd exceeds the maximum length of 4".to_string(),
5024 ));
5025 }
5026 }
5027 if let Some(ref val) = self.prtry {
5028 if val.chars().count() < 1 {
5029 return Err(ValidationError::new(
5030 1001,
5031 "prtry is shorter than the minimum length of 1".to_string(),
5032 ));
5033 }
5034 if val.chars().count() > 35 {
5035 return Err(ValidationError::new(
5036 1002,
5037 "prtry exceeds the maximum length of 35".to_string(),
5038 ));
5039 }
5040 let pattern = Regex::new(
5041 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5042 )
5043 .unwrap();
5044 if !pattern.is_match(val) {
5045 return Err(ValidationError::new(
5046 1005,
5047 "prtry does not match the required pattern".to_string(),
5048 ));
5049 }
5050 }
5051 Ok(())
5052 }
5053}
5054
5055#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5057pub struct ImpliedCurrencyAmountRange1Choice {
5058 #[serde(rename = "FrAmt", skip_serializing_if = "Option::is_none")]
5059 pub fr_amt: Option<AmountRangeBoundary1>,
5060 #[serde(rename = "ToAmt", skip_serializing_if = "Option::is_none")]
5061 pub to_amt: Option<AmountRangeBoundary1>,
5062 #[serde(rename = "FrToAmt", skip_serializing_if = "Option::is_none")]
5063 pub fr_to_amt: Option<FromToAmountRange1>,
5064 #[serde(rename = "EQAmt", skip_serializing_if = "Option::is_none")]
5065 pub eq_amt: Option<f64>,
5066 #[serde(rename = "NEQAmt", skip_serializing_if = "Option::is_none")]
5067 pub neq_amt: Option<f64>,
5068}
5069
5070impl ImpliedCurrencyAmountRange1Choice {
5071 pub fn validate(&self) -> Result<(), ValidationError> {
5072 if let Some(ref val) = self.fr_amt {
5073 val.validate()?
5074 }
5075 if let Some(ref val) = self.to_amt {
5076 val.validate()?
5077 }
5078 if let Some(ref val) = self.fr_to_amt {
5079 val.validate()?
5080 }
5081 if let Some(ref val) = self.eq_amt {
5082 if *val < 0.000000 {
5083 return Err(ValidationError::new(
5084 1003,
5085 "eq_amt is less than the minimum value of 0.000000".to_string(),
5086 ));
5087 }
5088 }
5089 if let Some(ref val) = self.neq_amt {
5090 if *val < 0.000000 {
5091 return Err(ValidationError::new(
5092 1003,
5093 "neq_amt is less than the minimum value of 0.000000".to_string(),
5094 ));
5095 }
5096 }
5097 Ok(())
5098 }
5099}
5100
5101#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5103pub struct InterestRecord21 {
5104 #[serde(rename = "Amt")]
5105 pub amt: ActiveOrHistoricCurrencyAndAmount,
5106 #[serde(rename = "CdtDbtInd")]
5107 pub cdt_dbt_ind: CreditDebitCode,
5108 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5109 pub tp: Option<InterestType1Choice1>,
5110 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
5111 pub rate: Option<Rate41>,
5112 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5113 pub fr_to_dt: Option<DateTimePeriod11>,
5114 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
5115 pub rsn: Option<String>,
5116 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
5117 pub tax: Option<TaxCharges21>,
5118}
5119
5120impl InterestRecord21 {
5121 pub fn validate(&self) -> Result<(), ValidationError> {
5122 self.amt.validate()?;
5123 self.cdt_dbt_ind.validate()?;
5124 if let Some(ref val) = self.tp {
5125 val.validate()?
5126 }
5127 if let Some(ref val) = self.rate {
5128 val.validate()?
5129 }
5130 if let Some(ref val) = self.fr_to_dt {
5131 val.validate()?
5132 }
5133 if let Some(ref val) = self.rsn {
5134 if val.chars().count() < 1 {
5135 return Err(ValidationError::new(
5136 1001,
5137 "rsn is shorter than the minimum length of 1".to_string(),
5138 ));
5139 }
5140 if val.chars().count() > 35 {
5141 return Err(ValidationError::new(
5142 1002,
5143 "rsn exceeds the maximum length of 35".to_string(),
5144 ));
5145 }
5146 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5147 if !pattern.is_match(val) {
5148 return Err(ValidationError::new(
5149 1005,
5150 "rsn does not match the required pattern".to_string(),
5151 ));
5152 }
5153 }
5154 if let Some(ref val) = self.tax {
5155 val.validate()?
5156 }
5157 Ok(())
5158 }
5159}
5160
5161#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5163pub struct InterestType1Choice1 {
5164 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5165 pub cd: Option<InterestType1Code>,
5166 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5167 pub prtry: Option<String>,
5168}
5169
5170impl InterestType1Choice1 {
5171 pub fn validate(&self) -> Result<(), ValidationError> {
5172 if let Some(ref val) = self.cd {
5173 val.validate()?
5174 }
5175 if let Some(ref val) = self.prtry {
5176 if val.chars().count() < 1 {
5177 return Err(ValidationError::new(
5178 1001,
5179 "prtry is shorter than the minimum length of 1".to_string(),
5180 ));
5181 }
5182 if val.chars().count() > 35 {
5183 return Err(ValidationError::new(
5184 1002,
5185 "prtry exceeds the maximum length of 35".to_string(),
5186 ));
5187 }
5188 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5189 if !pattern.is_match(val) {
5190 return Err(ValidationError::new(
5191 1005,
5192 "prtry does not match the required pattern".to_string(),
5193 ));
5194 }
5195 }
5196 Ok(())
5197 }
5198}
5199
5200#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5202pub enum InterestType1Code {
5203 #[default]
5204 #[serde(rename = "INDY")]
5205 CodeINDY,
5206 #[serde(rename = "OVRN")]
5207 CodeOVRN,
5208}
5209
5210impl InterestType1Code {
5211 pub fn validate(&self) -> Result<(), ValidationError> {
5212 Ok(())
5213 }
5214}
5215
5216#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5218pub struct LocalInstrument2Choice1 {
5219 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5220 pub cd: Option<String>,
5221 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5222 pub prtry: Option<String>,
5223}
5224
5225impl LocalInstrument2Choice1 {
5226 pub fn validate(&self) -> Result<(), ValidationError> {
5227 if let Some(ref val) = self.cd {
5228 if val.chars().count() < 1 {
5229 return Err(ValidationError::new(
5230 1001,
5231 "cd is shorter than the minimum length of 1".to_string(),
5232 ));
5233 }
5234 if val.chars().count() > 35 {
5235 return Err(ValidationError::new(
5236 1002,
5237 "cd exceeds the maximum length of 35".to_string(),
5238 ));
5239 }
5240 }
5241 if let Some(ref val) = self.prtry {
5242 if val.chars().count() < 1 {
5243 return Err(ValidationError::new(
5244 1001,
5245 "prtry is shorter than the minimum length of 1".to_string(),
5246 ));
5247 }
5248 if val.chars().count() > 35 {
5249 return Err(ValidationError::new(
5250 1002,
5251 "prtry exceeds the maximum length of 35".to_string(),
5252 ));
5253 }
5254 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5255 if !pattern.is_match(val) {
5256 return Err(ValidationError::new(
5257 1005,
5258 "prtry does not match the required pattern".to_string(),
5259 ));
5260 }
5261 }
5262 Ok(())
5263 }
5264}
5265
5266#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5268pub struct MessageIdentification21 {
5269 #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5270 pub msg_nm_id: Option<String>,
5271 #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
5272 pub msg_id: Option<String>,
5273}
5274
5275impl MessageIdentification21 {
5276 pub fn validate(&self) -> Result<(), ValidationError> {
5277 if let Some(ref val) = self.msg_nm_id {
5278 if val.chars().count() < 1 {
5279 return Err(ValidationError::new(
5280 1001,
5281 "msg_nm_id is shorter than the minimum length of 1".to_string(),
5282 ));
5283 }
5284 if val.chars().count() > 35 {
5285 return Err(ValidationError::new(
5286 1002,
5287 "msg_nm_id exceeds the maximum length of 35".to_string(),
5288 ));
5289 }
5290 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5291 if !pattern.is_match(val) {
5292 return Err(ValidationError::new(
5293 1005,
5294 "msg_nm_id does not match the required pattern".to_string(),
5295 ));
5296 }
5297 }
5298 if let Some(ref val) = self.msg_id {
5299 if val.chars().count() < 1 {
5300 return Err(ValidationError::new(
5301 1001,
5302 "msg_id is shorter than the minimum length of 1".to_string(),
5303 ));
5304 }
5305 if val.chars().count() > 35 {
5306 return Err(ValidationError::new(
5307 1002,
5308 "msg_id exceeds the maximum length of 35".to_string(),
5309 ));
5310 }
5311 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5312 if !pattern.is_match(val) {
5313 return Err(ValidationError::new(
5314 1005,
5315 "msg_id does not match the required pattern".to_string(),
5316 ));
5317 }
5318 }
5319 Ok(())
5320 }
5321}
5322
5323#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5325pub struct NameAndAddress161 {
5326 #[serde(rename = "Nm")]
5327 pub nm: String,
5328 #[serde(rename = "Adr")]
5329 pub adr: PostalAddress241,
5330}
5331
5332impl NameAndAddress161 {
5333 pub fn validate(&self) -> Result<(), ValidationError> {
5334 if self.nm.chars().count() < 1 {
5335 return Err(ValidationError::new(
5336 1001,
5337 "nm is shorter than the minimum length of 1".to_string(),
5338 ));
5339 }
5340 if self.nm.chars().count() > 140 {
5341 return Err(ValidationError::new(
5342 1002,
5343 "nm exceeds the maximum length of 140".to_string(),
5344 ));
5345 }
5346 let pattern =
5347 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
5348 .unwrap();
5349 if !pattern.is_match(&self.nm) {
5350 return Err(ValidationError::new(
5351 1005,
5352 "nm does not match the required pattern".to_string(),
5353 ));
5354 }
5355 self.adr.validate()?;
5356 Ok(())
5357 }
5358}
5359
5360#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5362pub struct NumberAndSumOfTransactions1 {
5363 #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5364 pub nb_of_ntries: Option<String>,
5365 #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5366 pub sum: Option<f64>,
5367}
5368
5369impl NumberAndSumOfTransactions1 {
5370 pub fn validate(&self) -> Result<(), ValidationError> {
5371 if let Some(ref val) = self.nb_of_ntries {
5372 let pattern = Regex::new("[0-9]{1,15}").unwrap();
5373 if !pattern.is_match(val) {
5374 return Err(ValidationError::new(
5375 1005,
5376 "nb_of_ntries does not match the required pattern".to_string(),
5377 ));
5378 }
5379 }
5380 Ok(())
5381 }
5382}
5383
5384#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5386pub struct NumberAndSumOfTransactions4 {
5387 #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
5388 pub nb_of_ntries: Option<String>,
5389 #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
5390 pub sum: Option<f64>,
5391 #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
5392 pub ttl_net_ntry: Option<AmountAndDirection35>,
5393}
5394
5395impl NumberAndSumOfTransactions4 {
5396 pub fn validate(&self) -> Result<(), ValidationError> {
5397 if let Some(ref val) = self.nb_of_ntries {
5398 let pattern = Regex::new("[0-9]{1,15}").unwrap();
5399 if !pattern.is_match(val) {
5400 return Err(ValidationError::new(
5401 1005,
5402 "nb_of_ntries does not match the required pattern".to_string(),
5403 ));
5404 }
5405 }
5406 if let Some(ref val) = self.ttl_net_ntry {
5407 val.validate()?
5408 }
5409 Ok(())
5410 }
5411}
5412
5413#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5415pub enum OnLineCapability1Code {
5416 #[default]
5417 #[serde(rename = "OFLN")]
5418 CodeOFLN,
5419 #[serde(rename = "ONLN")]
5420 CodeONLN,
5421 #[serde(rename = "SMON")]
5422 CodeSMON,
5423}
5424
5425impl OnLineCapability1Code {
5426 pub fn validate(&self) -> Result<(), ValidationError> {
5427 Ok(())
5428 }
5429}
5430
5431#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5433pub struct OrganisationIdentification291 {
5434 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5435 pub any_bic: Option<String>,
5436 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5437 pub lei: Option<String>,
5438 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5439 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
5440}
5441
5442impl OrganisationIdentification291 {
5443 pub fn validate(&self) -> Result<(), ValidationError> {
5444 if let Some(ref val) = self.any_bic {
5445 let pattern =
5446 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
5447 if !pattern.is_match(val) {
5448 return Err(ValidationError::new(
5449 1005,
5450 "any_bic does not match the required pattern".to_string(),
5451 ));
5452 }
5453 }
5454 if let Some(ref val) = self.lei {
5455 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
5456 if !pattern.is_match(val) {
5457 return Err(ValidationError::new(
5458 1005,
5459 "lei does not match the required pattern".to_string(),
5460 ));
5461 }
5462 }
5463 if let Some(ref vec) = self.othr {
5464 for item in vec {
5465 item.validate()?
5466 }
5467 }
5468 Ok(())
5469 }
5470}
5471
5472#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5474pub struct OrganisationIdentification292 {
5475 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
5476 pub any_bic: Option<String>,
5477 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
5478 pub lei: Option<String>,
5479 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
5480 pub othr: Option<Vec<GenericOrganisationIdentification12>>,
5481}
5482
5483impl OrganisationIdentification292 {
5484 pub fn validate(&self) -> Result<(), ValidationError> {
5485 if let Some(ref val) = self.any_bic {
5486 let pattern =
5487 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
5488 if !pattern.is_match(val) {
5489 return Err(ValidationError::new(
5490 1005,
5491 "any_bic does not match the required pattern".to_string(),
5492 ));
5493 }
5494 }
5495 if let Some(ref val) = self.lei {
5496 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
5497 if !pattern.is_match(val) {
5498 return Err(ValidationError::new(
5499 1005,
5500 "lei does not match the required pattern".to_string(),
5501 ));
5502 }
5503 }
5504 if let Some(ref vec) = self.othr {
5505 for item in vec {
5506 item.validate()?
5507 }
5508 }
5509 Ok(())
5510 }
5511}
5512
5513#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5515pub struct OrganisationIdentificationSchemeName1Choice1 {
5516 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5517 pub cd: Option<String>,
5518 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5519 pub prtry: Option<String>,
5520}
5521
5522impl OrganisationIdentificationSchemeName1Choice1 {
5523 pub fn validate(&self) -> Result<(), ValidationError> {
5524 if let Some(ref val) = self.cd {
5525 if val.chars().count() < 1 {
5526 return Err(ValidationError::new(
5527 1001,
5528 "cd is shorter than the minimum length of 1".to_string(),
5529 ));
5530 }
5531 if val.chars().count() > 4 {
5532 return Err(ValidationError::new(
5533 1002,
5534 "cd exceeds the maximum length of 4".to_string(),
5535 ));
5536 }
5537 }
5538 if let Some(ref val) = self.prtry {
5539 if val.chars().count() < 1 {
5540 return Err(ValidationError::new(
5541 1001,
5542 "prtry is shorter than the minimum length of 1".to_string(),
5543 ));
5544 }
5545 if val.chars().count() > 35 {
5546 return Err(ValidationError::new(
5547 1002,
5548 "prtry exceeds the maximum length of 35".to_string(),
5549 ));
5550 }
5551 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5552 if !pattern.is_match(val) {
5553 return Err(ValidationError::new(
5554 1005,
5555 "prtry does not match the required pattern".to_string(),
5556 ));
5557 }
5558 }
5559 Ok(())
5560 }
5561}
5562
5563#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5565pub struct OrganisationIdentificationSchemeName1Choice2 {
5566 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5567 pub cd: Option<String>,
5568 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5569 pub prtry: Option<String>,
5570}
5571
5572impl OrganisationIdentificationSchemeName1Choice2 {
5573 pub fn validate(&self) -> Result<(), ValidationError> {
5574 if let Some(ref val) = self.cd {
5575 if val.chars().count() < 1 {
5576 return Err(ValidationError::new(
5577 1001,
5578 "cd is shorter than the minimum length of 1".to_string(),
5579 ));
5580 }
5581 if val.chars().count() > 4 {
5582 return Err(ValidationError::new(
5583 1002,
5584 "cd exceeds the maximum length of 4".to_string(),
5585 ));
5586 }
5587 }
5588 if let Some(ref val) = self.prtry {
5589 if val.chars().count() < 1 {
5590 return Err(ValidationError::new(
5591 1001,
5592 "prtry is shorter than the minimum length of 1".to_string(),
5593 ));
5594 }
5595 if val.chars().count() > 35 {
5596 return Err(ValidationError::new(
5597 1002,
5598 "prtry exceeds the maximum length of 35".to_string(),
5599 ));
5600 }
5601 let pattern = Regex::new(
5602 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5603 )
5604 .unwrap();
5605 if !pattern.is_match(val) {
5606 return Err(ValidationError::new(
5607 1005,
5608 "prtry does not match the required pattern".to_string(),
5609 ));
5610 }
5611 }
5612 Ok(())
5613 }
5614}
5615
5616#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5618pub struct OriginalAndCurrentQuantities1 {
5619 #[serde(rename = "FaceAmt")]
5620 pub face_amt: f64,
5621 #[serde(rename = "AmtsdVal")]
5622 pub amtsd_val: f64,
5623}
5624
5625impl OriginalAndCurrentQuantities1 {
5626 pub fn validate(&self) -> Result<(), ValidationError> {
5627 Ok(())
5628 }
5629}
5630
5631#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5633pub struct OriginalBusinessQuery11 {
5634 #[serde(rename = "MsgId")]
5635 pub msg_id: String,
5636 #[serde(rename = "MsgNmId", skip_serializing_if = "Option::is_none")]
5637 pub msg_nm_id: Option<String>,
5638 #[serde(rename = "CreDtTm", skip_serializing_if = "Option::is_none")]
5639 pub cre_dt_tm: Option<String>,
5640}
5641
5642impl OriginalBusinessQuery11 {
5643 pub fn validate(&self) -> Result<(), ValidationError> {
5644 if self.msg_id.chars().count() < 1 {
5645 return Err(ValidationError::new(
5646 1001,
5647 "msg_id is shorter than the minimum length of 1".to_string(),
5648 ));
5649 }
5650 if self.msg_id.chars().count() > 35 {
5651 return Err(ValidationError::new(
5652 1002,
5653 "msg_id exceeds the maximum length of 35".to_string(),
5654 ));
5655 }
5656 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5657 if !pattern.is_match(&self.msg_id) {
5658 return Err(ValidationError::new(
5659 1005,
5660 "msg_id does not match the required pattern".to_string(),
5661 ));
5662 }
5663 if let Some(ref val) = self.msg_nm_id {
5664 if val.chars().count() < 1 {
5665 return Err(ValidationError::new(
5666 1001,
5667 "msg_nm_id is shorter than the minimum length of 1".to_string(),
5668 ));
5669 }
5670 if val.chars().count() > 35 {
5671 return Err(ValidationError::new(
5672 1002,
5673 "msg_nm_id exceeds the maximum length of 35".to_string(),
5674 ));
5675 }
5676 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
5677 if !pattern.is_match(val) {
5678 return Err(ValidationError::new(
5679 1005,
5680 "msg_nm_id does not match the required pattern".to_string(),
5681 ));
5682 }
5683 }
5684 if let Some(ref val) = self.cre_dt_tm {
5685 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
5686 if !pattern.is_match(val) {
5687 return Err(ValidationError::new(
5688 1005,
5689 "cre_dt_tm does not match the required pattern".to_string(),
5690 ));
5691 }
5692 }
5693 Ok(())
5694 }
5695}
5696
5697#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5699pub struct OtherIdentification11 {
5700 #[serde(rename = "Id")]
5701 pub id: String,
5702 #[serde(rename = "Sfx", skip_serializing_if = "Option::is_none")]
5703 pub sfx: Option<String>,
5704 #[serde(rename = "Tp")]
5705 pub tp: IdentificationSource3Choice1,
5706}
5707
5708impl OtherIdentification11 {
5709 pub fn validate(&self) -> Result<(), ValidationError> {
5710 if self.id.chars().count() < 1 {
5711 return Err(ValidationError::new(
5712 1001,
5713 "id is shorter than the minimum length of 1".to_string(),
5714 ));
5715 }
5716 if self.id.chars().count() > 35 {
5717 return Err(ValidationError::new(
5718 1002,
5719 "id exceeds the maximum length of 35".to_string(),
5720 ));
5721 }
5722 let pattern =
5723 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
5724 .unwrap();
5725 if !pattern.is_match(&self.id) {
5726 return Err(ValidationError::new(
5727 1005,
5728 "id does not match the required pattern".to_string(),
5729 ));
5730 }
5731 if let Some(ref val) = self.sfx {
5732 if val.chars().count() < 1 {
5733 return Err(ValidationError::new(
5734 1001,
5735 "sfx is shorter than the minimum length of 1".to_string(),
5736 ));
5737 }
5738 if val.chars().count() > 16 {
5739 return Err(ValidationError::new(
5740 1002,
5741 "sfx exceeds the maximum length of 16".to_string(),
5742 ));
5743 }
5744 let pattern = Regex::new(
5745 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5746 )
5747 .unwrap();
5748 if !pattern.is_match(val) {
5749 return Err(ValidationError::new(
5750 1005,
5751 "sfx does not match the required pattern".to_string(),
5752 ));
5753 }
5754 }
5755 self.tp.validate()?;
5756 Ok(())
5757 }
5758}
5759
5760#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5762pub enum POIComponentType1Code {
5763 #[default]
5764 #[serde(rename = "SOFT")]
5765 CodeSOFT,
5766 #[serde(rename = "EMVK")]
5767 CodeEMVK,
5768 #[serde(rename = "EMVO")]
5769 CodeEMVO,
5770 #[serde(rename = "MRIT")]
5771 CodeMRIT,
5772 #[serde(rename = "CHIT")]
5773 CodeCHIT,
5774 #[serde(rename = "SECM")]
5775 CodeSECM,
5776 #[serde(rename = "PEDV")]
5777 CodePEDV,
5778}
5779
5780impl POIComponentType1Code {
5781 pub fn validate(&self) -> Result<(), ValidationError> {
5782 Ok(())
5783 }
5784}
5785
5786#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5788pub struct Pagination1 {
5789 #[serde(rename = "PgNb")]
5790 pub pg_nb: String,
5791 #[serde(rename = "LastPgInd")]
5792 pub last_pg_ind: bool,
5793}
5794
5795impl Pagination1 {
5796 pub fn validate(&self) -> Result<(), ValidationError> {
5797 let pattern = Regex::new("[0-9]{1,5}").unwrap();
5798 if !pattern.is_match(&self.pg_nb) {
5799 return Err(ValidationError::new(
5800 1005,
5801 "pg_nb does not match the required pattern".to_string(),
5802 ));
5803 }
5804 Ok(())
5805 }
5806}
5807
5808#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5810pub struct Party38Choice1 {
5811 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5812 pub org_id: Option<OrganisationIdentification291>,
5813 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5814 pub prvt_id: Option<PersonIdentification131>,
5815}
5816
5817impl Party38Choice1 {
5818 pub fn validate(&self) -> Result<(), ValidationError> {
5819 if let Some(ref val) = self.org_id {
5820 val.validate()?
5821 }
5822 if let Some(ref val) = self.prvt_id {
5823 val.validate()?
5824 }
5825 Ok(())
5826 }
5827}
5828
5829#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5831pub struct Party38Choice2 {
5832 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5833 pub org_id: Option<OrganisationIdentification292>,
5834 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5835 pub prvt_id: Option<PersonIdentification132>,
5836}
5837
5838impl Party38Choice2 {
5839 pub fn validate(&self) -> Result<(), ValidationError> {
5840 if let Some(ref val) = self.org_id {
5841 val.validate()?
5842 }
5843 if let Some(ref val) = self.prvt_id {
5844 val.validate()?
5845 }
5846 Ok(())
5847 }
5848}
5849
5850#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5852pub struct Party38Choice3 {
5853 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
5854 pub org_id: Option<OrganisationIdentification292>,
5855 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
5856 pub prvt_id: Option<PersonIdentification133>,
5857}
5858
5859impl Party38Choice3 {
5860 pub fn validate(&self) -> Result<(), ValidationError> {
5861 if let Some(ref val) = self.org_id {
5862 val.validate()?
5863 }
5864 if let Some(ref val) = self.prvt_id {
5865 val.validate()?
5866 }
5867 Ok(())
5868 }
5869}
5870
5871#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5873pub struct Party40Choice1 {
5874 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5875 pub pty: Option<PartyIdentification1353>,
5876 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5877 pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
5878}
5879
5880impl Party40Choice1 {
5881 pub fn validate(&self) -> Result<(), ValidationError> {
5882 if let Some(ref val) = self.pty {
5883 val.validate()?
5884 }
5885 if let Some(ref val) = self.agt {
5886 val.validate()?
5887 }
5888 Ok(())
5889 }
5890}
5891
5892#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5894pub struct Party40Choice2 {
5895 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5896 pub pty: Option<PartyIdentification1354>,
5897 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5898 pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
5899}
5900
5901impl Party40Choice2 {
5902 pub fn validate(&self) -> Result<(), ValidationError> {
5903 if let Some(ref val) = self.pty {
5904 val.validate()?
5905 }
5906 if let Some(ref val) = self.agt {
5907 val.validate()?
5908 }
5909 Ok(())
5910 }
5911}
5912
5913#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5915pub struct Party40Choice3 {
5916 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
5917 pub pty: Option<PartyIdentification1353>,
5918 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
5919 pub agt: Option<BranchAndFinancialInstitutionIdentification63>,
5920}
5921
5922impl Party40Choice3 {
5923 pub fn validate(&self) -> Result<(), ValidationError> {
5924 if let Some(ref val) = self.pty {
5925 val.validate()?
5926 }
5927 if let Some(ref val) = self.agt {
5928 val.validate()?
5929 }
5930 Ok(())
5931 }
5932}
5933
5934#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5936pub struct PartyIdentification1351 {
5937 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
5938 pub nm: Option<String>,
5939 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
5940 pub pstl_adr: Option<PostalAddress241>,
5941 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
5942 pub id: Option<Party38Choice1>,
5943 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
5944 pub ctct_dtls: Option<Contact41>,
5945}
5946
5947impl PartyIdentification1351 {
5948 pub fn validate(&self) -> Result<(), ValidationError> {
5949 if let Some(ref val) = self.nm {
5950 if val.chars().count() < 1 {
5951 return Err(ValidationError::new(
5952 1001,
5953 "nm is shorter than the minimum length of 1".to_string(),
5954 ));
5955 }
5956 if val.chars().count() > 140 {
5957 return Err(ValidationError::new(
5958 1002,
5959 "nm exceeds the maximum length of 140".to_string(),
5960 ));
5961 }
5962 let pattern = Regex::new(
5963 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5964 )
5965 .unwrap();
5966 if !pattern.is_match(val) {
5967 return Err(ValidationError::new(
5968 1005,
5969 "nm does not match the required pattern".to_string(),
5970 ));
5971 }
5972 }
5973 if let Some(ref val) = self.pstl_adr {
5974 val.validate()?
5975 }
5976 if let Some(ref val) = self.id {
5977 val.validate()?
5978 }
5979 if let Some(ref val) = self.ctct_dtls {
5980 val.validate()?
5981 }
5982 Ok(())
5983 }
5984}
5985
5986#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5988pub struct PartyIdentification1352 {
5989 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
5990 pub nm: Option<String>,
5991 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
5992 pub pstl_adr: Option<PostalAddress241>,
5993 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
5994 pub id: Option<Party38Choice1>,
5995 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
5996 pub ctry_of_res: Option<String>,
5997}
5998
5999impl PartyIdentification1352 {
6000 pub fn validate(&self) -> Result<(), ValidationError> {
6001 if let Some(ref val) = self.nm {
6002 if val.chars().count() < 1 {
6003 return Err(ValidationError::new(
6004 1001,
6005 "nm is shorter than the minimum length of 1".to_string(),
6006 ));
6007 }
6008 if val.chars().count() > 140 {
6009 return Err(ValidationError::new(
6010 1002,
6011 "nm exceeds the maximum length of 140".to_string(),
6012 ));
6013 }
6014 let pattern = Regex::new(
6015 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6016 )
6017 .unwrap();
6018 if !pattern.is_match(val) {
6019 return Err(ValidationError::new(
6020 1005,
6021 "nm does not match the required pattern".to_string(),
6022 ));
6023 }
6024 }
6025 if let Some(ref val) = self.pstl_adr {
6026 val.validate()?
6027 }
6028 if let Some(ref val) = self.id {
6029 val.validate()?
6030 }
6031 if let Some(ref val) = self.ctry_of_res {
6032 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6033 if !pattern.is_match(val) {
6034 return Err(ValidationError::new(
6035 1005,
6036 "ctry_of_res does not match the required pattern".to_string(),
6037 ));
6038 }
6039 }
6040 Ok(())
6041 }
6042}
6043
6044#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6046pub struct PartyIdentification1353 {
6047 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6048 pub nm: Option<String>,
6049 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6050 pub pstl_adr: Option<PostalAddress241>,
6051 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6052 pub id: Option<Party38Choice1>,
6053 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6054 pub ctry_of_res: Option<String>,
6055 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6056 pub ctct_dtls: Option<Contact42>,
6057}
6058
6059impl PartyIdentification1353 {
6060 pub fn validate(&self) -> Result<(), ValidationError> {
6061 if let Some(ref val) = self.nm {
6062 if val.chars().count() < 1 {
6063 return Err(ValidationError::new(
6064 1001,
6065 "nm is shorter than the minimum length of 1".to_string(),
6066 ));
6067 }
6068 if val.chars().count() > 140 {
6069 return Err(ValidationError::new(
6070 1002,
6071 "nm exceeds the maximum length of 140".to_string(),
6072 ));
6073 }
6074 let pattern = Regex::new(
6075 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6076 )
6077 .unwrap();
6078 if !pattern.is_match(val) {
6079 return Err(ValidationError::new(
6080 1005,
6081 "nm does not match the required pattern".to_string(),
6082 ));
6083 }
6084 }
6085 if let Some(ref val) = self.pstl_adr {
6086 val.validate()?
6087 }
6088 if let Some(ref val) = self.id {
6089 val.validate()?
6090 }
6091 if let Some(ref val) = self.ctry_of_res {
6092 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6093 if !pattern.is_match(val) {
6094 return Err(ValidationError::new(
6095 1005,
6096 "ctry_of_res does not match the required pattern".to_string(),
6097 ));
6098 }
6099 }
6100 if let Some(ref val) = self.ctct_dtls {
6101 val.validate()?
6102 }
6103 Ok(())
6104 }
6105}
6106
6107#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6109pub struct PartyIdentification1354 {
6110 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6111 pub nm: Option<String>,
6112 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6113 pub pstl_adr: Option<PostalAddress241>,
6114 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6115 pub id: Option<Party38Choice1>,
6116 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6117 pub ctry_of_res: Option<String>,
6118 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6119 pub ctct_dtls: Option<Contact43>,
6120}
6121
6122impl PartyIdentification1354 {
6123 pub fn validate(&self) -> Result<(), ValidationError> {
6124 if let Some(ref val) = self.nm {
6125 if val.chars().count() < 1 {
6126 return Err(ValidationError::new(
6127 1001,
6128 "nm is shorter than the minimum length of 1".to_string(),
6129 ));
6130 }
6131 if val.chars().count() > 140 {
6132 return Err(ValidationError::new(
6133 1002,
6134 "nm exceeds the maximum length of 140".to_string(),
6135 ));
6136 }
6137 let pattern = Regex::new(
6138 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6139 )
6140 .unwrap();
6141 if !pattern.is_match(val) {
6142 return Err(ValidationError::new(
6143 1005,
6144 "nm does not match the required pattern".to_string(),
6145 ));
6146 }
6147 }
6148 if let Some(ref val) = self.pstl_adr {
6149 val.validate()?
6150 }
6151 if let Some(ref val) = self.id {
6152 val.validate()?
6153 }
6154 if let Some(ref val) = self.ctry_of_res {
6155 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6156 if !pattern.is_match(val) {
6157 return Err(ValidationError::new(
6158 1005,
6159 "ctry_of_res does not match the required pattern".to_string(),
6160 ));
6161 }
6162 }
6163 if let Some(ref val) = self.ctct_dtls {
6164 val.validate()?
6165 }
6166 Ok(())
6167 }
6168}
6169
6170#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6172pub struct PartyIdentification1355 {
6173 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6174 pub nm: Option<String>,
6175 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6176 pub pstl_adr: Option<PostalAddress241>,
6177 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6178 pub id: Option<Party38Choice2>,
6179 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6180 pub ctry_of_res: Option<String>,
6181 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6182 pub ctct_dtls: Option<Contact42>,
6183}
6184
6185impl PartyIdentification1355 {
6186 pub fn validate(&self) -> Result<(), ValidationError> {
6187 if let Some(ref val) = self.nm {
6188 if val.chars().count() < 1 {
6189 return Err(ValidationError::new(
6190 1001,
6191 "nm is shorter than the minimum length of 1".to_string(),
6192 ));
6193 }
6194 if val.chars().count() > 140 {
6195 return Err(ValidationError::new(
6196 1002,
6197 "nm exceeds the maximum length of 140".to_string(),
6198 ));
6199 }
6200 let pattern = Regex::new(
6201 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6202 )
6203 .unwrap();
6204 if !pattern.is_match(val) {
6205 return Err(ValidationError::new(
6206 1005,
6207 "nm does not match the required pattern".to_string(),
6208 ));
6209 }
6210 }
6211 if let Some(ref val) = self.pstl_adr {
6212 val.validate()?
6213 }
6214 if let Some(ref val) = self.id {
6215 val.validate()?
6216 }
6217 if let Some(ref val) = self.ctry_of_res {
6218 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6219 if !pattern.is_match(val) {
6220 return Err(ValidationError::new(
6221 1005,
6222 "ctry_of_res does not match the required pattern".to_string(),
6223 ));
6224 }
6225 }
6226 if let Some(ref val) = self.ctct_dtls {
6227 val.validate()?
6228 }
6229 Ok(())
6230 }
6231}
6232
6233#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6235pub struct PartyIdentification1356 {
6236 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6237 pub nm: Option<String>,
6238 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6239 pub pstl_adr: Option<PostalAddress241>,
6240 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6241 pub id: Option<Party38Choice3>,
6242 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6243 pub ctry_of_res: Option<String>,
6244 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6245 pub ctct_dtls: Option<Contact42>,
6246}
6247
6248impl PartyIdentification1356 {
6249 pub fn validate(&self) -> Result<(), ValidationError> {
6250 if let Some(ref val) = self.nm {
6251 if val.chars().count() < 1 {
6252 return Err(ValidationError::new(
6253 1001,
6254 "nm is shorter than the minimum length of 1".to_string(),
6255 ));
6256 }
6257 if val.chars().count() > 140 {
6258 return Err(ValidationError::new(
6259 1002,
6260 "nm exceeds the maximum length of 140".to_string(),
6261 ));
6262 }
6263 let pattern = Regex::new(
6264 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6265 )
6266 .unwrap();
6267 if !pattern.is_match(val) {
6268 return Err(ValidationError::new(
6269 1005,
6270 "nm does not match the required pattern".to_string(),
6271 ));
6272 }
6273 }
6274 if let Some(ref val) = self.pstl_adr {
6275 val.validate()?
6276 }
6277 if let Some(ref val) = self.id {
6278 val.validate()?
6279 }
6280 if let Some(ref val) = self.ctry_of_res {
6281 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6282 if !pattern.is_match(val) {
6283 return Err(ValidationError::new(
6284 1005,
6285 "ctry_of_res does not match the required pattern".to_string(),
6286 ));
6287 }
6288 }
6289 if let Some(ref val) = self.ctct_dtls {
6290 val.validate()?
6291 }
6292 Ok(())
6293 }
6294}
6295
6296#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6298pub struct PartyIdentification1357 {
6299 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
6300 pub nm: Option<String>,
6301 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
6302 pub pstl_adr: Option<PostalAddress241>,
6303 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
6304 pub id: Option<Party38Choice1>,
6305 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
6306 pub ctry_of_res: Option<String>,
6307 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
6308 pub ctct_dtls: Option<Contact43>,
6309}
6310
6311impl PartyIdentification1357 {
6312 pub fn validate(&self) -> Result<(), ValidationError> {
6313 if let Some(ref val) = self.nm {
6314 if val.chars().count() < 1 {
6315 return Err(ValidationError::new(
6316 1001,
6317 "nm is shorter than the minimum length of 1".to_string(),
6318 ));
6319 }
6320 if val.chars().count() > 140 {
6321 return Err(ValidationError::new(
6322 1002,
6323 "nm exceeds the maximum length of 140".to_string(),
6324 ));
6325 }
6326 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6327 if !pattern.is_match(val) {
6328 return Err(ValidationError::new(
6329 1005,
6330 "nm does not match the required pattern".to_string(),
6331 ));
6332 }
6333 }
6334 if let Some(ref val) = self.pstl_adr {
6335 val.validate()?
6336 }
6337 if let Some(ref val) = self.id {
6338 val.validate()?
6339 }
6340 if let Some(ref val) = self.ctry_of_res {
6341 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6342 if !pattern.is_match(val) {
6343 return Err(ValidationError::new(
6344 1005,
6345 "ctry_of_res does not match the required pattern".to_string(),
6346 ));
6347 }
6348 }
6349 if let Some(ref val) = self.ctct_dtls {
6350 val.validate()?
6351 }
6352 Ok(())
6353 }
6354}
6355
6356#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6358pub enum PartyType3Code {
6359 #[default]
6360 #[serde(rename = "OPOI")]
6361 CodeOPOI,
6362 #[serde(rename = "MERC")]
6363 CodeMERC,
6364 #[serde(rename = "ACCP")]
6365 CodeACCP,
6366 #[serde(rename = "ITAG")]
6367 CodeITAG,
6368 #[serde(rename = "ACQR")]
6369 CodeACQR,
6370 #[serde(rename = "CISS")]
6371 CodeCISS,
6372 #[serde(rename = "DLIS")]
6373 CodeDLIS,
6374}
6375
6376impl PartyType3Code {
6377 pub fn validate(&self) -> Result<(), ValidationError> {
6378 Ok(())
6379 }
6380}
6381
6382#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6384pub enum PartyType4Code {
6385 #[default]
6386 #[serde(rename = "MERC")]
6387 CodeMERC,
6388 #[serde(rename = "ACCP")]
6389 CodeACCP,
6390 #[serde(rename = "ITAG")]
6391 CodeITAG,
6392 #[serde(rename = "ACQR")]
6393 CodeACQR,
6394 #[serde(rename = "CISS")]
6395 CodeCISS,
6396 #[serde(rename = "TAXH")]
6397 CodeTAXH,
6398}
6399
6400impl PartyType4Code {
6401 pub fn validate(&self) -> Result<(), ValidationError> {
6402 Ok(())
6403 }
6404}
6405
6406#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6408pub struct PaymentCard41 {
6409 #[serde(rename = "PlainCardData", skip_serializing_if = "Option::is_none")]
6410 pub plain_card_data: Option<PlainCardData11>,
6411 #[serde(rename = "CardCtryCd", skip_serializing_if = "Option::is_none")]
6412 pub card_ctry_cd: Option<String>,
6413 #[serde(rename = "CardBrnd", skip_serializing_if = "Option::is_none")]
6414 pub card_brnd: Option<GenericIdentification11>,
6415 #[serde(rename = "AddtlCardData", skip_serializing_if = "Option::is_none")]
6416 pub addtl_card_data: Option<String>,
6417}
6418
6419impl PaymentCard41 {
6420 pub fn validate(&self) -> Result<(), ValidationError> {
6421 if let Some(ref val) = self.plain_card_data {
6422 val.validate()?
6423 }
6424 if let Some(ref val) = self.card_ctry_cd {
6425 let pattern = Regex::new("[0-9]{3}").unwrap();
6426 if !pattern.is_match(val) {
6427 return Err(ValidationError::new(
6428 1005,
6429 "card_ctry_cd does not match the required pattern".to_string(),
6430 ));
6431 }
6432 }
6433 if let Some(ref val) = self.card_brnd {
6434 val.validate()?
6435 }
6436 if let Some(ref val) = self.addtl_card_data {
6437 if val.chars().count() < 1 {
6438 return Err(ValidationError::new(
6439 1001,
6440 "addtl_card_data is shorter than the minimum length of 1".to_string(),
6441 ));
6442 }
6443 if val.chars().count() > 70 {
6444 return Err(ValidationError::new(
6445 1002,
6446 "addtl_card_data exceeds the maximum length of 70".to_string(),
6447 ));
6448 }
6449 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6450 if !pattern.is_match(val) {
6451 return Err(ValidationError::new(
6452 1005,
6453 "addtl_card_data does not match the required pattern".to_string(),
6454 ));
6455 }
6456 }
6457 Ok(())
6458 }
6459}
6460
6461#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6463pub struct PaymentContext3 {
6464 #[serde(rename = "CardPres", skip_serializing_if = "Option::is_none")]
6465 pub card_pres: Option<bool>,
6466 #[serde(rename = "CrdhldrPres", skip_serializing_if = "Option::is_none")]
6467 pub crdhldr_pres: Option<bool>,
6468 #[serde(rename = "OnLineCntxt", skip_serializing_if = "Option::is_none")]
6469 pub on_line_cntxt: Option<bool>,
6470 #[serde(rename = "AttndncCntxt", skip_serializing_if = "Option::is_none")]
6471 pub attndnc_cntxt: Option<AttendanceContext1Code>,
6472 #[serde(rename = "TxEnvt", skip_serializing_if = "Option::is_none")]
6473 pub tx_envt: Option<TransactionEnvironment1Code>,
6474 #[serde(rename = "TxChanl", skip_serializing_if = "Option::is_none")]
6475 pub tx_chanl: Option<TransactionChannel1Code>,
6476 #[serde(rename = "AttndntMsgCpbl", skip_serializing_if = "Option::is_none")]
6477 pub attndnt_msg_cpbl: Option<bool>,
6478 #[serde(rename = "AttndntLang", skip_serializing_if = "Option::is_none")]
6479 pub attndnt_lang: Option<String>,
6480 #[serde(rename = "CardDataNtryMd")]
6481 pub card_data_ntry_md: CardDataReading1Code,
6482 #[serde(rename = "FllbckInd", skip_serializing_if = "Option::is_none")]
6483 pub fllbck_ind: Option<bool>,
6484 #[serde(rename = "AuthntcnMtd", skip_serializing_if = "Option::is_none")]
6485 pub authntcn_mtd: Option<CardholderAuthentication2>,
6486}
6487
6488impl PaymentContext3 {
6489 pub fn validate(&self) -> Result<(), ValidationError> {
6490 if let Some(ref val) = self.attndnc_cntxt {
6491 val.validate()?
6492 }
6493 if let Some(ref val) = self.tx_envt {
6494 val.validate()?
6495 }
6496 if let Some(ref val) = self.tx_chanl {
6497 val.validate()?
6498 }
6499 if let Some(ref val) = self.attndnt_lang {
6500 let pattern = Regex::new("[a-z]{2,2}").unwrap();
6501 if !pattern.is_match(val) {
6502 return Err(ValidationError::new(
6503 1005,
6504 "attndnt_lang does not match the required pattern".to_string(),
6505 ));
6506 }
6507 }
6508 self.card_data_ntry_md.validate()?;
6509 if let Some(ref val) = self.authntcn_mtd {
6510 val.validate()?
6511 }
6512 Ok(())
6513 }
6514}
6515
6516#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6518pub struct PaymentReturnReason51 {
6519 #[serde(rename = "OrgnlBkTxCd", skip_serializing_if = "Option::is_none")]
6520 pub orgnl_bk_tx_cd: Option<BankTransactionCodeStructure41>,
6521 #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
6522 pub orgtr: Option<PartyIdentification1357>,
6523 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
6524 pub rsn: Option<ReturnReason5Choice1>,
6525 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
6526 pub addtl_inf: Option<Vec<String>>,
6527}
6528
6529impl PaymentReturnReason51 {
6530 pub fn validate(&self) -> Result<(), ValidationError> {
6531 if let Some(ref val) = self.orgnl_bk_tx_cd {
6532 val.validate()?
6533 }
6534 if let Some(ref val) = self.orgtr {
6535 val.validate()?
6536 }
6537 if let Some(ref val) = self.rsn {
6538 val.validate()?
6539 }
6540 if let Some(ref vec) = self.addtl_inf {
6541 for item in vec {
6542 if item.chars().count() < 1 {
6543 return Err(ValidationError::new(
6544 1001,
6545 "addtl_inf is shorter than the minimum length of 1".to_string(),
6546 ));
6547 }
6548 if item.chars().count() > 105 {
6549 return Err(ValidationError::new(
6550 1002,
6551 "addtl_inf exceeds the maximum length of 105".to_string(),
6552 ));
6553 }
6554 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6555 if !pattern.is_match(&item) {
6556 return Err(ValidationError::new(
6557 1005,
6558 "addtl_inf does not match the required pattern".to_string(),
6559 ));
6560 }
6561 }
6562 }
6563 Ok(())
6564 }
6565}
6566
6567#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6569pub struct PersonIdentification131 {
6570 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6571 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
6572 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6573 pub othr: Option<Vec<GenericPersonIdentification11>>,
6574}
6575
6576impl PersonIdentification131 {
6577 pub fn validate(&self) -> Result<(), ValidationError> {
6578 if let Some(ref val) = self.dt_and_plc_of_birth {
6579 val.validate()?
6580 }
6581 if let Some(ref vec) = self.othr {
6582 for item in vec {
6583 item.validate()?
6584 }
6585 }
6586 Ok(())
6587 }
6588}
6589
6590#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6592pub struct PersonIdentification132 {
6593 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6594 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
6595 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6596 pub othr: Option<Vec<GenericPersonIdentification12>>,
6597}
6598
6599impl PersonIdentification132 {
6600 pub fn validate(&self) -> Result<(), ValidationError> {
6601 if let Some(ref val) = self.dt_and_plc_of_birth {
6602 val.validate()?
6603 }
6604 if let Some(ref vec) = self.othr {
6605 for item in vec {
6606 item.validate()?
6607 }
6608 }
6609 Ok(())
6610 }
6611}
6612
6613#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6615pub struct PersonIdentification133 {
6616 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
6617 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
6618 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
6619 pub othr: Option<Vec<GenericPersonIdentification12>>,
6620}
6621
6622impl PersonIdentification133 {
6623 pub fn validate(&self) -> Result<(), ValidationError> {
6624 if let Some(ref val) = self.dt_and_plc_of_birth {
6625 val.validate()?
6626 }
6627 if let Some(ref vec) = self.othr {
6628 for item in vec {
6629 item.validate()?
6630 }
6631 }
6632 Ok(())
6633 }
6634}
6635
6636#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6638pub struct PersonIdentificationSchemeName1Choice1 {
6639 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6640 pub cd: Option<String>,
6641 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6642 pub prtry: Option<String>,
6643}
6644
6645impl PersonIdentificationSchemeName1Choice1 {
6646 pub fn validate(&self) -> Result<(), ValidationError> {
6647 if let Some(ref val) = self.cd {
6648 if val.chars().count() < 1 {
6649 return Err(ValidationError::new(
6650 1001,
6651 "cd is shorter than the minimum length of 1".to_string(),
6652 ));
6653 }
6654 if val.chars().count() > 4 {
6655 return Err(ValidationError::new(
6656 1002,
6657 "cd exceeds the maximum length of 4".to_string(),
6658 ));
6659 }
6660 }
6661 if let Some(ref val) = self.prtry {
6662 if val.chars().count() < 1 {
6663 return Err(ValidationError::new(
6664 1001,
6665 "prtry is shorter than the minimum length of 1".to_string(),
6666 ));
6667 }
6668 if val.chars().count() > 35 {
6669 return Err(ValidationError::new(
6670 1002,
6671 "prtry exceeds the maximum length of 35".to_string(),
6672 ));
6673 }
6674 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6675 if !pattern.is_match(val) {
6676 return Err(ValidationError::new(
6677 1005,
6678 "prtry does not match the required pattern".to_string(),
6679 ));
6680 }
6681 }
6682 Ok(())
6683 }
6684}
6685
6686#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6688pub struct PersonIdentificationSchemeName1Choice2 {
6689 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6690 pub cd: Option<String>,
6691 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6692 pub prtry: Option<String>,
6693}
6694
6695impl PersonIdentificationSchemeName1Choice2 {
6696 pub fn validate(&self) -> Result<(), ValidationError> {
6697 if let Some(ref val) = self.cd {
6698 if val.chars().count() < 1 {
6699 return Err(ValidationError::new(
6700 1001,
6701 "cd is shorter than the minimum length of 1".to_string(),
6702 ));
6703 }
6704 if val.chars().count() > 4 {
6705 return Err(ValidationError::new(
6706 1002,
6707 "cd exceeds the maximum length of 4".to_string(),
6708 ));
6709 }
6710 }
6711 if let Some(ref val) = self.prtry {
6712 if val.chars().count() < 1 {
6713 return Err(ValidationError::new(
6714 1001,
6715 "prtry is shorter than the minimum length of 1".to_string(),
6716 ));
6717 }
6718 if val.chars().count() > 35 {
6719 return Err(ValidationError::new(
6720 1002,
6721 "prtry exceeds the maximum length of 35".to_string(),
6722 ));
6723 }
6724 let pattern = Regex::new(
6725 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6726 )
6727 .unwrap();
6728 if !pattern.is_match(val) {
6729 return Err(ValidationError::new(
6730 1005,
6731 "prtry does not match the required pattern".to_string(),
6732 ));
6733 }
6734 }
6735 Ok(())
6736 }
6737}
6738
6739#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6741pub struct PlainCardData11 {
6742 #[serde(rename = "PAN")]
6743 pub pan: String,
6744 #[serde(rename = "CardSeqNb", skip_serializing_if = "Option::is_none")]
6745 pub card_seq_nb: Option<String>,
6746 #[serde(rename = "FctvDt", skip_serializing_if = "Option::is_none")]
6747 pub fctv_dt: Option<String>,
6748 #[serde(rename = "XpryDt")]
6749 pub xpry_dt: String,
6750 #[serde(rename = "SvcCd", skip_serializing_if = "Option::is_none")]
6751 pub svc_cd: Option<String>,
6752 #[serde(rename = "TrckData", skip_serializing_if = "Option::is_none")]
6753 pub trck_data: Option<Vec<TrackData11>>,
6754 #[serde(rename = "CardSctyCd", skip_serializing_if = "Option::is_none")]
6755 pub card_scty_cd: Option<CardSecurityInformation1>,
6756}
6757
6758impl PlainCardData11 {
6759 pub fn validate(&self) -> Result<(), ValidationError> {
6760 let pattern = Regex::new("[0-9]{8,28}").unwrap();
6761 if !pattern.is_match(&self.pan) {
6762 return Err(ValidationError::new(
6763 1005,
6764 "pan does not match the required pattern".to_string(),
6765 ));
6766 }
6767 if let Some(ref val) = self.card_seq_nb {
6768 let pattern = Regex::new("[0-9]{2,3}").unwrap();
6769 if !pattern.is_match(val) {
6770 return Err(ValidationError::new(
6771 1005,
6772 "card_seq_nb does not match the required pattern".to_string(),
6773 ));
6774 }
6775 }
6776 if let Some(ref val) = self.svc_cd {
6777 let pattern = Regex::new("[0-9]{3}").unwrap();
6778 if !pattern.is_match(val) {
6779 return Err(ValidationError::new(
6780 1005,
6781 "svc_cd does not match the required pattern".to_string(),
6782 ));
6783 }
6784 }
6785 if let Some(ref vec) = self.trck_data {
6786 for item in vec {
6787 item.validate()?
6788 }
6789 }
6790 if let Some(ref val) = self.card_scty_cd {
6791 val.validate()?
6792 }
6793 Ok(())
6794 }
6795}
6796
6797#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6799pub struct PointOfInteraction11 {
6800 #[serde(rename = "Id")]
6801 pub id: GenericIdentification321,
6802 #[serde(rename = "SysNm", skip_serializing_if = "Option::is_none")]
6803 pub sys_nm: Option<String>,
6804 #[serde(rename = "GrpId", skip_serializing_if = "Option::is_none")]
6805 pub grp_id: Option<String>,
6806 #[serde(rename = "Cpblties", skip_serializing_if = "Option::is_none")]
6807 pub cpblties: Option<PointOfInteractionCapabilities1>,
6808 #[serde(rename = "Cmpnt", skip_serializing_if = "Option::is_none")]
6809 pub cmpnt: Option<Vec<PointOfInteractionComponent11>>,
6810}
6811
6812impl PointOfInteraction11 {
6813 pub fn validate(&self) -> Result<(), ValidationError> {
6814 self.id.validate()?;
6815 if let Some(ref val) = self.sys_nm {
6816 if val.chars().count() < 1 {
6817 return Err(ValidationError::new(
6818 1001,
6819 "sys_nm is shorter than the minimum length of 1".to_string(),
6820 ));
6821 }
6822 if val.chars().count() > 70 {
6823 return Err(ValidationError::new(
6824 1002,
6825 "sys_nm exceeds the maximum length of 70".to_string(),
6826 ));
6827 }
6828 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6829 if !pattern.is_match(val) {
6830 return Err(ValidationError::new(
6831 1005,
6832 "sys_nm does not match the required pattern".to_string(),
6833 ));
6834 }
6835 }
6836 if let Some(ref val) = self.grp_id {
6837 if val.chars().count() < 1 {
6838 return Err(ValidationError::new(
6839 1001,
6840 "grp_id is shorter than the minimum length of 1".to_string(),
6841 ));
6842 }
6843 if val.chars().count() > 35 {
6844 return Err(ValidationError::new(
6845 1002,
6846 "grp_id exceeds the maximum length of 35".to_string(),
6847 ));
6848 }
6849 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6850 if !pattern.is_match(val) {
6851 return Err(ValidationError::new(
6852 1005,
6853 "grp_id does not match the required pattern".to_string(),
6854 ));
6855 }
6856 }
6857 if let Some(ref val) = self.cpblties {
6858 val.validate()?
6859 }
6860 if let Some(ref vec) = self.cmpnt {
6861 for item in vec {
6862 item.validate()?
6863 }
6864 }
6865 Ok(())
6866 }
6867}
6868
6869#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6871pub struct PointOfInteractionCapabilities1 {
6872 #[serde(rename = "CardRdngCpblties", skip_serializing_if = "Option::is_none")]
6873 pub card_rdng_cpblties: Option<Vec<CardDataReading1Code>>,
6874 #[serde(
6875 rename = "CrdhldrVrfctnCpblties",
6876 skip_serializing_if = "Option::is_none"
6877 )]
6878 pub crdhldr_vrfctn_cpblties: Option<Vec<CardholderVerificationCapability1Code>>,
6879 #[serde(rename = "OnLineCpblties", skip_serializing_if = "Option::is_none")]
6880 pub on_line_cpblties: Option<OnLineCapability1Code>,
6881 #[serde(rename = "DispCpblties", skip_serializing_if = "Option::is_none")]
6882 pub disp_cpblties: Option<Vec<DisplayCapabilities1>>,
6883 #[serde(rename = "PrtLineWidth", skip_serializing_if = "Option::is_none")]
6884 pub prt_line_width: Option<String>,
6885}
6886
6887impl PointOfInteractionCapabilities1 {
6888 pub fn validate(&self) -> Result<(), ValidationError> {
6889 if let Some(ref vec) = self.card_rdng_cpblties {
6890 for item in vec {
6891 item.validate()?
6892 }
6893 }
6894 if let Some(ref vec) = self.crdhldr_vrfctn_cpblties {
6895 for item in vec {
6896 item.validate()?
6897 }
6898 }
6899 if let Some(ref val) = self.on_line_cpblties {
6900 val.validate()?
6901 }
6902 if let Some(ref vec) = self.disp_cpblties {
6903 for item in vec {
6904 item.validate()?
6905 }
6906 }
6907 if let Some(ref val) = self.prt_line_width {
6908 let pattern = Regex::new("[0-9]{1,3}").unwrap();
6909 if !pattern.is_match(val) {
6910 return Err(ValidationError::new(
6911 1005,
6912 "prt_line_width does not match the required pattern".to_string(),
6913 ));
6914 }
6915 }
6916 Ok(())
6917 }
6918}
6919
6920#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6923pub struct PointOfInteractionComponent11 {
6924 #[serde(rename = "POICmpntTp")]
6925 pub poi_cmpnt_tp: POIComponentType1Code,
6926 #[serde(rename = "ManfctrId", skip_serializing_if = "Option::is_none")]
6927 pub manfctr_id: Option<String>,
6928 #[serde(rename = "Mdl", skip_serializing_if = "Option::is_none")]
6929 pub mdl: Option<String>,
6930 #[serde(rename = "VrsnNb", skip_serializing_if = "Option::is_none")]
6931 pub vrsn_nb: Option<String>,
6932 #[serde(rename = "SrlNb", skip_serializing_if = "Option::is_none")]
6933 pub srl_nb: Option<String>,
6934 #[serde(rename = "ApprvlNb", skip_serializing_if = "Option::is_none")]
6935 pub apprvl_nb: Option<Vec<String>>,
6936}
6937
6938impl PointOfInteractionComponent11 {
6939 pub fn validate(&self) -> Result<(), ValidationError> {
6940 self.poi_cmpnt_tp.validate()?;
6941 if let Some(ref val) = self.manfctr_id {
6942 if val.chars().count() < 1 {
6943 return Err(ValidationError::new(
6944 1001,
6945 "manfctr_id is shorter than the minimum length of 1".to_string(),
6946 ));
6947 }
6948 if val.chars().count() > 35 {
6949 return Err(ValidationError::new(
6950 1002,
6951 "manfctr_id exceeds the maximum length of 35".to_string(),
6952 ));
6953 }
6954 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6955 if !pattern.is_match(val) {
6956 return Err(ValidationError::new(
6957 1005,
6958 "manfctr_id does not match the required pattern".to_string(),
6959 ));
6960 }
6961 }
6962 if let Some(ref val) = self.mdl {
6963 if val.chars().count() < 1 {
6964 return Err(ValidationError::new(
6965 1001,
6966 "mdl is shorter than the minimum length of 1".to_string(),
6967 ));
6968 }
6969 if val.chars().count() > 35 {
6970 return Err(ValidationError::new(
6971 1002,
6972 "mdl exceeds the maximum length of 35".to_string(),
6973 ));
6974 }
6975 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6976 if !pattern.is_match(val) {
6977 return Err(ValidationError::new(
6978 1005,
6979 "mdl does not match the required pattern".to_string(),
6980 ));
6981 }
6982 }
6983 if let Some(ref val) = self.vrsn_nb {
6984 if val.chars().count() < 1 {
6985 return Err(ValidationError::new(
6986 1001,
6987 "vrsn_nb is shorter than the minimum length of 1".to_string(),
6988 ));
6989 }
6990 if val.chars().count() > 16 {
6991 return Err(ValidationError::new(
6992 1002,
6993 "vrsn_nb exceeds the maximum length of 16".to_string(),
6994 ));
6995 }
6996 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6997 if !pattern.is_match(val) {
6998 return Err(ValidationError::new(
6999 1005,
7000 "vrsn_nb does not match the required pattern".to_string(),
7001 ));
7002 }
7003 }
7004 if let Some(ref val) = self.srl_nb {
7005 if val.chars().count() < 1 {
7006 return Err(ValidationError::new(
7007 1001,
7008 "srl_nb is shorter than the minimum length of 1".to_string(),
7009 ));
7010 }
7011 if val.chars().count() > 35 {
7012 return Err(ValidationError::new(
7013 1002,
7014 "srl_nb exceeds the maximum length of 35".to_string(),
7015 ));
7016 }
7017 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7018 if !pattern.is_match(val) {
7019 return Err(ValidationError::new(
7020 1005,
7021 "srl_nb does not match the required pattern".to_string(),
7022 ));
7023 }
7024 }
7025 if let Some(ref vec) = self.apprvl_nb {
7026 for item in vec {
7027 if item.chars().count() < 1 {
7028 return Err(ValidationError::new(
7029 1001,
7030 "apprvl_nb is shorter than the minimum length of 1".to_string(),
7031 ));
7032 }
7033 if item.chars().count() > 70 {
7034 return Err(ValidationError::new(
7035 1002,
7036 "apprvl_nb exceeds the maximum length of 70".to_string(),
7037 ));
7038 }
7039 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7040 if !pattern.is_match(&item) {
7041 return Err(ValidationError::new(
7042 1005,
7043 "apprvl_nb does not match the required pattern".to_string(),
7044 ));
7045 }
7046 }
7047 }
7048 Ok(())
7049 }
7050}
7051
7052#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7054pub struct PostalAddress241 {
7055 #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
7056 pub adr_tp: Option<AddressType3Choice1>,
7057 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
7058 pub dept: Option<String>,
7059 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
7060 pub sub_dept: Option<String>,
7061 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
7062 pub strt_nm: Option<String>,
7063 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
7064 pub bldg_nb: Option<String>,
7065 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
7066 pub bldg_nm: Option<String>,
7067 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
7068 pub flr: Option<String>,
7069 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
7070 pub pst_bx: Option<String>,
7071 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
7072 pub room: Option<String>,
7073 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
7074 pub pst_cd: Option<String>,
7075 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
7076 pub twn_nm: Option<String>,
7077 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
7078 pub twn_lctn_nm: Option<String>,
7079 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
7080 pub dstrct_nm: Option<String>,
7081 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
7082 pub ctry_sub_dvsn: Option<String>,
7083 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
7084 pub ctry: Option<String>,
7085 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
7086 pub adr_line: Option<Vec<String>>,
7087}
7088
7089impl PostalAddress241 {
7090 pub fn validate(&self) -> Result<(), ValidationError> {
7091 if let Some(ref val) = self.adr_tp {
7092 val.validate()?
7093 }
7094 if let Some(ref val) = self.dept {
7095 if val.chars().count() < 1 {
7096 return Err(ValidationError::new(
7097 1001,
7098 "dept is shorter than the minimum length of 1".to_string(),
7099 ));
7100 }
7101 if val.chars().count() > 70 {
7102 return Err(ValidationError::new(
7103 1002,
7104 "dept exceeds the maximum length of 70".to_string(),
7105 ));
7106 }
7107 let pattern = Regex::new(
7108 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7109 )
7110 .unwrap();
7111 if !pattern.is_match(val) {
7112 return Err(ValidationError::new(
7113 1005,
7114 "dept does not match the required pattern".to_string(),
7115 ));
7116 }
7117 }
7118 if let Some(ref val) = self.sub_dept {
7119 if val.chars().count() < 1 {
7120 return Err(ValidationError::new(
7121 1001,
7122 "sub_dept is shorter than the minimum length of 1".to_string(),
7123 ));
7124 }
7125 if val.chars().count() > 70 {
7126 return Err(ValidationError::new(
7127 1002,
7128 "sub_dept exceeds the maximum length of 70".to_string(),
7129 ));
7130 }
7131 let pattern = Regex::new(
7132 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7133 )
7134 .unwrap();
7135 if !pattern.is_match(val) {
7136 return Err(ValidationError::new(
7137 1005,
7138 "sub_dept does not match the required pattern".to_string(),
7139 ));
7140 }
7141 }
7142 if let Some(ref val) = self.strt_nm {
7143 if val.chars().count() < 1 {
7144 return Err(ValidationError::new(
7145 1001,
7146 "strt_nm is shorter than the minimum length of 1".to_string(),
7147 ));
7148 }
7149 if val.chars().count() > 70 {
7150 return Err(ValidationError::new(
7151 1002,
7152 "strt_nm exceeds the maximum length of 70".to_string(),
7153 ));
7154 }
7155 let pattern = Regex::new(
7156 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7157 )
7158 .unwrap();
7159 if !pattern.is_match(val) {
7160 return Err(ValidationError::new(
7161 1005,
7162 "strt_nm does not match the required pattern".to_string(),
7163 ));
7164 }
7165 }
7166 if let Some(ref val) = self.bldg_nb {
7167 if val.chars().count() < 1 {
7168 return Err(ValidationError::new(
7169 1001,
7170 "bldg_nb is shorter than the minimum length of 1".to_string(),
7171 ));
7172 }
7173 if val.chars().count() > 16 {
7174 return Err(ValidationError::new(
7175 1002,
7176 "bldg_nb exceeds the maximum length of 16".to_string(),
7177 ));
7178 }
7179 let pattern = Regex::new(
7180 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7181 )
7182 .unwrap();
7183 if !pattern.is_match(val) {
7184 return Err(ValidationError::new(
7185 1005,
7186 "bldg_nb does not match the required pattern".to_string(),
7187 ));
7188 }
7189 }
7190 if let Some(ref val) = self.bldg_nm {
7191 if val.chars().count() < 1 {
7192 return Err(ValidationError::new(
7193 1001,
7194 "bldg_nm is shorter than the minimum length of 1".to_string(),
7195 ));
7196 }
7197 if val.chars().count() > 35 {
7198 return Err(ValidationError::new(
7199 1002,
7200 "bldg_nm exceeds the maximum length of 35".to_string(),
7201 ));
7202 }
7203 let pattern = Regex::new(
7204 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7205 )
7206 .unwrap();
7207 if !pattern.is_match(val) {
7208 return Err(ValidationError::new(
7209 1005,
7210 "bldg_nm does not match the required pattern".to_string(),
7211 ));
7212 }
7213 }
7214 if let Some(ref val) = self.flr {
7215 if val.chars().count() < 1 {
7216 return Err(ValidationError::new(
7217 1001,
7218 "flr is shorter than the minimum length of 1".to_string(),
7219 ));
7220 }
7221 if val.chars().count() > 70 {
7222 return Err(ValidationError::new(
7223 1002,
7224 "flr exceeds the maximum length of 70".to_string(),
7225 ));
7226 }
7227 let pattern = Regex::new(
7228 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7229 )
7230 .unwrap();
7231 if !pattern.is_match(val) {
7232 return Err(ValidationError::new(
7233 1005,
7234 "flr does not match the required pattern".to_string(),
7235 ));
7236 }
7237 }
7238 if let Some(ref val) = self.pst_bx {
7239 if val.chars().count() < 1 {
7240 return Err(ValidationError::new(
7241 1001,
7242 "pst_bx is shorter than the minimum length of 1".to_string(),
7243 ));
7244 }
7245 if val.chars().count() > 16 {
7246 return Err(ValidationError::new(
7247 1002,
7248 "pst_bx exceeds the maximum length of 16".to_string(),
7249 ));
7250 }
7251 let pattern = Regex::new(
7252 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7253 )
7254 .unwrap();
7255 if !pattern.is_match(val) {
7256 return Err(ValidationError::new(
7257 1005,
7258 "pst_bx does not match the required pattern".to_string(),
7259 ));
7260 }
7261 }
7262 if let Some(ref val) = self.room {
7263 if val.chars().count() < 1 {
7264 return Err(ValidationError::new(
7265 1001,
7266 "room is shorter than the minimum length of 1".to_string(),
7267 ));
7268 }
7269 if val.chars().count() > 70 {
7270 return Err(ValidationError::new(
7271 1002,
7272 "room exceeds the maximum length of 70".to_string(),
7273 ));
7274 }
7275 let pattern = Regex::new(
7276 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7277 )
7278 .unwrap();
7279 if !pattern.is_match(val) {
7280 return Err(ValidationError::new(
7281 1005,
7282 "room does not match the required pattern".to_string(),
7283 ));
7284 }
7285 }
7286 if let Some(ref val) = self.pst_cd {
7287 if val.chars().count() < 1 {
7288 return Err(ValidationError::new(
7289 1001,
7290 "pst_cd is shorter than the minimum length of 1".to_string(),
7291 ));
7292 }
7293 if val.chars().count() > 16 {
7294 return Err(ValidationError::new(
7295 1002,
7296 "pst_cd exceeds the maximum length of 16".to_string(),
7297 ));
7298 }
7299 let pattern = Regex::new(
7300 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7301 )
7302 .unwrap();
7303 if !pattern.is_match(val) {
7304 return Err(ValidationError::new(
7305 1005,
7306 "pst_cd does not match the required pattern".to_string(),
7307 ));
7308 }
7309 }
7310 if let Some(ref val) = self.twn_nm {
7311 if val.chars().count() < 1 {
7312 return Err(ValidationError::new(
7313 1001,
7314 "twn_nm is shorter than the minimum length of 1".to_string(),
7315 ));
7316 }
7317 if val.chars().count() > 35 {
7318 return Err(ValidationError::new(
7319 1002,
7320 "twn_nm exceeds the maximum length of 35".to_string(),
7321 ));
7322 }
7323 let pattern = Regex::new(
7324 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7325 )
7326 .unwrap();
7327 if !pattern.is_match(val) {
7328 return Err(ValidationError::new(
7329 1005,
7330 "twn_nm does not match the required pattern".to_string(),
7331 ));
7332 }
7333 }
7334 if let Some(ref val) = self.twn_lctn_nm {
7335 if val.chars().count() < 1 {
7336 return Err(ValidationError::new(
7337 1001,
7338 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
7339 ));
7340 }
7341 if val.chars().count() > 35 {
7342 return Err(ValidationError::new(
7343 1002,
7344 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
7345 ));
7346 }
7347 let pattern = Regex::new(
7348 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7349 )
7350 .unwrap();
7351 if !pattern.is_match(val) {
7352 return Err(ValidationError::new(
7353 1005,
7354 "twn_lctn_nm does not match the required pattern".to_string(),
7355 ));
7356 }
7357 }
7358 if let Some(ref val) = self.dstrct_nm {
7359 if val.chars().count() < 1 {
7360 return Err(ValidationError::new(
7361 1001,
7362 "dstrct_nm is shorter than the minimum length of 1".to_string(),
7363 ));
7364 }
7365 if val.chars().count() > 35 {
7366 return Err(ValidationError::new(
7367 1002,
7368 "dstrct_nm exceeds the maximum length of 35".to_string(),
7369 ));
7370 }
7371 let pattern = Regex::new(
7372 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7373 )
7374 .unwrap();
7375 if !pattern.is_match(val) {
7376 return Err(ValidationError::new(
7377 1005,
7378 "dstrct_nm does not match the required pattern".to_string(),
7379 ));
7380 }
7381 }
7382 if let Some(ref val) = self.ctry_sub_dvsn {
7383 if val.chars().count() < 1 {
7384 return Err(ValidationError::new(
7385 1001,
7386 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
7387 ));
7388 }
7389 if val.chars().count() > 35 {
7390 return Err(ValidationError::new(
7391 1002,
7392 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
7393 ));
7394 }
7395 let pattern = Regex::new(
7396 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7397 )
7398 .unwrap();
7399 if !pattern.is_match(val) {
7400 return Err(ValidationError::new(
7401 1005,
7402 "ctry_sub_dvsn does not match the required pattern".to_string(),
7403 ));
7404 }
7405 }
7406 if let Some(ref val) = self.ctry {
7407 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
7408 if !pattern.is_match(val) {
7409 return Err(ValidationError::new(
7410 1005,
7411 "ctry does not match the required pattern".to_string(),
7412 ));
7413 }
7414 }
7415 if let Some(ref vec) = self.adr_line {
7416 for item in vec {
7417 if item.chars().count() < 1 {
7418 return Err(ValidationError::new(
7419 1001,
7420 "adr_line is shorter than the minimum length of 1".to_string(),
7421 ));
7422 }
7423 if item.chars().count() > 70 {
7424 return Err(ValidationError::new(
7425 1002,
7426 "adr_line exceeds the maximum length of 70".to_string(),
7427 ));
7428 }
7429 let pattern = Regex::new(
7430 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7431 )
7432 .unwrap();
7433 if !pattern.is_match(&item) {
7434 return Err(ValidationError::new(
7435 1005,
7436 "adr_line does not match the required pattern".to_string(),
7437 ));
7438 }
7439 }
7440 }
7441 Ok(())
7442 }
7443}
7444
7445#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7447pub struct PostalAddress242 {
7448 #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
7449 pub adr_tp: Option<AddressType3Choice1>,
7450 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
7451 pub dept: Option<String>,
7452 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
7453 pub sub_dept: Option<String>,
7454 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
7455 pub strt_nm: Option<String>,
7456 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
7457 pub bldg_nb: Option<String>,
7458 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
7459 pub bldg_nm: Option<String>,
7460 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
7461 pub flr: Option<String>,
7462 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
7463 pub pst_bx: Option<String>,
7464 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
7465 pub room: Option<String>,
7466 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
7467 pub pst_cd: Option<String>,
7468 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
7469 pub twn_nm: Option<String>,
7470 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
7471 pub twn_lctn_nm: Option<String>,
7472 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
7473 pub dstrct_nm: Option<String>,
7474 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
7475 pub ctry_sub_dvsn: Option<String>,
7476 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
7477 pub ctry: Option<String>,
7478 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
7479 pub adr_line: Option<Vec<String>>,
7480}
7481
7482impl PostalAddress242 {
7483 pub fn validate(&self) -> Result<(), ValidationError> {
7484 if let Some(ref val) = self.adr_tp {
7485 val.validate()?
7486 }
7487 if let Some(ref val) = self.dept {
7488 if val.chars().count() < 1 {
7489 return Err(ValidationError::new(
7490 1001,
7491 "dept is shorter than the minimum length of 1".to_string(),
7492 ));
7493 }
7494 if val.chars().count() > 70 {
7495 return Err(ValidationError::new(
7496 1002,
7497 "dept exceeds the maximum length of 70".to_string(),
7498 ));
7499 }
7500 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7501 if !pattern.is_match(val) {
7502 return Err(ValidationError::new(
7503 1005,
7504 "dept does not match the required pattern".to_string(),
7505 ));
7506 }
7507 }
7508 if let Some(ref val) = self.sub_dept {
7509 if val.chars().count() < 1 {
7510 return Err(ValidationError::new(
7511 1001,
7512 "sub_dept is shorter than the minimum length of 1".to_string(),
7513 ));
7514 }
7515 if val.chars().count() > 70 {
7516 return Err(ValidationError::new(
7517 1002,
7518 "sub_dept exceeds the maximum length of 70".to_string(),
7519 ));
7520 }
7521 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7522 if !pattern.is_match(val) {
7523 return Err(ValidationError::new(
7524 1005,
7525 "sub_dept does not match the required pattern".to_string(),
7526 ));
7527 }
7528 }
7529 if let Some(ref val) = self.strt_nm {
7530 if val.chars().count() < 1 {
7531 return Err(ValidationError::new(
7532 1001,
7533 "strt_nm is shorter than the minimum length of 1".to_string(),
7534 ));
7535 }
7536 if val.chars().count() > 70 {
7537 return Err(ValidationError::new(
7538 1002,
7539 "strt_nm exceeds the maximum length of 70".to_string(),
7540 ));
7541 }
7542 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7543 if !pattern.is_match(val) {
7544 return Err(ValidationError::new(
7545 1005,
7546 "strt_nm does not match the required pattern".to_string(),
7547 ));
7548 }
7549 }
7550 if let Some(ref val) = self.bldg_nb {
7551 if val.chars().count() < 1 {
7552 return Err(ValidationError::new(
7553 1001,
7554 "bldg_nb is shorter than the minimum length of 1".to_string(),
7555 ));
7556 }
7557 if val.chars().count() > 16 {
7558 return Err(ValidationError::new(
7559 1002,
7560 "bldg_nb exceeds the maximum length of 16".to_string(),
7561 ));
7562 }
7563 let pattern = Regex::new(
7564 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7565 )
7566 .unwrap();
7567 if !pattern.is_match(val) {
7568 return Err(ValidationError::new(
7569 1005,
7570 "bldg_nb does not match the required pattern".to_string(),
7571 ));
7572 }
7573 }
7574 if let Some(ref val) = self.bldg_nm {
7575 if val.chars().count() < 1 {
7576 return Err(ValidationError::new(
7577 1001,
7578 "bldg_nm is shorter than the minimum length of 1".to_string(),
7579 ));
7580 }
7581 if val.chars().count() > 35 {
7582 return Err(ValidationError::new(
7583 1002,
7584 "bldg_nm exceeds the maximum length of 35".to_string(),
7585 ));
7586 }
7587 let pattern = Regex::new(
7588 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7589 )
7590 .unwrap();
7591 if !pattern.is_match(val) {
7592 return Err(ValidationError::new(
7593 1005,
7594 "bldg_nm does not match the required pattern".to_string(),
7595 ));
7596 }
7597 }
7598 if let Some(ref val) = self.flr {
7599 if val.chars().count() < 1 {
7600 return Err(ValidationError::new(
7601 1001,
7602 "flr is shorter than the minimum length of 1".to_string(),
7603 ));
7604 }
7605 if val.chars().count() > 70 {
7606 return Err(ValidationError::new(
7607 1002,
7608 "flr exceeds the maximum length of 70".to_string(),
7609 ));
7610 }
7611 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7612 if !pattern.is_match(val) {
7613 return Err(ValidationError::new(
7614 1005,
7615 "flr does not match the required pattern".to_string(),
7616 ));
7617 }
7618 }
7619 if let Some(ref val) = self.pst_bx {
7620 if val.chars().count() < 1 {
7621 return Err(ValidationError::new(
7622 1001,
7623 "pst_bx is shorter than the minimum length of 1".to_string(),
7624 ));
7625 }
7626 if val.chars().count() > 16 {
7627 return Err(ValidationError::new(
7628 1002,
7629 "pst_bx exceeds the maximum length of 16".to_string(),
7630 ));
7631 }
7632 let pattern = Regex::new(
7633 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7634 )
7635 .unwrap();
7636 if !pattern.is_match(val) {
7637 return Err(ValidationError::new(
7638 1005,
7639 "pst_bx does not match the required pattern".to_string(),
7640 ));
7641 }
7642 }
7643 if let Some(ref val) = self.room {
7644 if val.chars().count() < 1 {
7645 return Err(ValidationError::new(
7646 1001,
7647 "room is shorter than the minimum length of 1".to_string(),
7648 ));
7649 }
7650 if val.chars().count() > 70 {
7651 return Err(ValidationError::new(
7652 1002,
7653 "room exceeds the maximum length of 70".to_string(),
7654 ));
7655 }
7656 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7657 if !pattern.is_match(val) {
7658 return Err(ValidationError::new(
7659 1005,
7660 "room does not match the required pattern".to_string(),
7661 ));
7662 }
7663 }
7664 if let Some(ref val) = self.pst_cd {
7665 if val.chars().count() < 1 {
7666 return Err(ValidationError::new(
7667 1001,
7668 "pst_cd is shorter than the minimum length of 1".to_string(),
7669 ));
7670 }
7671 if val.chars().count() > 16 {
7672 return Err(ValidationError::new(
7673 1002,
7674 "pst_cd exceeds the maximum length of 16".to_string(),
7675 ));
7676 }
7677 let pattern = Regex::new(
7678 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7679 )
7680 .unwrap();
7681 if !pattern.is_match(val) {
7682 return Err(ValidationError::new(
7683 1005,
7684 "pst_cd does not match the required pattern".to_string(),
7685 ));
7686 }
7687 }
7688 if let Some(ref val) = self.twn_nm {
7689 if val.chars().count() < 1 {
7690 return Err(ValidationError::new(
7691 1001,
7692 "twn_nm is shorter than the minimum length of 1".to_string(),
7693 ));
7694 }
7695 if val.chars().count() > 35 {
7696 return Err(ValidationError::new(
7697 1002,
7698 "twn_nm exceeds the maximum length of 35".to_string(),
7699 ));
7700 }
7701 let pattern = Regex::new(
7702 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7703 )
7704 .unwrap();
7705 if !pattern.is_match(val) {
7706 return Err(ValidationError::new(
7707 1005,
7708 "twn_nm does not match the required pattern".to_string(),
7709 ));
7710 }
7711 }
7712 if let Some(ref val) = self.twn_lctn_nm {
7713 if val.chars().count() < 1 {
7714 return Err(ValidationError::new(
7715 1001,
7716 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
7717 ));
7718 }
7719 if val.chars().count() > 35 {
7720 return Err(ValidationError::new(
7721 1002,
7722 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
7723 ));
7724 }
7725 let pattern = Regex::new(
7726 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7727 )
7728 .unwrap();
7729 if !pattern.is_match(val) {
7730 return Err(ValidationError::new(
7731 1005,
7732 "twn_lctn_nm does not match the required pattern".to_string(),
7733 ));
7734 }
7735 }
7736 if let Some(ref val) = self.dstrct_nm {
7737 if val.chars().count() < 1 {
7738 return Err(ValidationError::new(
7739 1001,
7740 "dstrct_nm is shorter than the minimum length of 1".to_string(),
7741 ));
7742 }
7743 if val.chars().count() > 35 {
7744 return Err(ValidationError::new(
7745 1002,
7746 "dstrct_nm exceeds the maximum length of 35".to_string(),
7747 ));
7748 }
7749 let pattern = Regex::new(
7750 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7751 )
7752 .unwrap();
7753 if !pattern.is_match(val) {
7754 return Err(ValidationError::new(
7755 1005,
7756 "dstrct_nm does not match the required pattern".to_string(),
7757 ));
7758 }
7759 }
7760 if let Some(ref val) = self.ctry_sub_dvsn {
7761 if val.chars().count() < 1 {
7762 return Err(ValidationError::new(
7763 1001,
7764 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
7765 ));
7766 }
7767 if val.chars().count() > 35 {
7768 return Err(ValidationError::new(
7769 1002,
7770 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
7771 ));
7772 }
7773 let pattern = Regex::new(
7774 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7775 )
7776 .unwrap();
7777 if !pattern.is_match(val) {
7778 return Err(ValidationError::new(
7779 1005,
7780 "ctry_sub_dvsn does not match the required pattern".to_string(),
7781 ));
7782 }
7783 }
7784 if let Some(ref val) = self.ctry {
7785 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
7786 if !pattern.is_match(val) {
7787 return Err(ValidationError::new(
7788 1005,
7789 "ctry does not match the required pattern".to_string(),
7790 ));
7791 }
7792 }
7793 if let Some(ref vec) = self.adr_line {
7794 for item in vec {
7795 if item.chars().count() < 1 {
7796 return Err(ValidationError::new(
7797 1001,
7798 "adr_line is shorter than the minimum length of 1".to_string(),
7799 ));
7800 }
7801 if item.chars().count() > 70 {
7802 return Err(ValidationError::new(
7803 1002,
7804 "adr_line exceeds the maximum length of 70".to_string(),
7805 ));
7806 }
7807 let pattern = Regex::new(
7808 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7809 )
7810 .unwrap();
7811 if !pattern.is_match(&item) {
7812 return Err(ValidationError::new(
7813 1005,
7814 "adr_line does not match the required pattern".to_string(),
7815 ));
7816 }
7817 }
7818 }
7819 Ok(())
7820 }
7821}
7822
7823#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7825pub enum PreferredContactMethod1Code {
7826 #[default]
7827 #[serde(rename = "LETT")]
7828 CodeLETT,
7829 #[serde(rename = "MAIL")]
7830 CodeMAIL,
7831 #[serde(rename = "PHON")]
7832 CodePHON,
7833 #[serde(rename = "FAXX")]
7834 CodeFAXX,
7835 #[serde(rename = "CELL")]
7836 CodeCELL,
7837}
7838
7839impl PreferredContactMethod1Code {
7840 pub fn validate(&self) -> Result<(), ValidationError> {
7841 Ok(())
7842 }
7843}
7844
7845#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7847pub struct Price71 {
7848 #[serde(rename = "Tp")]
7849 pub tp: YieldedOrValueType1Choice,
7850 #[serde(rename = "Val")]
7851 pub val: PriceRateOrAmount3Choice1,
7852}
7853
7854impl Price71 {
7855 pub fn validate(&self) -> Result<(), ValidationError> {
7856 self.tp.validate()?;
7857 self.val.validate()?;
7858 Ok(())
7859 }
7860}
7861
7862#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7864pub struct PriceRateOrAmount3Choice1 {
7865 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
7866 pub rate: Option<f64>,
7867 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
7868 pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
7869}
7870
7871impl PriceRateOrAmount3Choice1 {
7872 pub fn validate(&self) -> Result<(), ValidationError> {
7873 if let Some(ref val) = self.amt {
7874 val.validate()?
7875 }
7876 Ok(())
7877 }
7878}
7879
7880#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7882pub enum PriceValueType1Code {
7883 #[default]
7884 #[serde(rename = "DISC")]
7885 CodeDISC,
7886 #[serde(rename = "PREM")]
7887 CodePREM,
7888 #[serde(rename = "PARV")]
7889 CodePARV,
7890}
7891
7892impl PriceValueType1Code {
7893 pub fn validate(&self) -> Result<(), ValidationError> {
7894 Ok(())
7895 }
7896}
7897
7898#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7900pub struct Product21 {
7901 #[serde(rename = "PdctCd")]
7902 pub pdct_cd: String,
7903 #[serde(rename = "UnitOfMeasr", skip_serializing_if = "Option::is_none")]
7904 pub unit_of_measr: Option<UnitOfMeasure1Code>,
7905 #[serde(rename = "PdctQty", skip_serializing_if = "Option::is_none")]
7906 pub pdct_qty: Option<f64>,
7907 #[serde(rename = "UnitPric", skip_serializing_if = "Option::is_none")]
7908 pub unit_pric: Option<f64>,
7909 #[serde(rename = "PdctAmt", skip_serializing_if = "Option::is_none")]
7910 pub pdct_amt: Option<f64>,
7911 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
7912 pub tax_tp: Option<String>,
7913 #[serde(rename = "AddtlPdctInf", skip_serializing_if = "Option::is_none")]
7914 pub addtl_pdct_inf: Option<String>,
7915}
7916
7917impl Product21 {
7918 pub fn validate(&self) -> Result<(), ValidationError> {
7919 if self.pdct_cd.chars().count() < 1 {
7920 return Err(ValidationError::new(
7921 1001,
7922 "pdct_cd is shorter than the minimum length of 1".to_string(),
7923 ));
7924 }
7925 if self.pdct_cd.chars().count() > 70 {
7926 return Err(ValidationError::new(
7927 1002,
7928 "pdct_cd exceeds the maximum length of 70".to_string(),
7929 ));
7930 }
7931 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7932 if !pattern.is_match(&self.pdct_cd) {
7933 return Err(ValidationError::new(
7934 1005,
7935 "pdct_cd does not match the required pattern".to_string(),
7936 ));
7937 }
7938 if let Some(ref val) = self.unit_of_measr {
7939 val.validate()?
7940 }
7941 if let Some(ref val) = self.tax_tp {
7942 if val.chars().count() < 1 {
7943 return Err(ValidationError::new(
7944 1001,
7945 "tax_tp is shorter than the minimum length of 1".to_string(),
7946 ));
7947 }
7948 if val.chars().count() > 35 {
7949 return Err(ValidationError::new(
7950 1002,
7951 "tax_tp exceeds the maximum length of 35".to_string(),
7952 ));
7953 }
7954 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7955 if !pattern.is_match(val) {
7956 return Err(ValidationError::new(
7957 1005,
7958 "tax_tp does not match the required pattern".to_string(),
7959 ));
7960 }
7961 }
7962 if let Some(ref val) = self.addtl_pdct_inf {
7963 if val.chars().count() < 1 {
7964 return Err(ValidationError::new(
7965 1001,
7966 "addtl_pdct_inf is shorter than the minimum length of 1".to_string(),
7967 ));
7968 }
7969 if val.chars().count() > 35 {
7970 return Err(ValidationError::new(
7971 1002,
7972 "addtl_pdct_inf exceeds the maximum length of 35".to_string(),
7973 ));
7974 }
7975 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
7976 if !pattern.is_match(val) {
7977 return Err(ValidationError::new(
7978 1005,
7979 "addtl_pdct_inf does not match the required pattern".to_string(),
7980 ));
7981 }
7982 }
7983 Ok(())
7984 }
7985}
7986
7987#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7989pub struct ProprietaryAgent41 {
7990 #[serde(rename = "Tp")]
7991 pub tp: String,
7992 #[serde(rename = "Agt")]
7993 pub agt: BranchAndFinancialInstitutionIdentification62,
7994}
7995
7996impl ProprietaryAgent41 {
7997 pub fn validate(&self) -> Result<(), ValidationError> {
7998 if self.tp.chars().count() < 1 {
7999 return Err(ValidationError::new(
8000 1001,
8001 "tp is shorter than the minimum length of 1".to_string(),
8002 ));
8003 }
8004 if self.tp.chars().count() > 35 {
8005 return Err(ValidationError::new(
8006 1002,
8007 "tp exceeds the maximum length of 35".to_string(),
8008 ));
8009 }
8010 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8011 if !pattern.is_match(&self.tp) {
8012 return Err(ValidationError::new(
8013 1005,
8014 "tp does not match the required pattern".to_string(),
8015 ));
8016 }
8017 self.agt.validate()?;
8018 Ok(())
8019 }
8020}
8021
8022#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8024pub struct ProprietaryBankTransactionCodeStructure11 {
8025 #[serde(rename = "Cd")]
8026 pub cd: String,
8027 #[serde(rename = "Issr")]
8028 pub issr: String,
8029}
8030
8031impl ProprietaryBankTransactionCodeStructure11 {
8032 pub fn validate(&self) -> Result<(), ValidationError> {
8033 if self.cd.chars().count() < 1 {
8034 return Err(ValidationError::new(
8035 1001,
8036 "cd is shorter than the minimum length of 1".to_string(),
8037 ));
8038 }
8039 if self.cd.chars().count() > 35 {
8040 return Err(ValidationError::new(
8041 1002,
8042 "cd exceeds the maximum length of 35".to_string(),
8043 ));
8044 }
8045 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8046 if !pattern.is_match(&self.cd) {
8047 return Err(ValidationError::new(
8048 1005,
8049 "cd does not match the required pattern".to_string(),
8050 ));
8051 }
8052 if self.issr.chars().count() < 1 {
8053 return Err(ValidationError::new(
8054 1001,
8055 "issr is shorter than the minimum length of 1".to_string(),
8056 ));
8057 }
8058 if self.issr.chars().count() > 35 {
8059 return Err(ValidationError::new(
8060 1002,
8061 "issr exceeds the maximum length of 35".to_string(),
8062 ));
8063 }
8064 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8065 if !pattern.is_match(&self.issr) {
8066 return Err(ValidationError::new(
8067 1005,
8068 "issr does not match the required pattern".to_string(),
8069 ));
8070 }
8071 Ok(())
8072 }
8073}
8074
8075#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8077pub struct ProprietaryDate31 {
8078 #[serde(rename = "Tp")]
8079 pub tp: String,
8080 #[serde(rename = "Dt")]
8081 pub dt: DateAndDateTime2Choice1,
8082}
8083
8084impl ProprietaryDate31 {
8085 pub fn validate(&self) -> Result<(), ValidationError> {
8086 if self.tp.chars().count() < 1 {
8087 return Err(ValidationError::new(
8088 1001,
8089 "tp is shorter than the minimum length of 1".to_string(),
8090 ));
8091 }
8092 if self.tp.chars().count() > 35 {
8093 return Err(ValidationError::new(
8094 1002,
8095 "tp exceeds the maximum length of 35".to_string(),
8096 ));
8097 }
8098 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8099 if !pattern.is_match(&self.tp) {
8100 return Err(ValidationError::new(
8101 1005,
8102 "tp does not match the required pattern".to_string(),
8103 ));
8104 }
8105 self.dt.validate()?;
8106 Ok(())
8107 }
8108}
8109
8110#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8112pub struct ProprietaryParty51 {
8113 #[serde(rename = "Tp")]
8114 pub tp: String,
8115 #[serde(rename = "Pty")]
8116 pub pty: Party40Choice1,
8117}
8118
8119impl ProprietaryParty51 {
8120 pub fn validate(&self) -> Result<(), ValidationError> {
8121 if self.tp.chars().count() < 1 {
8122 return Err(ValidationError::new(
8123 1001,
8124 "tp is shorter than the minimum length of 1".to_string(),
8125 ));
8126 }
8127 if self.tp.chars().count() > 35 {
8128 return Err(ValidationError::new(
8129 1002,
8130 "tp exceeds the maximum length of 35".to_string(),
8131 ));
8132 }
8133 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8134 if !pattern.is_match(&self.tp) {
8135 return Err(ValidationError::new(
8136 1005,
8137 "tp does not match the required pattern".to_string(),
8138 ));
8139 }
8140 self.pty.validate()?;
8141 Ok(())
8142 }
8143}
8144
8145#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8147pub struct ProprietaryPrice21 {
8148 #[serde(rename = "Tp")]
8149 pub tp: String,
8150 #[serde(rename = "Pric")]
8151 pub pric: ActiveOrHistoricCurrencyAndAmount,
8152}
8153
8154impl ProprietaryPrice21 {
8155 pub fn validate(&self) -> Result<(), ValidationError> {
8156 if self.tp.chars().count() < 1 {
8157 return Err(ValidationError::new(
8158 1001,
8159 "tp is shorter than the minimum length of 1".to_string(),
8160 ));
8161 }
8162 if self.tp.chars().count() > 35 {
8163 return Err(ValidationError::new(
8164 1002,
8165 "tp exceeds the maximum length of 35".to_string(),
8166 ));
8167 }
8168 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8169 if !pattern.is_match(&self.tp) {
8170 return Err(ValidationError::new(
8171 1005,
8172 "tp does not match the required pattern".to_string(),
8173 ));
8174 }
8175 self.pric.validate()?;
8176 Ok(())
8177 }
8178}
8179
8180#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8182pub struct ProprietaryQuantity11 {
8183 #[serde(rename = "Tp")]
8184 pub tp: String,
8185 #[serde(rename = "Qty")]
8186 pub qty: String,
8187}
8188
8189impl ProprietaryQuantity11 {
8190 pub fn validate(&self) -> Result<(), ValidationError> {
8191 if self.tp.chars().count() < 1 {
8192 return Err(ValidationError::new(
8193 1001,
8194 "tp is shorter than the minimum length of 1".to_string(),
8195 ));
8196 }
8197 if self.tp.chars().count() > 35 {
8198 return Err(ValidationError::new(
8199 1002,
8200 "tp exceeds the maximum length of 35".to_string(),
8201 ));
8202 }
8203 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8204 if !pattern.is_match(&self.tp) {
8205 return Err(ValidationError::new(
8206 1005,
8207 "tp does not match the required pattern".to_string(),
8208 ));
8209 }
8210 if self.qty.chars().count() < 1 {
8211 return Err(ValidationError::new(
8212 1001,
8213 "qty is shorter than the minimum length of 1".to_string(),
8214 ));
8215 }
8216 if self.qty.chars().count() > 35 {
8217 return Err(ValidationError::new(
8218 1002,
8219 "qty exceeds the maximum length of 35".to_string(),
8220 ));
8221 }
8222 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8223 if !pattern.is_match(&self.qty) {
8224 return Err(ValidationError::new(
8225 1005,
8226 "qty does not match the required pattern".to_string(),
8227 ));
8228 }
8229 Ok(())
8230 }
8231}
8232
8233#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8235pub struct ProprietaryReference11 {
8236 #[serde(rename = "Tp")]
8237 pub tp: String,
8238 #[serde(rename = "Ref")]
8239 pub ref_attr: String,
8240}
8241
8242impl ProprietaryReference11 {
8243 pub fn validate(&self) -> Result<(), ValidationError> {
8244 if self.tp.chars().count() < 1 {
8245 return Err(ValidationError::new(
8246 1001,
8247 "tp is shorter than the minimum length of 1".to_string(),
8248 ));
8249 }
8250 if self.tp.chars().count() > 35 {
8251 return Err(ValidationError::new(
8252 1002,
8253 "tp exceeds the maximum length of 35".to_string(),
8254 ));
8255 }
8256 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8257 if !pattern.is_match(&self.tp) {
8258 return Err(ValidationError::new(
8259 1005,
8260 "tp does not match the required pattern".to_string(),
8261 ));
8262 }
8263 if self.ref_attr.chars().count() < 1 {
8264 return Err(ValidationError::new(
8265 1001,
8266 "ref_attr is shorter than the minimum length of 1".to_string(),
8267 ));
8268 }
8269 if self.ref_attr.chars().count() > 35 {
8270 return Err(ValidationError::new(
8271 1002,
8272 "ref_attr exceeds the maximum length of 35".to_string(),
8273 ));
8274 }
8275 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8276 if !pattern.is_match(&self.ref_attr) {
8277 return Err(ValidationError::new(
8278 1005,
8279 "ref_attr does not match the required pattern".to_string(),
8280 ));
8281 }
8282 Ok(())
8283 }
8284}
8285
8286#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8288pub struct ProxyAccountIdentification11 {
8289 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
8290 pub tp: Option<ProxyAccountType1Choice1>,
8291 #[serde(rename = "Id")]
8292 pub id: String,
8293}
8294
8295impl ProxyAccountIdentification11 {
8296 pub fn validate(&self) -> Result<(), ValidationError> {
8297 if let Some(ref val) = self.tp {
8298 val.validate()?
8299 }
8300 if self.id.chars().count() < 1 {
8301 return Err(ValidationError::new(
8302 1001,
8303 "id is shorter than the minimum length of 1".to_string(),
8304 ));
8305 }
8306 if self.id.chars().count() > 320 {
8307 return Err(ValidationError::new(
8308 1002,
8309 "id exceeds the maximum length of 320".to_string(),
8310 ));
8311 }
8312 let pattern =
8313 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
8314 .unwrap();
8315 if !pattern.is_match(&self.id) {
8316 return Err(ValidationError::new(
8317 1005,
8318 "id does not match the required pattern".to_string(),
8319 ));
8320 }
8321 Ok(())
8322 }
8323}
8324
8325#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8327pub struct ProxyAccountType1Choice1 {
8328 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8329 pub cd: Option<String>,
8330 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8331 pub prtry: Option<String>,
8332}
8333
8334impl ProxyAccountType1Choice1 {
8335 pub fn validate(&self) -> Result<(), ValidationError> {
8336 if let Some(ref val) = self.cd {
8337 if val.chars().count() < 1 {
8338 return Err(ValidationError::new(
8339 1001,
8340 "cd is shorter than the minimum length of 1".to_string(),
8341 ));
8342 }
8343 if val.chars().count() > 4 {
8344 return Err(ValidationError::new(
8345 1002,
8346 "cd exceeds the maximum length of 4".to_string(),
8347 ));
8348 }
8349 }
8350 if let Some(ref val) = self.prtry {
8351 if val.chars().count() < 1 {
8352 return Err(ValidationError::new(
8353 1001,
8354 "prtry is shorter than the minimum length of 1".to_string(),
8355 ));
8356 }
8357 if val.chars().count() > 35 {
8358 return Err(ValidationError::new(
8359 1002,
8360 "prtry exceeds the maximum length of 35".to_string(),
8361 ));
8362 }
8363 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8364 if !pattern.is_match(val) {
8365 return Err(ValidationError::new(
8366 1005,
8367 "prtry does not match the required pattern".to_string(),
8368 ));
8369 }
8370 }
8371 Ok(())
8372 }
8373}
8374
8375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8377pub struct Purpose2Choice1 {
8378 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8379 pub cd: Option<String>,
8380 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8381 pub prtry: Option<String>,
8382}
8383
8384impl Purpose2Choice1 {
8385 pub fn validate(&self) -> Result<(), ValidationError> {
8386 if let Some(ref val) = self.cd {
8387 if val.chars().count() < 1 {
8388 return Err(ValidationError::new(
8389 1001,
8390 "cd is shorter than the minimum length of 1".to_string(),
8391 ));
8392 }
8393 if val.chars().count() > 4 {
8394 return Err(ValidationError::new(
8395 1002,
8396 "cd exceeds the maximum length of 4".to_string(),
8397 ));
8398 }
8399 }
8400 if let Some(ref val) = self.prtry {
8401 if val.chars().count() < 1 {
8402 return Err(ValidationError::new(
8403 1001,
8404 "prtry is shorter than the minimum length of 1".to_string(),
8405 ));
8406 }
8407 if val.chars().count() > 35 {
8408 return Err(ValidationError::new(
8409 1002,
8410 "prtry exceeds the maximum length of 35".to_string(),
8411 ));
8412 }
8413 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8414 if !pattern.is_match(val) {
8415 return Err(ValidationError::new(
8416 1005,
8417 "prtry does not match the required pattern".to_string(),
8418 ));
8419 }
8420 }
8421 Ok(())
8422 }
8423}
8424
8425#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8427pub struct Rate41 {
8428 #[serde(rename = "Tp")]
8429 pub tp: RateType4Choice1,
8430 #[serde(rename = "VldtyRg", skip_serializing_if = "Option::is_none")]
8431 pub vldty_rg: Option<ActiveOrHistoricCurrencyAndAmountRange2>,
8432}
8433
8434impl Rate41 {
8435 pub fn validate(&self) -> Result<(), ValidationError> {
8436 self.tp.validate()?;
8437 if let Some(ref val) = self.vldty_rg {
8438 val.validate()?
8439 }
8440 Ok(())
8441 }
8442}
8443
8444#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8446pub struct RateType4Choice1 {
8447 #[serde(rename = "Pctg", skip_serializing_if = "Option::is_none")]
8448 pub pctg: Option<f64>,
8449 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
8450 pub othr: Option<String>,
8451}
8452
8453impl RateType4Choice1 {
8454 pub fn validate(&self) -> Result<(), ValidationError> {
8455 if let Some(ref val) = self.othr {
8456 if val.chars().count() < 1 {
8457 return Err(ValidationError::new(
8458 1001,
8459 "othr is shorter than the minimum length of 1".to_string(),
8460 ));
8461 }
8462 if val.chars().count() > 35 {
8463 return Err(ValidationError::new(
8464 1002,
8465 "othr exceeds the maximum length of 35".to_string(),
8466 ));
8467 }
8468 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8469 if !pattern.is_match(val) {
8470 return Err(ValidationError::new(
8471 1005,
8472 "othr does not match the required pattern".to_string(),
8473 ));
8474 }
8475 }
8476 Ok(())
8477 }
8478}
8479
8480#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8482pub struct ReferredDocumentInformation71 {
8483 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
8484 pub tp: Option<ReferredDocumentType41>,
8485 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
8486 pub nb: Option<String>,
8487 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
8488 pub rltd_dt: Option<String>,
8489 #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
8490 pub line_dtls: Option<Vec<DocumentLineInformation11>>,
8491}
8492
8493impl ReferredDocumentInformation71 {
8494 pub fn validate(&self) -> Result<(), ValidationError> {
8495 if let Some(ref val) = self.tp {
8496 val.validate()?
8497 }
8498 if let Some(ref val) = self.nb {
8499 if val.chars().count() < 1 {
8500 return Err(ValidationError::new(
8501 1001,
8502 "nb is shorter than the minimum length of 1".to_string(),
8503 ));
8504 }
8505 if val.chars().count() > 35 {
8506 return Err(ValidationError::new(
8507 1002,
8508 "nb exceeds the maximum length of 35".to_string(),
8509 ));
8510 }
8511 let pattern = Regex::new(
8512 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8513 )
8514 .unwrap();
8515 if !pattern.is_match(val) {
8516 return Err(ValidationError::new(
8517 1005,
8518 "nb does not match the required pattern".to_string(),
8519 ));
8520 }
8521 }
8522 if let Some(ref vec) = self.line_dtls {
8523 for item in vec {
8524 item.validate()?
8525 }
8526 }
8527 Ok(())
8528 }
8529}
8530
8531#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8533pub struct ReferredDocumentType3Choice {
8534 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
8535 pub cd: Option<DocumentType6Code>,
8536 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
8537 pub prtry: Option<String>,
8538}
8539
8540impl ReferredDocumentType3Choice {
8541 pub fn validate(&self) -> Result<(), ValidationError> {
8542 if let Some(ref val) = self.cd {
8543 val.validate()?
8544 }
8545 if let Some(ref val) = self.prtry {
8546 if val.chars().count() < 1 {
8547 return Err(ValidationError::new(
8548 1001,
8549 "prtry is shorter than the minimum length of 1".to_string(),
8550 ));
8551 }
8552 if val.chars().count() > 35 {
8553 return Err(ValidationError::new(
8554 1002,
8555 "prtry exceeds the maximum length of 35".to_string(),
8556 ));
8557 }
8558 }
8559 Ok(())
8560 }
8561}
8562
8563#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8565pub struct ReferredDocumentType41 {
8566 #[serde(rename = "CdOrPrtry")]
8567 pub cd_or_prtry: ReferredDocumentType3Choice,
8568 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
8569 pub issr: Option<String>,
8570}
8571
8572impl ReferredDocumentType41 {
8573 pub fn validate(&self) -> Result<(), ValidationError> {
8574 self.cd_or_prtry.validate()?;
8575 if let Some(ref val) = self.issr {
8576 if val.chars().count() < 1 {
8577 return Err(ValidationError::new(
8578 1001,
8579 "issr is shorter than the minimum length of 1".to_string(),
8580 ));
8581 }
8582 if val.chars().count() > 35 {
8583 return Err(ValidationError::new(
8584 1002,
8585 "issr exceeds the maximum length of 35".to_string(),
8586 ));
8587 }
8588 let pattern = Regex::new(
8589 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8590 )
8591 .unwrap();
8592 if !pattern.is_match(val) {
8593 return Err(ValidationError::new(
8594 1005,
8595 "issr does not match the required pattern".to_string(),
8596 ));
8597 }
8598 }
8599 Ok(())
8600 }
8601}
8602
8603#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8605pub struct RemittanceAmount21 {
8606 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
8607 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8608 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
8609 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
8610 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
8611 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8612 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
8613 pub tax_amt: Option<Vec<TaxAmountAndType1>>,
8614 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
8615 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
8616 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
8617 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8618}
8619
8620impl RemittanceAmount21 {
8621 pub fn validate(&self) -> Result<(), ValidationError> {
8622 if let Some(ref val) = self.due_pybl_amt {
8623 val.validate()?
8624 }
8625 if let Some(ref vec) = self.dscnt_apld_amt {
8626 for item in vec {
8627 item.validate()?
8628 }
8629 }
8630 if let Some(ref val) = self.cdt_note_amt {
8631 val.validate()?
8632 }
8633 if let Some(ref vec) = self.tax_amt {
8634 for item in vec {
8635 item.validate()?
8636 }
8637 }
8638 if let Some(ref vec) = self.adjstmnt_amt_and_rsn {
8639 for item in vec {
8640 item.validate()?
8641 }
8642 }
8643 if let Some(ref val) = self.rmtd_amt {
8644 val.validate()?
8645 }
8646 Ok(())
8647 }
8648}
8649
8650#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8652pub struct RemittanceAmount31 {
8653 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
8654 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8655 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
8656 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
8657 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
8658 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8659 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
8660 pub tax_amt: Option<Vec<TaxAmountAndType11>>,
8661 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
8662 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
8663 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
8664 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
8665}
8666
8667impl RemittanceAmount31 {
8668 pub fn validate(&self) -> Result<(), ValidationError> {
8669 if let Some(ref val) = self.due_pybl_amt {
8670 val.validate()?
8671 }
8672 if let Some(ref vec) = self.dscnt_apld_amt {
8673 for item in vec {
8674 item.validate()?
8675 }
8676 }
8677 if let Some(ref val) = self.cdt_note_amt {
8678 val.validate()?
8679 }
8680 if let Some(ref vec) = self.tax_amt {
8681 for item in vec {
8682 item.validate()?
8683 }
8684 }
8685 if let Some(ref vec) = self.adjstmnt_amt_and_rsn {
8686 for item in vec {
8687 item.validate()?
8688 }
8689 }
8690 if let Some(ref val) = self.rmtd_amt {
8691 val.validate()?
8692 }
8693 Ok(())
8694 }
8695}
8696
8697#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8699pub struct RemittanceInformation161 {
8700 #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
8701 pub ustrd: Option<String>,
8702 #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
8703 pub strd: Option<Vec<StructuredRemittanceInformation161>>,
8704}
8705
8706impl RemittanceInformation161 {
8707 pub fn validate(&self) -> Result<(), ValidationError> {
8708 if let Some(ref val) = self.ustrd {
8709 if val.chars().count() < 1 {
8710 return Err(ValidationError::new(
8711 1001,
8712 "ustrd is shorter than the minimum length of 1".to_string(),
8713 ));
8714 }
8715 if val.chars().count() > 140 {
8716 return Err(ValidationError::new(
8717 1002,
8718 "ustrd exceeds the maximum length of 140".to_string(),
8719 ));
8720 }
8721 let pattern = Regex::new(
8722 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8723 )
8724 .unwrap();
8725 if !pattern.is_match(val) {
8726 return Err(ValidationError::new(
8727 1005,
8728 "ustrd does not match the required pattern".to_string(),
8729 ));
8730 }
8731 }
8732 if let Some(ref vec) = self.strd {
8733 for item in vec {
8734 item.validate()?
8735 }
8736 }
8737 Ok(())
8738 }
8739}
8740
8741#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8743pub struct RemittanceLocation71 {
8744 #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
8745 pub rmt_id: Option<String>,
8746 #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
8747 pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
8748}
8749
8750impl RemittanceLocation71 {
8751 pub fn validate(&self) -> Result<(), ValidationError> {
8752 if let Some(ref val) = self.rmt_id {
8753 if val.chars().count() < 1 {
8754 return Err(ValidationError::new(
8755 1001,
8756 "rmt_id is shorter than the minimum length of 1".to_string(),
8757 ));
8758 }
8759 if val.chars().count() > 35 {
8760 return Err(ValidationError::new(
8761 1002,
8762 "rmt_id exceeds the maximum length of 35".to_string(),
8763 ));
8764 }
8765 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8766 if !pattern.is_match(val) {
8767 return Err(ValidationError::new(
8768 1005,
8769 "rmt_id does not match the required pattern".to_string(),
8770 ));
8771 }
8772 }
8773 if let Some(ref vec) = self.rmt_lctn_dtls {
8774 for item in vec {
8775 item.validate()?
8776 }
8777 }
8778 Ok(())
8779 }
8780}
8781
8782#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8784pub struct RemittanceLocationData11 {
8785 #[serde(rename = "Mtd")]
8786 pub mtd: RemittanceLocationMethod2Code,
8787 #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
8788 pub elctrnc_adr: Option<String>,
8789 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
8790 pub pstl_adr: Option<NameAndAddress161>,
8791}
8792
8793impl RemittanceLocationData11 {
8794 pub fn validate(&self) -> Result<(), ValidationError> {
8795 self.mtd.validate()?;
8796 if let Some(ref val) = self.elctrnc_adr {
8797 if val.chars().count() < 1 {
8798 return Err(ValidationError::new(
8799 1001,
8800 "elctrnc_adr is shorter than the minimum length of 1".to_string(),
8801 ));
8802 }
8803 if val.chars().count() > 2048 {
8804 return Err(ValidationError::new(
8805 1002,
8806 "elctrnc_adr exceeds the maximum length of 2048".to_string(),
8807 ));
8808 }
8809 let pattern = Regex::new(
8810 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
8811 )
8812 .unwrap();
8813 if !pattern.is_match(val) {
8814 return Err(ValidationError::new(
8815 1005,
8816 "elctrnc_adr does not match the required pattern".to_string(),
8817 ));
8818 }
8819 }
8820 if let Some(ref val) = self.pstl_adr {
8821 val.validate()?
8822 }
8823 Ok(())
8824 }
8825}
8826
8827#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8829pub enum RemittanceLocationMethod2Code {
8830 #[default]
8831 #[serde(rename = "FAXI")]
8832 CodeFAXI,
8833 #[serde(rename = "EDIC")]
8834 CodeEDIC,
8835 #[serde(rename = "URID")]
8836 CodeURID,
8837 #[serde(rename = "EMAL")]
8838 CodeEMAL,
8839 #[serde(rename = "POST")]
8840 CodePOST,
8841 #[serde(rename = "SMSM")]
8842 CodeSMSM,
8843}
8844
8845impl RemittanceLocationMethod2Code {
8846 pub fn validate(&self) -> Result<(), ValidationError> {
8847 Ok(())
8848 }
8849}
8850
8851#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
8853pub struct ReportEntry101 {
8854 #[serde(rename = "NtryRef", skip_serializing_if = "Option::is_none")]
8855 pub ntry_ref: Option<String>,
8856 #[serde(rename = "Amt")]
8857 pub amt: ActiveOrHistoricCurrencyAndAmount,
8858 #[serde(rename = "CdtDbtInd")]
8859 pub cdt_dbt_ind: CreditDebitCode,
8860 #[serde(rename = "RvslInd", skip_serializing_if = "Option::is_none")]
8861 pub rvsl_ind: Option<bool>,
8862 #[serde(rename = "Sts")]
8863 pub sts: EntryStatus1Choice1,
8864 #[serde(rename = "BookgDt", skip_serializing_if = "Option::is_none")]
8865 pub bookg_dt: Option<DateAndDateTime2Choice1>,
8866 #[serde(rename = "ValDt")]
8867 pub val_dt: DateAndDateTime2Choice1,
8868 #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
8869 pub acct_svcr_ref: Option<String>,
8870 #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
8871 pub avlbty: Option<Vec<CashAvailability1>>,
8872 #[serde(rename = "BkTxCd")]
8873 pub bk_tx_cd: BankTransactionCodeStructure41,
8874 #[serde(rename = "ComssnWvrInd", skip_serializing_if = "Option::is_none")]
8875 pub comssn_wvr_ind: Option<bool>,
8876 #[serde(rename = "AddtlInfInd", skip_serializing_if = "Option::is_none")]
8877 pub addtl_inf_ind: Option<MessageIdentification21>,
8878 #[serde(rename = "AmtDtls", skip_serializing_if = "Option::is_none")]
8879 pub amt_dtls: Option<AmountAndCurrencyExchange31>,
8880 #[serde(rename = "Chrgs", skip_serializing_if = "Option::is_none")]
8881 pub chrgs: Option<Charges61>,
8882 #[serde(rename = "TechInptChanl", skip_serializing_if = "Option::is_none")]
8883 pub tech_inpt_chanl: Option<TechnicalInputChannel1Choice1>,
8884 #[serde(rename = "Intrst", skip_serializing_if = "Option::is_none")]
8885 pub intrst: Option<TransactionInterest41>,
8886 #[serde(rename = "CardTx", skip_serializing_if = "Option::is_none")]
8887 pub card_tx: Option<CardEntry41>,
8888 #[serde(rename = "NtryDtls", skip_serializing_if = "Option::is_none")]
8889 pub ntry_dtls: Option<Vec<EntryDetails91>>,
8890 #[serde(rename = "AddtlNtryInf", skip_serializing_if = "Option::is_none")]
8891 pub addtl_ntry_inf: Option<String>,
8892}
8893
8894impl ReportEntry101 {
8895 pub fn validate(&self) -> Result<(), ValidationError> {
8896 if let Some(ref val) = self.ntry_ref {
8897 if val.chars().count() < 1 {
8898 return Err(ValidationError::new(
8899 1001,
8900 "ntry_ref is shorter than the minimum length of 1".to_string(),
8901 ));
8902 }
8903 if val.chars().count() > 35 {
8904 return Err(ValidationError::new(
8905 1002,
8906 "ntry_ref exceeds the maximum length of 35".to_string(),
8907 ));
8908 }
8909 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8910 if !pattern.is_match(val) {
8911 return Err(ValidationError::new(
8912 1005,
8913 "ntry_ref does not match the required pattern".to_string(),
8914 ));
8915 }
8916 }
8917 self.amt.validate()?;
8918 self.cdt_dbt_ind.validate()?;
8919 self.sts.validate()?;
8920 if let Some(ref val) = self.bookg_dt {
8921 val.validate()?
8922 }
8923 self.val_dt.validate()?;
8924 if let Some(ref val) = self.acct_svcr_ref {
8925 if val.chars().count() < 1 {
8926 return Err(ValidationError::new(
8927 1001,
8928 "acct_svcr_ref is shorter than the minimum length of 1".to_string(),
8929 ));
8930 }
8931 if val.chars().count() > 35 {
8932 return Err(ValidationError::new(
8933 1002,
8934 "acct_svcr_ref exceeds the maximum length of 35".to_string(),
8935 ));
8936 }
8937 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8938 if !pattern.is_match(val) {
8939 return Err(ValidationError::new(
8940 1005,
8941 "acct_svcr_ref does not match the required pattern".to_string(),
8942 ));
8943 }
8944 }
8945 if let Some(ref vec) = self.avlbty {
8946 for item in vec {
8947 item.validate()?
8948 }
8949 }
8950 self.bk_tx_cd.validate()?;
8951 if let Some(ref val) = self.addtl_inf_ind {
8952 val.validate()?
8953 }
8954 if let Some(ref val) = self.amt_dtls {
8955 val.validate()?
8956 }
8957 if let Some(ref val) = self.chrgs {
8958 val.validate()?
8959 }
8960 if let Some(ref val) = self.tech_inpt_chanl {
8961 val.validate()?
8962 }
8963 if let Some(ref val) = self.intrst {
8964 val.validate()?
8965 }
8966 if let Some(ref val) = self.card_tx {
8967 val.validate()?
8968 }
8969 if let Some(ref vec) = self.ntry_dtls {
8970 for item in vec {
8971 item.validate()?
8972 }
8973 }
8974 if let Some(ref val) = self.addtl_ntry_inf {
8975 if val.chars().count() < 1 {
8976 return Err(ValidationError::new(
8977 1001,
8978 "addtl_ntry_inf is shorter than the minimum length of 1".to_string(),
8979 ));
8980 }
8981 if val.chars().count() > 500 {
8982 return Err(ValidationError::new(
8983 1002,
8984 "addtl_ntry_inf exceeds the maximum length of 500".to_string(),
8985 ));
8986 }
8987 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
8988 if !pattern.is_match(val) {
8989 return Err(ValidationError::new(
8990 1005,
8991 "addtl_ntry_inf does not match the required pattern".to_string(),
8992 ));
8993 }
8994 }
8995 Ok(())
8996 }
8997}
8998
8999#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9001pub struct ReportingSource1Choice1 {
9002 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9003 pub cd: Option<String>,
9004 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9005 pub prtry: Option<String>,
9006}
9007
9008impl ReportingSource1Choice1 {
9009 pub fn validate(&self) -> Result<(), ValidationError> {
9010 if let Some(ref val) = self.cd {
9011 if val.chars().count() < 1 {
9012 return Err(ValidationError::new(
9013 1001,
9014 "cd is shorter than the minimum length of 1".to_string(),
9015 ));
9016 }
9017 if val.chars().count() > 4 {
9018 return Err(ValidationError::new(
9019 1002,
9020 "cd exceeds the maximum length of 4".to_string(),
9021 ));
9022 }
9023 }
9024 if let Some(ref val) = self.prtry {
9025 if val.chars().count() < 1 {
9026 return Err(ValidationError::new(
9027 1001,
9028 "prtry 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 "prtry exceeds the maximum length of 35".to_string(),
9035 ));
9036 }
9037 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9038 if !pattern.is_match(val) {
9039 return Err(ValidationError::new(
9040 1005,
9041 "prtry does not match the required pattern".to_string(),
9042 ));
9043 }
9044 }
9045 Ok(())
9046 }
9047}
9048
9049#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9051pub struct ReturnReason5Choice1 {
9052 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9053 pub cd: Option<String>,
9054 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9055 pub prtry: Option<String>,
9056}
9057
9058impl ReturnReason5Choice1 {
9059 pub fn validate(&self) -> Result<(), ValidationError> {
9060 if let Some(ref val) = self.cd {
9061 if val.chars().count() < 1 {
9062 return Err(ValidationError::new(
9063 1001,
9064 "cd is shorter than the minimum length of 1".to_string(),
9065 ));
9066 }
9067 if val.chars().count() > 4 {
9068 return Err(ValidationError::new(
9069 1002,
9070 "cd exceeds the maximum length of 4".to_string(),
9071 ));
9072 }
9073 }
9074 if let Some(ref val) = self.prtry {
9075 if val.chars().count() < 1 {
9076 return Err(ValidationError::new(
9077 1001,
9078 "prtry is shorter than the minimum length of 1".to_string(),
9079 ));
9080 }
9081 if val.chars().count() > 35 {
9082 return Err(ValidationError::new(
9083 1002,
9084 "prtry exceeds the maximum length of 35".to_string(),
9085 ));
9086 }
9087 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9088 if !pattern.is_match(val) {
9089 return Err(ValidationError::new(
9090 1005,
9091 "prtry does not match the required pattern".to_string(),
9092 ));
9093 }
9094 }
9095 Ok(())
9096 }
9097}
9098
9099#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9101pub struct SecuritiesAccount191 {
9102 #[serde(rename = "Id")]
9103 pub id: String,
9104 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9105 pub tp: Option<GenericIdentification302>,
9106 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9107 pub nm: Option<String>,
9108}
9109
9110impl SecuritiesAccount191 {
9111 pub fn validate(&self) -> Result<(), ValidationError> {
9112 if self.id.chars().count() < 1 {
9113 return Err(ValidationError::new(
9114 1001,
9115 "id is shorter than the minimum length of 1".to_string(),
9116 ));
9117 }
9118 if self.id.chars().count() > 35 {
9119 return Err(ValidationError::new(
9120 1002,
9121 "id exceeds the maximum length of 35".to_string(),
9122 ));
9123 }
9124 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9125 if !pattern.is_match(&self.id) {
9126 return Err(ValidationError::new(
9127 1005,
9128 "id does not match the required pattern".to_string(),
9129 ));
9130 }
9131 if let Some(ref val) = self.tp {
9132 val.validate()?
9133 }
9134 if let Some(ref val) = self.nm {
9135 if val.chars().count() < 1 {
9136 return Err(ValidationError::new(
9137 1001,
9138 "nm is shorter than the minimum length of 1".to_string(),
9139 ));
9140 }
9141 if val.chars().count() > 70 {
9142 return Err(ValidationError::new(
9143 1002,
9144 "nm exceeds the maximum length of 70".to_string(),
9145 ));
9146 }
9147 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9148 if !pattern.is_match(val) {
9149 return Err(ValidationError::new(
9150 1005,
9151 "nm does not match the required pattern".to_string(),
9152 ));
9153 }
9154 }
9155 Ok(())
9156 }
9157}
9158
9159#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9161pub struct SecurityIdentification191 {
9162 #[serde(rename = "ISIN", skip_serializing_if = "Option::is_none")]
9163 pub isin: Option<String>,
9164 #[serde(rename = "OthrId", skip_serializing_if = "Option::is_none")]
9165 pub othr_id: Option<Vec<OtherIdentification11>>,
9166 #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
9167 pub desc: Option<String>,
9168}
9169
9170impl SecurityIdentification191 {
9171 pub fn validate(&self) -> Result<(), ValidationError> {
9172 if let Some(ref val) = self.isin {
9173 let pattern = Regex::new("[A-Z]{2,2}[A-Z0-9]{9,9}[0-9]{1,1}").unwrap();
9174 if !pattern.is_match(val) {
9175 return Err(ValidationError::new(
9176 1005,
9177 "isin does not match the required pattern".to_string(),
9178 ));
9179 }
9180 }
9181 if let Some(ref vec) = self.othr_id {
9182 for item in vec {
9183 item.validate()?
9184 }
9185 }
9186 if let Some(ref val) = self.desc {
9187 if val.chars().count() < 1 {
9188 return Err(ValidationError::new(
9189 1001,
9190 "desc is shorter than the minimum length of 1".to_string(),
9191 ));
9192 }
9193 if val.chars().count() > 35 {
9194 return Err(ValidationError::new(
9195 1002,
9196 "desc exceeds the maximum length of 35".to_string(),
9197 ));
9198 }
9199 let pattern = Regex::new(
9200 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9201 )
9202 .unwrap();
9203 if !pattern.is_match(val) {
9204 return Err(ValidationError::new(
9205 1005,
9206 "desc does not match the required pattern".to_string(),
9207 ));
9208 }
9209 }
9210 Ok(())
9211 }
9212}
9213
9214#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9216pub struct SequenceRange1Choice1 {
9217 #[serde(rename = "FrSeq", skip_serializing_if = "Option::is_none")]
9218 pub fr_seq: Option<String>,
9219 #[serde(rename = "ToSeq", skip_serializing_if = "Option::is_none")]
9220 pub to_seq: Option<String>,
9221 #[serde(rename = "FrToSeq", skip_serializing_if = "Option::is_none")]
9222 pub fr_to_seq: Option<Vec<SequenceRange11>>,
9223 #[serde(rename = "EQSeq", skip_serializing_if = "Option::is_none")]
9224 pub eq_seq: Option<Vec<String>>,
9225 #[serde(rename = "NEQSeq", skip_serializing_if = "Option::is_none")]
9226 pub neq_seq: Option<Vec<String>>,
9227}
9228
9229impl SequenceRange1Choice1 {
9230 pub fn validate(&self) -> Result<(), ValidationError> {
9231 if let Some(ref val) = self.fr_seq {
9232 if val.chars().count() < 1 {
9233 return Err(ValidationError::new(
9234 1001,
9235 "fr_seq is shorter than the minimum length of 1".to_string(),
9236 ));
9237 }
9238 if val.chars().count() > 35 {
9239 return Err(ValidationError::new(
9240 1002,
9241 "fr_seq exceeds the maximum length of 35".to_string(),
9242 ));
9243 }
9244 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9245 if !pattern.is_match(val) {
9246 return Err(ValidationError::new(
9247 1005,
9248 "fr_seq does not match the required pattern".to_string(),
9249 ));
9250 }
9251 }
9252 if let Some(ref val) = self.to_seq {
9253 if val.chars().count() < 1 {
9254 return Err(ValidationError::new(
9255 1001,
9256 "to_seq is shorter than the minimum length of 1".to_string(),
9257 ));
9258 }
9259 if val.chars().count() > 35 {
9260 return Err(ValidationError::new(
9261 1002,
9262 "to_seq exceeds the maximum length of 35".to_string(),
9263 ));
9264 }
9265 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9266 if !pattern.is_match(val) {
9267 return Err(ValidationError::new(
9268 1005,
9269 "to_seq does not match the required pattern".to_string(),
9270 ));
9271 }
9272 }
9273 if let Some(ref vec) = self.fr_to_seq {
9274 for item in vec {
9275 item.validate()?
9276 }
9277 }
9278 if let Some(ref vec) = self.eq_seq {
9279 for item in vec {
9280 if item.chars().count() < 1 {
9281 return Err(ValidationError::new(
9282 1001,
9283 "eq_seq is shorter than the minimum length of 1".to_string(),
9284 ));
9285 }
9286 if item.chars().count() > 35 {
9287 return Err(ValidationError::new(
9288 1002,
9289 "eq_seq exceeds the maximum length of 35".to_string(),
9290 ));
9291 }
9292 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9293 if !pattern.is_match(&item) {
9294 return Err(ValidationError::new(
9295 1005,
9296 "eq_seq does not match the required pattern".to_string(),
9297 ));
9298 }
9299 }
9300 }
9301 if let Some(ref vec) = self.neq_seq {
9302 for item in vec {
9303 if item.chars().count() < 1 {
9304 return Err(ValidationError::new(
9305 1001,
9306 "neq_seq is shorter than the minimum length of 1".to_string(),
9307 ));
9308 }
9309 if item.chars().count() > 35 {
9310 return Err(ValidationError::new(
9311 1002,
9312 "neq_seq exceeds the maximum length of 35".to_string(),
9313 ));
9314 }
9315 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9316 if !pattern.is_match(&item) {
9317 return Err(ValidationError::new(
9318 1005,
9319 "neq_seq does not match the required pattern".to_string(),
9320 ));
9321 }
9322 }
9323 }
9324 Ok(())
9325 }
9326}
9327
9328#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9330pub struct SequenceRange11 {
9331 #[serde(rename = "FrSeq")]
9332 pub fr_seq: String,
9333 #[serde(rename = "ToSeq")]
9334 pub to_seq: String,
9335}
9336
9337impl SequenceRange11 {
9338 pub fn validate(&self) -> Result<(), ValidationError> {
9339 if self.fr_seq.chars().count() < 1 {
9340 return Err(ValidationError::new(
9341 1001,
9342 "fr_seq is shorter than the minimum length of 1".to_string(),
9343 ));
9344 }
9345 if self.fr_seq.chars().count() > 35 {
9346 return Err(ValidationError::new(
9347 1002,
9348 "fr_seq exceeds the maximum length of 35".to_string(),
9349 ));
9350 }
9351 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9352 if !pattern.is_match(&self.fr_seq) {
9353 return Err(ValidationError::new(
9354 1005,
9355 "fr_seq does not match the required pattern".to_string(),
9356 ));
9357 }
9358 if self.to_seq.chars().count() < 1 {
9359 return Err(ValidationError::new(
9360 1001,
9361 "to_seq is shorter than the minimum length of 1".to_string(),
9362 ));
9363 }
9364 if self.to_seq.chars().count() > 35 {
9365 return Err(ValidationError::new(
9366 1002,
9367 "to_seq exceeds the maximum length of 35".to_string(),
9368 ));
9369 }
9370 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9371 if !pattern.is_match(&self.to_seq) {
9372 return Err(ValidationError::new(
9373 1005,
9374 "to_seq does not match the required pattern".to_string(),
9375 ));
9376 }
9377 Ok(())
9378 }
9379}
9380
9381#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9383pub struct StructuredRemittanceInformation161 {
9384 #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
9385 pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
9386 #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
9387 pub rfrd_doc_amt: Option<RemittanceAmount21>,
9388 #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
9389 pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
9390 #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
9391 pub invcr: Option<PartyIdentification1353>,
9392 #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
9393 pub invcee: Option<PartyIdentification1353>,
9394 #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
9395 pub tax_rmt: Option<TaxInformation71>,
9396 #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
9397 pub grnshmt_rmt: Option<Garnishment31>,
9398 #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
9399 pub addtl_rmt_inf: Option<Vec<String>>,
9400}
9401
9402impl StructuredRemittanceInformation161 {
9403 pub fn validate(&self) -> Result<(), ValidationError> {
9404 if let Some(ref vec) = self.rfrd_doc_inf {
9405 for item in vec {
9406 item.validate()?
9407 }
9408 }
9409 if let Some(ref val) = self.rfrd_doc_amt {
9410 val.validate()?
9411 }
9412 if let Some(ref val) = self.cdtr_ref_inf {
9413 val.validate()?
9414 }
9415 if let Some(ref val) = self.invcr {
9416 val.validate()?
9417 }
9418 if let Some(ref val) = self.invcee {
9419 val.validate()?
9420 }
9421 if let Some(ref val) = self.tax_rmt {
9422 val.validate()?
9423 }
9424 if let Some(ref val) = self.grnshmt_rmt {
9425 val.validate()?
9426 }
9427 if let Some(ref vec) = self.addtl_rmt_inf {
9428 for item in vec {
9429 if item.chars().count() < 1 {
9430 return Err(ValidationError::new(
9431 1001,
9432 "addtl_rmt_inf is shorter than the minimum length of 1".to_string(),
9433 ));
9434 }
9435 if item.chars().count() > 140 {
9436 return Err(ValidationError::new(
9437 1002,
9438 "addtl_rmt_inf exceeds the maximum length of 140".to_string(),
9439 ));
9440 }
9441 let pattern = Regex::new(
9442 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9443 )
9444 .unwrap();
9445 if !pattern.is_match(&item) {
9446 return Err(ValidationError::new(
9447 1005,
9448 "addtl_rmt_inf does not match the required pattern".to_string(),
9449 ));
9450 }
9451 }
9452 }
9453 Ok(())
9454 }
9455}
9456
9457#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9459pub struct TaxAmount2 {
9460 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9461 pub rate: Option<f64>,
9462 #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
9463 pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9464 #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
9465 pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9466 #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
9467 pub dtls: Option<Vec<TaxRecordDetails2>>,
9468}
9469
9470impl TaxAmount2 {
9471 pub fn validate(&self) -> Result<(), ValidationError> {
9472 if let Some(ref val) = self.taxbl_base_amt {
9473 val.validate()?
9474 }
9475 if let Some(ref val) = self.ttl_amt {
9476 val.validate()?
9477 }
9478 if let Some(ref vec) = self.dtls {
9479 for item in vec {
9480 item.validate()?
9481 }
9482 }
9483 Ok(())
9484 }
9485}
9486
9487#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9489pub struct TaxAmountAndType1 {
9490 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9491 pub tp: Option<TaxAmountType1Choice>,
9492 #[serde(rename = "Amt")]
9493 pub amt: ActiveOrHistoricCurrencyAndAmount,
9494}
9495
9496impl TaxAmountAndType1 {
9497 pub fn validate(&self) -> Result<(), ValidationError> {
9498 if let Some(ref val) = self.tp {
9499 val.validate()?
9500 }
9501 self.amt.validate()?;
9502 Ok(())
9503 }
9504}
9505
9506#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9508pub struct TaxAmountAndType11 {
9509 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
9510 pub tp: Option<TaxAmountType1Choice1>,
9511 #[serde(rename = "Amt")]
9512 pub amt: ActiveOrHistoricCurrencyAndAmount,
9513}
9514
9515impl TaxAmountAndType11 {
9516 pub fn validate(&self) -> Result<(), ValidationError> {
9517 if let Some(ref val) = self.tp {
9518 val.validate()?
9519 }
9520 self.amt.validate()?;
9521 Ok(())
9522 }
9523}
9524
9525#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9527pub struct TaxAmountType1Choice {
9528 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9529 pub cd: Option<String>,
9530 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9531 pub prtry: Option<String>,
9532}
9533
9534impl TaxAmountType1Choice {
9535 pub fn validate(&self) -> Result<(), ValidationError> {
9536 if let Some(ref val) = self.cd {
9537 if val.chars().count() < 1 {
9538 return Err(ValidationError::new(
9539 1001,
9540 "cd is shorter than the minimum length of 1".to_string(),
9541 ));
9542 }
9543 if val.chars().count() > 4 {
9544 return Err(ValidationError::new(
9545 1002,
9546 "cd exceeds the maximum length of 4".to_string(),
9547 ));
9548 }
9549 }
9550 if let Some(ref val) = self.prtry {
9551 if val.chars().count() < 1 {
9552 return Err(ValidationError::new(
9553 1001,
9554 "prtry is shorter than the minimum length of 1".to_string(),
9555 ));
9556 }
9557 if val.chars().count() > 35 {
9558 return Err(ValidationError::new(
9559 1002,
9560 "prtry exceeds the maximum length of 35".to_string(),
9561 ));
9562 }
9563 }
9564 Ok(())
9565 }
9566}
9567
9568#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9570pub struct TaxAmountType1Choice1 {
9571 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
9572 pub cd: Option<String>,
9573 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
9574 pub prtry: Option<String>,
9575}
9576
9577impl TaxAmountType1Choice1 {
9578 pub fn validate(&self) -> Result<(), ValidationError> {
9579 if let Some(ref val) = self.cd {
9580 if val.chars().count() < 1 {
9581 return Err(ValidationError::new(
9582 1001,
9583 "cd is shorter than the minimum length of 1".to_string(),
9584 ));
9585 }
9586 if val.chars().count() > 4 {
9587 return Err(ValidationError::new(
9588 1002,
9589 "cd exceeds the maximum length of 4".to_string(),
9590 ));
9591 }
9592 }
9593 if let Some(ref val) = self.prtry {
9594 if val.chars().count() < 1 {
9595 return Err(ValidationError::new(
9596 1001,
9597 "prtry is shorter than the minimum length of 1".to_string(),
9598 ));
9599 }
9600 if val.chars().count() > 35 {
9601 return Err(ValidationError::new(
9602 1002,
9603 "prtry exceeds the maximum length of 35".to_string(),
9604 ));
9605 }
9606 let pattern = Regex::new(
9607 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9608 )
9609 .unwrap();
9610 if !pattern.is_match(val) {
9611 return Err(ValidationError::new(
9612 1005,
9613 "prtry does not match the required pattern".to_string(),
9614 ));
9615 }
9616 }
9617 Ok(())
9618 }
9619}
9620
9621#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9623pub struct TaxAuthorisation11 {
9624 #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
9625 pub titl: Option<String>,
9626 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9627 pub nm: Option<String>,
9628}
9629
9630impl TaxAuthorisation11 {
9631 pub fn validate(&self) -> Result<(), ValidationError> {
9632 if let Some(ref val) = self.titl {
9633 if val.chars().count() < 1 {
9634 return Err(ValidationError::new(
9635 1001,
9636 "titl is shorter than the minimum length of 1".to_string(),
9637 ));
9638 }
9639 if val.chars().count() > 35 {
9640 return Err(ValidationError::new(
9641 1002,
9642 "titl exceeds the maximum length of 35".to_string(),
9643 ));
9644 }
9645 let pattern = Regex::new(
9646 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9647 )
9648 .unwrap();
9649 if !pattern.is_match(val) {
9650 return Err(ValidationError::new(
9651 1005,
9652 "titl does not match the required pattern".to_string(),
9653 ));
9654 }
9655 }
9656 if let Some(ref val) = self.nm {
9657 if val.chars().count() < 1 {
9658 return Err(ValidationError::new(
9659 1001,
9660 "nm is shorter than the minimum length of 1".to_string(),
9661 ));
9662 }
9663 if val.chars().count() > 140 {
9664 return Err(ValidationError::new(
9665 1002,
9666 "nm exceeds the maximum length of 140".to_string(),
9667 ));
9668 }
9669 let pattern = Regex::new(
9670 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9671 )
9672 .unwrap();
9673 if !pattern.is_match(val) {
9674 return Err(ValidationError::new(
9675 1005,
9676 "nm does not match the required pattern".to_string(),
9677 ));
9678 }
9679 }
9680 Ok(())
9681 }
9682}
9683
9684#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9686pub struct TaxAuthorisation12 {
9687 #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
9688 pub titl: Option<String>,
9689 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
9690 pub nm: Option<String>,
9691}
9692
9693impl TaxAuthorisation12 {
9694 pub fn validate(&self) -> Result<(), ValidationError> {
9695 if let Some(ref val) = self.titl {
9696 if val.chars().count() < 1 {
9697 return Err(ValidationError::new(
9698 1001,
9699 "titl is shorter than the minimum length of 1".to_string(),
9700 ));
9701 }
9702 if val.chars().count() > 35 {
9703 return Err(ValidationError::new(
9704 1002,
9705 "titl exceeds the maximum length of 35".to_string(),
9706 ));
9707 }
9708 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9709 if !pattern.is_match(val) {
9710 return Err(ValidationError::new(
9711 1005,
9712 "titl does not match the required pattern".to_string(),
9713 ));
9714 }
9715 }
9716 if let Some(ref val) = self.nm {
9717 if val.chars().count() < 1 {
9718 return Err(ValidationError::new(
9719 1001,
9720 "nm is shorter than the minimum length of 1".to_string(),
9721 ));
9722 }
9723 if val.chars().count() > 140 {
9724 return Err(ValidationError::new(
9725 1002,
9726 "nm exceeds the maximum length of 140".to_string(),
9727 ));
9728 }
9729 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9730 if !pattern.is_match(val) {
9731 return Err(ValidationError::new(
9732 1005,
9733 "nm does not match the required pattern".to_string(),
9734 ));
9735 }
9736 }
9737 Ok(())
9738 }
9739}
9740
9741#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9743pub struct TaxCharges21 {
9744 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
9745 pub id: Option<String>,
9746 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
9747 pub rate: Option<f64>,
9748 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
9749 pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9750}
9751
9752impl TaxCharges21 {
9753 pub fn validate(&self) -> Result<(), ValidationError> {
9754 if let Some(ref val) = self.id {
9755 if val.chars().count() < 1 {
9756 return Err(ValidationError::new(
9757 1001,
9758 "id is shorter than the minimum length of 1".to_string(),
9759 ));
9760 }
9761 if val.chars().count() > 35 {
9762 return Err(ValidationError::new(
9763 1002,
9764 "id exceeds the maximum length of 35".to_string(),
9765 ));
9766 }
9767 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9768 if !pattern.is_match(val) {
9769 return Err(ValidationError::new(
9770 1005,
9771 "id does not match the required pattern".to_string(),
9772 ));
9773 }
9774 }
9775 if let Some(ref val) = self.amt {
9776 val.validate()?
9777 }
9778 Ok(())
9779 }
9780}
9781
9782#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9784pub struct TaxInformation71 {
9785 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
9786 pub cdtr: Option<TaxParty11>,
9787 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
9788 pub dbtr: Option<TaxParty21>,
9789 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
9790 pub ultmt_dbtr: Option<TaxParty21>,
9791 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
9792 pub admstn_zone: Option<String>,
9793 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
9794 pub ref_nb: Option<String>,
9795 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
9796 pub mtd: Option<String>,
9797 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
9798 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9799 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
9800 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9801 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
9802 pub dt: Option<String>,
9803 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
9804 pub seq_nb: Option<f64>,
9805 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
9806 pub rcrd: Option<Vec<TaxRecord21>>,
9807}
9808
9809impl TaxInformation71 {
9810 pub fn validate(&self) -> Result<(), ValidationError> {
9811 if let Some(ref val) = self.cdtr {
9812 val.validate()?
9813 }
9814 if let Some(ref val) = self.dbtr {
9815 val.validate()?
9816 }
9817 if let Some(ref val) = self.ultmt_dbtr {
9818 val.validate()?
9819 }
9820 if let Some(ref val) = self.admstn_zone {
9821 if val.chars().count() < 1 {
9822 return Err(ValidationError::new(
9823 1001,
9824 "admstn_zone is shorter than the minimum length of 1".to_string(),
9825 ));
9826 }
9827 if val.chars().count() > 35 {
9828 return Err(ValidationError::new(
9829 1002,
9830 "admstn_zone exceeds the maximum length of 35".to_string(),
9831 ));
9832 }
9833 let pattern = Regex::new(
9834 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9835 )
9836 .unwrap();
9837 if !pattern.is_match(val) {
9838 return Err(ValidationError::new(
9839 1005,
9840 "admstn_zone does not match the required pattern".to_string(),
9841 ));
9842 }
9843 }
9844 if let Some(ref val) = self.ref_nb {
9845 if val.chars().count() < 1 {
9846 return Err(ValidationError::new(
9847 1001,
9848 "ref_nb is shorter than the minimum length of 1".to_string(),
9849 ));
9850 }
9851 if val.chars().count() > 140 {
9852 return Err(ValidationError::new(
9853 1002,
9854 "ref_nb exceeds the maximum length of 140".to_string(),
9855 ));
9856 }
9857 let pattern = Regex::new(
9858 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9859 )
9860 .unwrap();
9861 if !pattern.is_match(val) {
9862 return Err(ValidationError::new(
9863 1005,
9864 "ref_nb does not match the required pattern".to_string(),
9865 ));
9866 }
9867 }
9868 if let Some(ref val) = self.mtd {
9869 if val.chars().count() < 1 {
9870 return Err(ValidationError::new(
9871 1001,
9872 "mtd is shorter than the minimum length of 1".to_string(),
9873 ));
9874 }
9875 if val.chars().count() > 35 {
9876 return Err(ValidationError::new(
9877 1002,
9878 "mtd exceeds the maximum length of 35".to_string(),
9879 ));
9880 }
9881 let pattern = Regex::new(
9882 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
9883 )
9884 .unwrap();
9885 if !pattern.is_match(val) {
9886 return Err(ValidationError::new(
9887 1005,
9888 "mtd does not match the required pattern".to_string(),
9889 ));
9890 }
9891 }
9892 if let Some(ref val) = self.ttl_taxbl_base_amt {
9893 val.validate()?
9894 }
9895 if let Some(ref val) = self.ttl_tax_amt {
9896 val.validate()?
9897 }
9898 if let Some(ref vec) = self.rcrd {
9899 for item in vec {
9900 item.validate()?
9901 }
9902 }
9903 Ok(())
9904 }
9905}
9906
9907#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
9909pub struct TaxInformation81 {
9910 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
9911 pub cdtr: Option<TaxParty12>,
9912 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
9913 pub dbtr: Option<TaxParty22>,
9914 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
9915 pub admstn_zone: Option<String>,
9916 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
9917 pub ref_nb: Option<String>,
9918 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
9919 pub mtd: Option<String>,
9920 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
9921 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9922 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
9923 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
9924 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
9925 pub dt: Option<String>,
9926 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
9927 pub seq_nb: Option<f64>,
9928 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
9929 pub rcrd: Option<Vec<TaxRecord22>>,
9930}
9931
9932impl TaxInformation81 {
9933 pub fn validate(&self) -> Result<(), ValidationError> {
9934 if let Some(ref val) = self.cdtr {
9935 val.validate()?
9936 }
9937 if let Some(ref val) = self.dbtr {
9938 val.validate()?
9939 }
9940 if let Some(ref val) = self.admstn_zone {
9941 if val.chars().count() < 1 {
9942 return Err(ValidationError::new(
9943 1001,
9944 "admstn_zone is shorter than the minimum length of 1".to_string(),
9945 ));
9946 }
9947 if val.chars().count() > 35 {
9948 return Err(ValidationError::new(
9949 1002,
9950 "admstn_zone exceeds the maximum length of 35".to_string(),
9951 ));
9952 }
9953 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9954 if !pattern.is_match(val) {
9955 return Err(ValidationError::new(
9956 1005,
9957 "admstn_zone does not match the required pattern".to_string(),
9958 ));
9959 }
9960 }
9961 if let Some(ref val) = self.ref_nb {
9962 if val.chars().count() < 1 {
9963 return Err(ValidationError::new(
9964 1001,
9965 "ref_nb is shorter than the minimum length of 1".to_string(),
9966 ));
9967 }
9968 if val.chars().count() > 140 {
9969 return Err(ValidationError::new(
9970 1002,
9971 "ref_nb exceeds the maximum length of 140".to_string(),
9972 ));
9973 }
9974 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9975 if !pattern.is_match(val) {
9976 return Err(ValidationError::new(
9977 1005,
9978 "ref_nb does not match the required pattern".to_string(),
9979 ));
9980 }
9981 }
9982 if let Some(ref val) = self.mtd {
9983 if val.chars().count() < 1 {
9984 return Err(ValidationError::new(
9985 1001,
9986 "mtd is shorter than the minimum length of 1".to_string(),
9987 ));
9988 }
9989 if val.chars().count() > 35 {
9990 return Err(ValidationError::new(
9991 1002,
9992 "mtd exceeds the maximum length of 35".to_string(),
9993 ));
9994 }
9995 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
9996 if !pattern.is_match(val) {
9997 return Err(ValidationError::new(
9998 1005,
9999 "mtd does not match the required pattern".to_string(),
10000 ));
10001 }
10002 }
10003 if let Some(ref val) = self.ttl_taxbl_base_amt {
10004 val.validate()?
10005 }
10006 if let Some(ref val) = self.ttl_tax_amt {
10007 val.validate()?
10008 }
10009 if let Some(ref vec) = self.rcrd {
10010 for item in vec {
10011 item.validate()?
10012 }
10013 }
10014 Ok(())
10015 }
10016}
10017
10018#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10020pub struct TaxParty11 {
10021 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10022 pub tax_id: Option<String>,
10023 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10024 pub regn_id: Option<String>,
10025 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10026 pub tax_tp: Option<String>,
10027}
10028
10029impl TaxParty11 {
10030 pub fn validate(&self) -> Result<(), ValidationError> {
10031 if let Some(ref val) = self.tax_id {
10032 if val.chars().count() < 1 {
10033 return Err(ValidationError::new(
10034 1001,
10035 "tax_id is shorter than the minimum length of 1".to_string(),
10036 ));
10037 }
10038 if val.chars().count() > 35 {
10039 return Err(ValidationError::new(
10040 1002,
10041 "tax_id exceeds the maximum length of 35".to_string(),
10042 ));
10043 }
10044 let pattern = Regex::new(
10045 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10046 )
10047 .unwrap();
10048 if !pattern.is_match(val) {
10049 return Err(ValidationError::new(
10050 1005,
10051 "tax_id does not match the required pattern".to_string(),
10052 ));
10053 }
10054 }
10055 if let Some(ref val) = self.regn_id {
10056 if val.chars().count() < 1 {
10057 return Err(ValidationError::new(
10058 1001,
10059 "regn_id is shorter than the minimum length of 1".to_string(),
10060 ));
10061 }
10062 if val.chars().count() > 35 {
10063 return Err(ValidationError::new(
10064 1002,
10065 "regn_id exceeds the maximum length of 35".to_string(),
10066 ));
10067 }
10068 let pattern = Regex::new(
10069 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10070 )
10071 .unwrap();
10072 if !pattern.is_match(val) {
10073 return Err(ValidationError::new(
10074 1005,
10075 "regn_id does not match the required pattern".to_string(),
10076 ));
10077 }
10078 }
10079 if let Some(ref val) = self.tax_tp {
10080 if val.chars().count() < 1 {
10081 return Err(ValidationError::new(
10082 1001,
10083 "tax_tp is shorter than the minimum length of 1".to_string(),
10084 ));
10085 }
10086 if val.chars().count() > 35 {
10087 return Err(ValidationError::new(
10088 1002,
10089 "tax_tp exceeds the maximum length of 35".to_string(),
10090 ));
10091 }
10092 let pattern = Regex::new(
10093 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10094 )
10095 .unwrap();
10096 if !pattern.is_match(val) {
10097 return Err(ValidationError::new(
10098 1005,
10099 "tax_tp does not match the required pattern".to_string(),
10100 ));
10101 }
10102 }
10103 Ok(())
10104 }
10105}
10106
10107#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10109pub struct TaxParty12 {
10110 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10111 pub tax_id: Option<String>,
10112 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10113 pub regn_id: Option<String>,
10114 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10115 pub tax_tp: Option<String>,
10116}
10117
10118impl TaxParty12 {
10119 pub fn validate(&self) -> Result<(), ValidationError> {
10120 if let Some(ref val) = self.tax_id {
10121 if val.chars().count() < 1 {
10122 return Err(ValidationError::new(
10123 1001,
10124 "tax_id is shorter than the minimum length of 1".to_string(),
10125 ));
10126 }
10127 if val.chars().count() > 35 {
10128 return Err(ValidationError::new(
10129 1002,
10130 "tax_id exceeds the maximum length of 35".to_string(),
10131 ));
10132 }
10133 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10134 if !pattern.is_match(val) {
10135 return Err(ValidationError::new(
10136 1005,
10137 "tax_id does not match the required pattern".to_string(),
10138 ));
10139 }
10140 }
10141 if let Some(ref val) = self.regn_id {
10142 if val.chars().count() < 1 {
10143 return Err(ValidationError::new(
10144 1001,
10145 "regn_id is shorter than the minimum length of 1".to_string(),
10146 ));
10147 }
10148 if val.chars().count() > 35 {
10149 return Err(ValidationError::new(
10150 1002,
10151 "regn_id exceeds the maximum length of 35".to_string(),
10152 ));
10153 }
10154 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10155 if !pattern.is_match(val) {
10156 return Err(ValidationError::new(
10157 1005,
10158 "regn_id does not match the required pattern".to_string(),
10159 ));
10160 }
10161 }
10162 if let Some(ref val) = self.tax_tp {
10163 if val.chars().count() < 1 {
10164 return Err(ValidationError::new(
10165 1001,
10166 "tax_tp is shorter than the minimum length of 1".to_string(),
10167 ));
10168 }
10169 if val.chars().count() > 35 {
10170 return Err(ValidationError::new(
10171 1002,
10172 "tax_tp exceeds the maximum length of 35".to_string(),
10173 ));
10174 }
10175 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10176 if !pattern.is_match(val) {
10177 return Err(ValidationError::new(
10178 1005,
10179 "tax_tp does not match the required pattern".to_string(),
10180 ));
10181 }
10182 }
10183 Ok(())
10184 }
10185}
10186
10187#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10189pub struct TaxParty21 {
10190 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10191 pub tax_id: Option<String>,
10192 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10193 pub regn_id: Option<String>,
10194 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10195 pub tax_tp: Option<String>,
10196 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
10197 pub authstn: Option<TaxAuthorisation11>,
10198}
10199
10200impl TaxParty21 {
10201 pub fn validate(&self) -> Result<(), ValidationError> {
10202 if let Some(ref val) = self.tax_id {
10203 if val.chars().count() < 1 {
10204 return Err(ValidationError::new(
10205 1001,
10206 "tax_id is shorter than the minimum length of 1".to_string(),
10207 ));
10208 }
10209 if val.chars().count() > 35 {
10210 return Err(ValidationError::new(
10211 1002,
10212 "tax_id exceeds the maximum length of 35".to_string(),
10213 ));
10214 }
10215 let pattern = Regex::new(
10216 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10217 )
10218 .unwrap();
10219 if !pattern.is_match(val) {
10220 return Err(ValidationError::new(
10221 1005,
10222 "tax_id does not match the required pattern".to_string(),
10223 ));
10224 }
10225 }
10226 if let Some(ref val) = self.regn_id {
10227 if val.chars().count() < 1 {
10228 return Err(ValidationError::new(
10229 1001,
10230 "regn_id is shorter than the minimum length of 1".to_string(),
10231 ));
10232 }
10233 if val.chars().count() > 35 {
10234 return Err(ValidationError::new(
10235 1002,
10236 "regn_id exceeds the maximum length of 35".to_string(),
10237 ));
10238 }
10239 let pattern = Regex::new(
10240 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10241 )
10242 .unwrap();
10243 if !pattern.is_match(val) {
10244 return Err(ValidationError::new(
10245 1005,
10246 "regn_id does not match the required pattern".to_string(),
10247 ));
10248 }
10249 }
10250 if let Some(ref val) = self.tax_tp {
10251 if val.chars().count() < 1 {
10252 return Err(ValidationError::new(
10253 1001,
10254 "tax_tp is shorter than the minimum length of 1".to_string(),
10255 ));
10256 }
10257 if val.chars().count() > 35 {
10258 return Err(ValidationError::new(
10259 1002,
10260 "tax_tp exceeds the maximum length of 35".to_string(),
10261 ));
10262 }
10263 let pattern = Regex::new(
10264 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10265 )
10266 .unwrap();
10267 if !pattern.is_match(val) {
10268 return Err(ValidationError::new(
10269 1005,
10270 "tax_tp does not match the required pattern".to_string(),
10271 ));
10272 }
10273 }
10274 if let Some(ref val) = self.authstn {
10275 val.validate()?
10276 }
10277 Ok(())
10278 }
10279}
10280
10281#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10283pub struct TaxParty22 {
10284 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
10285 pub tax_id: Option<String>,
10286 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
10287 pub regn_id: Option<String>,
10288 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
10289 pub tax_tp: Option<String>,
10290 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
10291 pub authstn: Option<TaxAuthorisation12>,
10292}
10293
10294impl TaxParty22 {
10295 pub fn validate(&self) -> Result<(), ValidationError> {
10296 if let Some(ref val) = self.tax_id {
10297 if val.chars().count() < 1 {
10298 return Err(ValidationError::new(
10299 1001,
10300 "tax_id is shorter than the minimum length of 1".to_string(),
10301 ));
10302 }
10303 if val.chars().count() > 35 {
10304 return Err(ValidationError::new(
10305 1002,
10306 "tax_id exceeds the maximum length of 35".to_string(),
10307 ));
10308 }
10309 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10310 if !pattern.is_match(val) {
10311 return Err(ValidationError::new(
10312 1005,
10313 "tax_id does not match the required pattern".to_string(),
10314 ));
10315 }
10316 }
10317 if let Some(ref val) = self.regn_id {
10318 if val.chars().count() < 1 {
10319 return Err(ValidationError::new(
10320 1001,
10321 "regn_id is shorter than the minimum length of 1".to_string(),
10322 ));
10323 }
10324 if val.chars().count() > 35 {
10325 return Err(ValidationError::new(
10326 1002,
10327 "regn_id exceeds the maximum length of 35".to_string(),
10328 ));
10329 }
10330 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10331 if !pattern.is_match(val) {
10332 return Err(ValidationError::new(
10333 1005,
10334 "regn_id does not match the required pattern".to_string(),
10335 ));
10336 }
10337 }
10338 if let Some(ref val) = self.tax_tp {
10339 if val.chars().count() < 1 {
10340 return Err(ValidationError::new(
10341 1001,
10342 "tax_tp is shorter than the minimum length of 1".to_string(),
10343 ));
10344 }
10345 if val.chars().count() > 35 {
10346 return Err(ValidationError::new(
10347 1002,
10348 "tax_tp exceeds the maximum length of 35".to_string(),
10349 ));
10350 }
10351 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10352 if !pattern.is_match(val) {
10353 return Err(ValidationError::new(
10354 1005,
10355 "tax_tp does not match the required pattern".to_string(),
10356 ));
10357 }
10358 }
10359 if let Some(ref val) = self.authstn {
10360 val.validate()?
10361 }
10362 Ok(())
10363 }
10364}
10365
10366#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10368pub struct TaxPeriod2 {
10369 #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
10370 pub yr: Option<String>,
10371 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10372 pub tp: Option<TaxRecordPeriod1Code>,
10373 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
10374 pub fr_to_dt: Option<DatePeriod2>,
10375}
10376
10377impl TaxPeriod2 {
10378 pub fn validate(&self) -> Result<(), ValidationError> {
10379 if let Some(ref val) = self.tp {
10380 val.validate()?
10381 }
10382 if let Some(ref val) = self.fr_to_dt {
10383 val.validate()?
10384 }
10385 Ok(())
10386 }
10387}
10388
10389#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10391pub struct TaxRecord21 {
10392 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10393 pub tp: Option<String>,
10394 #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
10395 pub ctgy: Option<String>,
10396 #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
10397 pub ctgy_dtls: Option<String>,
10398 #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
10399 pub dbtr_sts: Option<String>,
10400 #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
10401 pub cert_id: Option<String>,
10402 #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
10403 pub frms_cd: Option<String>,
10404 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10405 pub prd: Option<TaxPeriod2>,
10406 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10407 pub tax_amt: Option<TaxAmount2>,
10408 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
10409 pub addtl_inf: Option<String>,
10410}
10411
10412impl TaxRecord21 {
10413 pub fn validate(&self) -> Result<(), ValidationError> {
10414 if let Some(ref val) = self.tp {
10415 if val.chars().count() < 1 {
10416 return Err(ValidationError::new(
10417 1001,
10418 "tp is shorter than the minimum length of 1".to_string(),
10419 ));
10420 }
10421 if val.chars().count() > 35 {
10422 return Err(ValidationError::new(
10423 1002,
10424 "tp exceeds the maximum length of 35".to_string(),
10425 ));
10426 }
10427 let pattern = Regex::new(
10428 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10429 )
10430 .unwrap();
10431 if !pattern.is_match(val) {
10432 return Err(ValidationError::new(
10433 1005,
10434 "tp does not match the required pattern".to_string(),
10435 ));
10436 }
10437 }
10438 if let Some(ref val) = self.ctgy {
10439 if val.chars().count() < 1 {
10440 return Err(ValidationError::new(
10441 1001,
10442 "ctgy is shorter than the minimum length of 1".to_string(),
10443 ));
10444 }
10445 if val.chars().count() > 35 {
10446 return Err(ValidationError::new(
10447 1002,
10448 "ctgy exceeds the maximum length of 35".to_string(),
10449 ));
10450 }
10451 let pattern = Regex::new(
10452 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10453 )
10454 .unwrap();
10455 if !pattern.is_match(val) {
10456 return Err(ValidationError::new(
10457 1005,
10458 "ctgy does not match the required pattern".to_string(),
10459 ));
10460 }
10461 }
10462 if let Some(ref val) = self.ctgy_dtls {
10463 if val.chars().count() < 1 {
10464 return Err(ValidationError::new(
10465 1001,
10466 "ctgy_dtls is shorter than the minimum length of 1".to_string(),
10467 ));
10468 }
10469 if val.chars().count() > 35 {
10470 return Err(ValidationError::new(
10471 1002,
10472 "ctgy_dtls exceeds the maximum length of 35".to_string(),
10473 ));
10474 }
10475 let pattern = Regex::new(
10476 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10477 )
10478 .unwrap();
10479 if !pattern.is_match(val) {
10480 return Err(ValidationError::new(
10481 1005,
10482 "ctgy_dtls does not match the required pattern".to_string(),
10483 ));
10484 }
10485 }
10486 if let Some(ref val) = self.dbtr_sts {
10487 if val.chars().count() < 1 {
10488 return Err(ValidationError::new(
10489 1001,
10490 "dbtr_sts is shorter than the minimum length of 1".to_string(),
10491 ));
10492 }
10493 if val.chars().count() > 35 {
10494 return Err(ValidationError::new(
10495 1002,
10496 "dbtr_sts exceeds the maximum length of 35".to_string(),
10497 ));
10498 }
10499 let pattern = Regex::new(
10500 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10501 )
10502 .unwrap();
10503 if !pattern.is_match(val) {
10504 return Err(ValidationError::new(
10505 1005,
10506 "dbtr_sts does not match the required pattern".to_string(),
10507 ));
10508 }
10509 }
10510 if let Some(ref val) = self.cert_id {
10511 if val.chars().count() < 1 {
10512 return Err(ValidationError::new(
10513 1001,
10514 "cert_id is shorter than the minimum length of 1".to_string(),
10515 ));
10516 }
10517 if val.chars().count() > 35 {
10518 return Err(ValidationError::new(
10519 1002,
10520 "cert_id exceeds the maximum length of 35".to_string(),
10521 ));
10522 }
10523 let pattern = Regex::new(
10524 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10525 )
10526 .unwrap();
10527 if !pattern.is_match(val) {
10528 return Err(ValidationError::new(
10529 1005,
10530 "cert_id does not match the required pattern".to_string(),
10531 ));
10532 }
10533 }
10534 if let Some(ref val) = self.frms_cd {
10535 if val.chars().count() < 1 {
10536 return Err(ValidationError::new(
10537 1001,
10538 "frms_cd is shorter than the minimum length of 1".to_string(),
10539 ));
10540 }
10541 if val.chars().count() > 35 {
10542 return Err(ValidationError::new(
10543 1002,
10544 "frms_cd exceeds the maximum length of 35".to_string(),
10545 ));
10546 }
10547 let pattern = Regex::new(
10548 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10549 )
10550 .unwrap();
10551 if !pattern.is_match(val) {
10552 return Err(ValidationError::new(
10553 1005,
10554 "frms_cd does not match the required pattern".to_string(),
10555 ));
10556 }
10557 }
10558 if let Some(ref val) = self.prd {
10559 val.validate()?
10560 }
10561 if let Some(ref val) = self.tax_amt {
10562 val.validate()?
10563 }
10564 if let Some(ref val) = self.addtl_inf {
10565 if val.chars().count() < 1 {
10566 return Err(ValidationError::new(
10567 1001,
10568 "addtl_inf is shorter than the minimum length of 1".to_string(),
10569 ));
10570 }
10571 if val.chars().count() > 140 {
10572 return Err(ValidationError::new(
10573 1002,
10574 "addtl_inf exceeds the maximum length of 140".to_string(),
10575 ));
10576 }
10577 let pattern = Regex::new(
10578 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
10579 )
10580 .unwrap();
10581 if !pattern.is_match(val) {
10582 return Err(ValidationError::new(
10583 1005,
10584 "addtl_inf does not match the required pattern".to_string(),
10585 ));
10586 }
10587 }
10588 Ok(())
10589 }
10590}
10591
10592#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10594pub struct TaxRecord22 {
10595 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
10596 pub tp: Option<String>,
10597 #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
10598 pub ctgy: Option<String>,
10599 #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
10600 pub ctgy_dtls: Option<String>,
10601 #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
10602 pub dbtr_sts: Option<String>,
10603 #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
10604 pub cert_id: Option<String>,
10605 #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
10606 pub frms_cd: Option<String>,
10607 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10608 pub prd: Option<TaxPeriod2>,
10609 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
10610 pub tax_amt: Option<TaxAmount2>,
10611 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
10612 pub addtl_inf: Option<String>,
10613}
10614
10615impl TaxRecord22 {
10616 pub fn validate(&self) -> Result<(), ValidationError> {
10617 if let Some(ref val) = self.tp {
10618 if val.chars().count() < 1 {
10619 return Err(ValidationError::new(
10620 1001,
10621 "tp is shorter than the minimum length of 1".to_string(),
10622 ));
10623 }
10624 if val.chars().count() > 35 {
10625 return Err(ValidationError::new(
10626 1002,
10627 "tp exceeds the maximum length of 35".to_string(),
10628 ));
10629 }
10630 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10631 if !pattern.is_match(val) {
10632 return Err(ValidationError::new(
10633 1005,
10634 "tp does not match the required pattern".to_string(),
10635 ));
10636 }
10637 }
10638 if let Some(ref val) = self.ctgy {
10639 if val.chars().count() < 1 {
10640 return Err(ValidationError::new(
10641 1001,
10642 "ctgy is shorter than the minimum length of 1".to_string(),
10643 ));
10644 }
10645 if val.chars().count() > 35 {
10646 return Err(ValidationError::new(
10647 1002,
10648 "ctgy exceeds the maximum length of 35".to_string(),
10649 ));
10650 }
10651 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10652 if !pattern.is_match(val) {
10653 return Err(ValidationError::new(
10654 1005,
10655 "ctgy does not match the required pattern".to_string(),
10656 ));
10657 }
10658 }
10659 if let Some(ref val) = self.ctgy_dtls {
10660 if val.chars().count() < 1 {
10661 return Err(ValidationError::new(
10662 1001,
10663 "ctgy_dtls is shorter than the minimum length of 1".to_string(),
10664 ));
10665 }
10666 if val.chars().count() > 35 {
10667 return Err(ValidationError::new(
10668 1002,
10669 "ctgy_dtls exceeds the maximum length of 35".to_string(),
10670 ));
10671 }
10672 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10673 if !pattern.is_match(val) {
10674 return Err(ValidationError::new(
10675 1005,
10676 "ctgy_dtls does not match the required pattern".to_string(),
10677 ));
10678 }
10679 }
10680 if let Some(ref val) = self.dbtr_sts {
10681 if val.chars().count() < 1 {
10682 return Err(ValidationError::new(
10683 1001,
10684 "dbtr_sts is shorter than the minimum length of 1".to_string(),
10685 ));
10686 }
10687 if val.chars().count() > 35 {
10688 return Err(ValidationError::new(
10689 1002,
10690 "dbtr_sts exceeds the maximum length of 35".to_string(),
10691 ));
10692 }
10693 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10694 if !pattern.is_match(val) {
10695 return Err(ValidationError::new(
10696 1005,
10697 "dbtr_sts does not match the required pattern".to_string(),
10698 ));
10699 }
10700 }
10701 if let Some(ref val) = self.cert_id {
10702 if val.chars().count() < 1 {
10703 return Err(ValidationError::new(
10704 1001,
10705 "cert_id is shorter than the minimum length of 1".to_string(),
10706 ));
10707 }
10708 if val.chars().count() > 35 {
10709 return Err(ValidationError::new(
10710 1002,
10711 "cert_id exceeds the maximum length of 35".to_string(),
10712 ));
10713 }
10714 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10715 if !pattern.is_match(val) {
10716 return Err(ValidationError::new(
10717 1005,
10718 "cert_id does not match the required pattern".to_string(),
10719 ));
10720 }
10721 }
10722 if let Some(ref val) = self.frms_cd {
10723 if val.chars().count() < 1 {
10724 return Err(ValidationError::new(
10725 1001,
10726 "frms_cd is shorter than the minimum length of 1".to_string(),
10727 ));
10728 }
10729 if val.chars().count() > 35 {
10730 return Err(ValidationError::new(
10731 1002,
10732 "frms_cd exceeds the maximum length of 35".to_string(),
10733 ));
10734 }
10735 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10736 if !pattern.is_match(val) {
10737 return Err(ValidationError::new(
10738 1005,
10739 "frms_cd does not match the required pattern".to_string(),
10740 ));
10741 }
10742 }
10743 if let Some(ref val) = self.prd {
10744 val.validate()?
10745 }
10746 if let Some(ref val) = self.tax_amt {
10747 val.validate()?
10748 }
10749 if let Some(ref val) = self.addtl_inf {
10750 if val.chars().count() < 1 {
10751 return Err(ValidationError::new(
10752 1001,
10753 "addtl_inf is shorter than the minimum length of 1".to_string(),
10754 ));
10755 }
10756 if val.chars().count() > 140 {
10757 return Err(ValidationError::new(
10758 1002,
10759 "addtl_inf exceeds the maximum length of 140".to_string(),
10760 ));
10761 }
10762 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10763 if !pattern.is_match(val) {
10764 return Err(ValidationError::new(
10765 1005,
10766 "addtl_inf does not match the required pattern".to_string(),
10767 ));
10768 }
10769 }
10770 Ok(())
10771 }
10772}
10773
10774#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10776pub struct TaxRecordDetails2 {
10777 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
10778 pub prd: Option<TaxPeriod2>,
10779 #[serde(rename = "Amt")]
10780 pub amt: ActiveOrHistoricCurrencyAndAmount,
10781}
10782
10783impl TaxRecordDetails2 {
10784 pub fn validate(&self) -> Result<(), ValidationError> {
10785 if let Some(ref val) = self.prd {
10786 val.validate()?
10787 }
10788 self.amt.validate()?;
10789 Ok(())
10790 }
10791}
10792
10793#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10795pub enum TaxRecordPeriod1Code {
10796 #[default]
10797 #[serde(rename = "MM01")]
10798 CodeMM01,
10799 #[serde(rename = "MM02")]
10800 CodeMM02,
10801 #[serde(rename = "MM03")]
10802 CodeMM03,
10803 #[serde(rename = "MM04")]
10804 CodeMM04,
10805 #[serde(rename = "MM05")]
10806 CodeMM05,
10807 #[serde(rename = "MM06")]
10808 CodeMM06,
10809 #[serde(rename = "MM07")]
10810 CodeMM07,
10811 #[serde(rename = "MM08")]
10812 CodeMM08,
10813 #[serde(rename = "MM09")]
10814 CodeMM09,
10815 #[serde(rename = "MM10")]
10816 CodeMM10,
10817 #[serde(rename = "MM11")]
10818 CodeMM11,
10819 #[serde(rename = "MM12")]
10820 CodeMM12,
10821 #[serde(rename = "QTR1")]
10822 CodeQTR1,
10823 #[serde(rename = "QTR2")]
10824 CodeQTR2,
10825 #[serde(rename = "QTR3")]
10826 CodeQTR3,
10827 #[serde(rename = "QTR4")]
10828 CodeQTR4,
10829 #[serde(rename = "HLF1")]
10830 CodeHLF1,
10831 #[serde(rename = "HLF2")]
10832 CodeHLF2,
10833}
10834
10835impl TaxRecordPeriod1Code {
10836 pub fn validate(&self) -> Result<(), ValidationError> {
10837 Ok(())
10838 }
10839}
10840
10841#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10843pub struct TechnicalInputChannel1Choice1 {
10844 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
10845 pub cd: Option<String>,
10846 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
10847 pub prtry: Option<String>,
10848}
10849
10850impl TechnicalInputChannel1Choice1 {
10851 pub fn validate(&self) -> Result<(), ValidationError> {
10852 if let Some(ref val) = self.cd {
10853 if val.chars().count() < 1 {
10854 return Err(ValidationError::new(
10855 1001,
10856 "cd is shorter than the minimum length of 1".to_string(),
10857 ));
10858 }
10859 if val.chars().count() > 4 {
10860 return Err(ValidationError::new(
10861 1002,
10862 "cd exceeds the maximum length of 4".to_string(),
10863 ));
10864 }
10865 }
10866 if let Some(ref val) = self.prtry {
10867 if val.chars().count() < 1 {
10868 return Err(ValidationError::new(
10869 1001,
10870 "prtry is shorter than the minimum length of 1".to_string(),
10871 ));
10872 }
10873 if val.chars().count() > 35 {
10874 return Err(ValidationError::new(
10875 1002,
10876 "prtry exceeds the maximum length of 35".to_string(),
10877 ));
10878 }
10879 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
10880 if !pattern.is_match(val) {
10881 return Err(ValidationError::new(
10882 1005,
10883 "prtry does not match the required pattern".to_string(),
10884 ));
10885 }
10886 }
10887 Ok(())
10888 }
10889}
10890
10891#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10893pub struct TotalTransactions61 {
10894 #[serde(rename = "TtlNtries", skip_serializing_if = "Option::is_none")]
10895 pub ttl_ntries: Option<NumberAndSumOfTransactions4>,
10896 #[serde(rename = "TtlCdtNtries", skip_serializing_if = "Option::is_none")]
10897 pub ttl_cdt_ntries: Option<NumberAndSumOfTransactions1>,
10898 #[serde(rename = "TtlDbtNtries", skip_serializing_if = "Option::is_none")]
10899 pub ttl_dbt_ntries: Option<NumberAndSumOfTransactions1>,
10900 #[serde(rename = "TtlNtriesPerBkTxCd", skip_serializing_if = "Option::is_none")]
10901 pub ttl_ntries_per_bk_tx_cd: Option<Vec<TotalsPerBankTransactionCode51>>,
10902}
10903
10904impl TotalTransactions61 {
10905 pub fn validate(&self) -> Result<(), ValidationError> {
10906 if let Some(ref val) = self.ttl_ntries {
10907 val.validate()?
10908 }
10909 if let Some(ref val) = self.ttl_cdt_ntries {
10910 val.validate()?
10911 }
10912 if let Some(ref val) = self.ttl_dbt_ntries {
10913 val.validate()?
10914 }
10915 if let Some(ref vec) = self.ttl_ntries_per_bk_tx_cd {
10916 for item in vec {
10917 item.validate()?
10918 }
10919 }
10920 Ok(())
10921 }
10922}
10923
10924#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10926pub struct TotalsPerBankTransactionCode51 {
10927 #[serde(rename = "NbOfNtries", skip_serializing_if = "Option::is_none")]
10928 pub nb_of_ntries: Option<String>,
10929 #[serde(rename = "Sum", skip_serializing_if = "Option::is_none")]
10930 pub sum: Option<f64>,
10931 #[serde(rename = "TtlNetNtry", skip_serializing_if = "Option::is_none")]
10932 pub ttl_net_ntry: Option<AmountAndDirection35>,
10933 #[serde(rename = "CdtNtries", skip_serializing_if = "Option::is_none")]
10934 pub cdt_ntries: Option<NumberAndSumOfTransactions1>,
10935 #[serde(rename = "DbtNtries", skip_serializing_if = "Option::is_none")]
10936 pub dbt_ntries: Option<NumberAndSumOfTransactions1>,
10937 #[serde(rename = "FcstInd", skip_serializing_if = "Option::is_none")]
10938 pub fcst_ind: Option<bool>,
10939 #[serde(rename = "BkTxCd")]
10940 pub bk_tx_cd: BankTransactionCodeStructure41,
10941 #[serde(rename = "Avlbty", skip_serializing_if = "Option::is_none")]
10942 pub avlbty: Option<Vec<CashAvailability1>>,
10943 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
10944 pub dt: Option<DateAndDateTime2Choice1>,
10945}
10946
10947impl TotalsPerBankTransactionCode51 {
10948 pub fn validate(&self) -> Result<(), ValidationError> {
10949 if let Some(ref val) = self.nb_of_ntries {
10950 let pattern = Regex::new("[0-9]{1,15}").unwrap();
10951 if !pattern.is_match(val) {
10952 return Err(ValidationError::new(
10953 1005,
10954 "nb_of_ntries does not match the required pattern".to_string(),
10955 ));
10956 }
10957 }
10958 if let Some(ref val) = self.ttl_net_ntry {
10959 val.validate()?
10960 }
10961 if let Some(ref val) = self.cdt_ntries {
10962 val.validate()?
10963 }
10964 if let Some(ref val) = self.dbt_ntries {
10965 val.validate()?
10966 }
10967 self.bk_tx_cd.validate()?;
10968 if let Some(ref vec) = self.avlbty {
10969 for item in vec {
10970 item.validate()?
10971 }
10972 }
10973 if let Some(ref val) = self.dt {
10974 val.validate()?
10975 }
10976 Ok(())
10977 }
10978}
10979
10980#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
10982pub struct TrackData11 {
10983 #[serde(rename = "TrckNb", skip_serializing_if = "Option::is_none")]
10984 pub trck_nb: Option<String>,
10985 #[serde(rename = "TrckVal")]
10986 pub trck_val: String,
10987}
10988
10989impl TrackData11 {
10990 pub fn validate(&self) -> Result<(), ValidationError> {
10991 if let Some(ref val) = self.trck_nb {
10992 let pattern = Regex::new("[0-9]").unwrap();
10993 if !pattern.is_match(val) {
10994 return Err(ValidationError::new(
10995 1005,
10996 "trck_nb does not match the required pattern".to_string(),
10997 ));
10998 }
10999 }
11000 if self.trck_val.chars().count() < 1 {
11001 return Err(ValidationError::new(
11002 1001,
11003 "trck_val is shorter than the minimum length of 1".to_string(),
11004 ));
11005 }
11006 if self.trck_val.chars().count() > 140 {
11007 return Err(ValidationError::new(
11008 1002,
11009 "trck_val exceeds the maximum length of 140".to_string(),
11010 ));
11011 }
11012 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11013 if !pattern.is_match(&self.trck_val) {
11014 return Err(ValidationError::new(
11015 1005,
11016 "trck_val 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 TransactionAgents51 {
11026 #[serde(rename = "InstgAgt", skip_serializing_if = "Option::is_none")]
11027 pub instg_agt: Option<BranchAndFinancialInstitutionIdentification64>,
11028 #[serde(rename = "InstdAgt", skip_serializing_if = "Option::is_none")]
11029 pub instd_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11030 #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
11031 pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11032 #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
11033 pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11034 #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
11035 pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification62>,
11036 #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
11037 pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification63>,
11038 #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
11039 pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification62>,
11040 #[serde(rename = "RcvgAgt", skip_serializing_if = "Option::is_none")]
11041 pub rcvg_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11042 #[serde(rename = "DlvrgAgt", skip_serializing_if = "Option::is_none")]
11043 pub dlvrg_agt: Option<BranchAndFinancialInstitutionIdentification63>,
11044 #[serde(rename = "IssgAgt", skip_serializing_if = "Option::is_none")]
11045 pub issg_agt: Option<BranchAndFinancialInstitutionIdentification62>,
11046 #[serde(rename = "SttlmPlc", skip_serializing_if = "Option::is_none")]
11047 pub sttlm_plc: Option<BranchAndFinancialInstitutionIdentification63>,
11048 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11049 pub prtry: Option<Vec<ProprietaryAgent41>>,
11050}
11051
11052impl TransactionAgents51 {
11053 pub fn validate(&self) -> Result<(), ValidationError> {
11054 if let Some(ref val) = self.instg_agt {
11055 val.validate()?
11056 }
11057 if let Some(ref val) = self.instd_agt {
11058 val.validate()?
11059 }
11060 if let Some(ref val) = self.dbtr_agt {
11061 val.validate()?
11062 }
11063 if let Some(ref val) = self.cdtr_agt {
11064 val.validate()?
11065 }
11066 if let Some(ref val) = self.intrmy_agt1 {
11067 val.validate()?
11068 }
11069 if let Some(ref val) = self.intrmy_agt2 {
11070 val.validate()?
11071 }
11072 if let Some(ref val) = self.intrmy_agt3 {
11073 val.validate()?
11074 }
11075 if let Some(ref val) = self.rcvg_agt {
11076 val.validate()?
11077 }
11078 if let Some(ref val) = self.dlvrg_agt {
11079 val.validate()?
11080 }
11081 if let Some(ref val) = self.issg_agt {
11082 val.validate()?
11083 }
11084 if let Some(ref val) = self.sttlm_plc {
11085 val.validate()?
11086 }
11087 if let Some(ref vec) = self.prtry {
11088 for item in vec {
11089 item.validate()?
11090 }
11091 }
11092 Ok(())
11093 }
11094}
11095
11096#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11098pub enum TransactionChannel1Code {
11099 #[default]
11100 #[serde(rename = "MAIL")]
11101 CodeMAIL,
11102 #[serde(rename = "TLPH")]
11103 CodeTLPH,
11104 #[serde(rename = "ECOM")]
11105 CodeECOM,
11106 #[serde(rename = "TVPY")]
11107 CodeTVPY,
11108}
11109
11110impl TransactionChannel1Code {
11111 pub fn validate(&self) -> Result<(), ValidationError> {
11112 Ok(())
11113 }
11114}
11115
11116#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11118pub struct TransactionDates31 {
11119 #[serde(rename = "AccptncDtTm", skip_serializing_if = "Option::is_none")]
11120 pub accptnc_dt_tm: Option<String>,
11121 #[serde(
11122 rename = "TradActvtyCtrctlSttlmDt",
11123 skip_serializing_if = "Option::is_none"
11124 )]
11125 pub trad_actvty_ctrctl_sttlm_dt: Option<String>,
11126 #[serde(rename = "TradDt", skip_serializing_if = "Option::is_none")]
11127 pub trad_dt: Option<String>,
11128 #[serde(rename = "IntrBkSttlmDt", skip_serializing_if = "Option::is_none")]
11129 pub intr_bk_sttlm_dt: Option<String>,
11130 #[serde(rename = "StartDt", skip_serializing_if = "Option::is_none")]
11131 pub start_dt: Option<String>,
11132 #[serde(rename = "EndDt", skip_serializing_if = "Option::is_none")]
11133 pub end_dt: Option<String>,
11134 #[serde(rename = "TxDtTm", skip_serializing_if = "Option::is_none")]
11135 pub tx_dt_tm: Option<String>,
11136 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11137 pub prtry: Option<Vec<ProprietaryDate31>>,
11138}
11139
11140impl TransactionDates31 {
11141 pub fn validate(&self) -> Result<(), ValidationError> {
11142 if let Some(ref val) = self.accptnc_dt_tm {
11143 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
11144 if !pattern.is_match(val) {
11145 return Err(ValidationError::new(
11146 1005,
11147 "accptnc_dt_tm does not match the required pattern".to_string(),
11148 ));
11149 }
11150 }
11151 if let Some(ref val) = self.tx_dt_tm {
11152 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
11153 if !pattern.is_match(val) {
11154 return Err(ValidationError::new(
11155 1005,
11156 "tx_dt_tm does not match the required pattern".to_string(),
11157 ));
11158 }
11159 }
11160 if let Some(ref vec) = self.prtry {
11161 for item in vec {
11162 item.validate()?
11163 }
11164 }
11165 Ok(())
11166 }
11167}
11168
11169#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11171pub enum TransactionEnvironment1Code {
11172 #[default]
11173 #[serde(rename = "MERC")]
11174 CodeMERC,
11175 #[serde(rename = "PRIV")]
11176 CodePRIV,
11177 #[serde(rename = "PUBL")]
11178 CodePUBL,
11179}
11180
11181impl TransactionEnvironment1Code {
11182 pub fn validate(&self) -> Result<(), ValidationError> {
11183 Ok(())
11184 }
11185}
11186
11187#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11189pub struct TransactionIdentifier11 {
11190 #[serde(rename = "TxDtTm")]
11191 pub tx_dt_tm: String,
11192 #[serde(rename = "TxRef")]
11193 pub tx_ref: String,
11194}
11195
11196impl TransactionIdentifier11 {
11197 pub fn validate(&self) -> Result<(), ValidationError> {
11198 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
11199 if !pattern.is_match(&self.tx_dt_tm) {
11200 return Err(ValidationError::new(
11201 1005,
11202 "tx_dt_tm does not match the required pattern".to_string(),
11203 ));
11204 }
11205 if self.tx_ref.chars().count() < 1 {
11206 return Err(ValidationError::new(
11207 1001,
11208 "tx_ref is shorter than the minimum length of 1".to_string(),
11209 ));
11210 }
11211 if self.tx_ref.chars().count() > 35 {
11212 return Err(ValidationError::new(
11213 1002,
11214 "tx_ref exceeds the maximum length of 35".to_string(),
11215 ));
11216 }
11217 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11218 if !pattern.is_match(&self.tx_ref) {
11219 return Err(ValidationError::new(
11220 1005,
11221 "tx_ref does not match the required pattern".to_string(),
11222 ));
11223 }
11224 Ok(())
11225 }
11226}
11227
11228#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11230pub struct TransactionInterest41 {
11231 #[serde(rename = "TtlIntrstAndTaxAmt", skip_serializing_if = "Option::is_none")]
11232 pub ttl_intrst_and_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
11233 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
11234 pub rcrd: Option<Vec<InterestRecord21>>,
11235}
11236
11237impl TransactionInterest41 {
11238 pub fn validate(&self) -> Result<(), ValidationError> {
11239 if let Some(ref val) = self.ttl_intrst_and_tax_amt {
11240 val.validate()?
11241 }
11242 if let Some(ref vec) = self.rcrd {
11243 for item in vec {
11244 item.validate()?
11245 }
11246 }
11247 Ok(())
11248 }
11249}
11250
11251#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11253pub struct TransactionParties61 {
11254 #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
11255 pub initg_pty: Option<Party40Choice1>,
11256 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
11257 pub dbtr: Option<Party40Choice2>,
11258 #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
11259 pub dbtr_acct: Option<CashAccount382>,
11260 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
11261 pub ultmt_dbtr: Option<Party40Choice1>,
11262 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
11263 pub cdtr: Option<Party40Choice1>,
11264 #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
11265 pub cdtr_acct: Option<CashAccount382>,
11266 #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
11267 pub ultmt_cdtr: Option<Party40Choice1>,
11268 #[serde(rename = "TradgPty", skip_serializing_if = "Option::is_none")]
11269 pub tradg_pty: Option<Party40Choice3>,
11270 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11271 pub prtry: Option<Vec<ProprietaryParty51>>,
11272}
11273
11274impl TransactionParties61 {
11275 pub fn validate(&self) -> Result<(), ValidationError> {
11276 if let Some(ref val) = self.initg_pty {
11277 val.validate()?
11278 }
11279 if let Some(ref val) = self.dbtr {
11280 val.validate()?
11281 }
11282 if let Some(ref val) = self.dbtr_acct {
11283 val.validate()?
11284 }
11285 if let Some(ref val) = self.ultmt_dbtr {
11286 val.validate()?
11287 }
11288 if let Some(ref val) = self.cdtr {
11289 val.validate()?
11290 }
11291 if let Some(ref val) = self.cdtr_acct {
11292 val.validate()?
11293 }
11294 if let Some(ref val) = self.ultmt_cdtr {
11295 val.validate()?
11296 }
11297 if let Some(ref val) = self.tradg_pty {
11298 val.validate()?
11299 }
11300 if let Some(ref vec) = self.prtry {
11301 for item in vec {
11302 item.validate()?
11303 }
11304 }
11305 Ok(())
11306 }
11307}
11308
11309#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11311pub struct TransactionPrice4Choice1 {
11312 #[serde(rename = "DealPric", skip_serializing_if = "Option::is_none")]
11313 pub deal_pric: Option<Price71>,
11314 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11315 pub prtry: Option<Vec<ProprietaryPrice21>>,
11316}
11317
11318impl TransactionPrice4Choice1 {
11319 pub fn validate(&self) -> Result<(), ValidationError> {
11320 if let Some(ref val) = self.deal_pric {
11321 val.validate()?
11322 }
11323 if let Some(ref vec) = self.prtry {
11324 for item in vec {
11325 item.validate()?
11326 }
11327 }
11328 Ok(())
11329 }
11330}
11331
11332#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11334pub struct TransactionQuantities3Choice1 {
11335 #[serde(rename = "Qty", skip_serializing_if = "Option::is_none")]
11336 pub qty: Option<FinancialInstrumentQuantity1Choice>,
11337 #[serde(rename = "OrgnlAndCurFaceAmt", skip_serializing_if = "Option::is_none")]
11338 pub orgnl_and_cur_face_amt: Option<OriginalAndCurrentQuantities1>,
11339 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11340 pub prtry: Option<ProprietaryQuantity11>,
11341}
11342
11343impl TransactionQuantities3Choice1 {
11344 pub fn validate(&self) -> Result<(), ValidationError> {
11345 if let Some(ref val) = self.qty {
11346 val.validate()?
11347 }
11348 if let Some(ref val) = self.orgnl_and_cur_face_amt {
11349 val.validate()?
11350 }
11351 if let Some(ref val) = self.prtry {
11352 val.validate()?
11353 }
11354 Ok(())
11355 }
11356}
11357
11358#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11360pub struct TransactionReferences61 {
11361 #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
11362 pub msg_id: Option<String>,
11363 #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
11364 pub acct_svcr_ref: Option<String>,
11365 #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
11366 pub pmt_inf_id: Option<String>,
11367 #[serde(rename = "InstrId", skip_serializing_if = "Option::is_none")]
11368 pub instr_id: Option<String>,
11369 #[serde(rename = "EndToEndId", skip_serializing_if = "Option::is_none")]
11370 pub end_to_end_id: Option<String>,
11371 #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
11372 pub uetr: Option<String>,
11373 #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
11374 pub tx_id: Option<String>,
11375 #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
11376 pub mndt_id: Option<String>,
11377 #[serde(rename = "ChqNb", skip_serializing_if = "Option::is_none")]
11378 pub chq_nb: Option<String>,
11379 #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
11380 pub clr_sys_ref: Option<String>,
11381 #[serde(rename = "AcctOwnrTxId", skip_serializing_if = "Option::is_none")]
11382 pub acct_ownr_tx_id: Option<String>,
11383 #[serde(rename = "AcctSvcrTxId", skip_serializing_if = "Option::is_none")]
11384 pub acct_svcr_tx_id: Option<String>,
11385 #[serde(rename = "MktInfrstrctrTxId", skip_serializing_if = "Option::is_none")]
11386 pub mkt_infrstrctr_tx_id: Option<String>,
11387 #[serde(rename = "PrcgId", skip_serializing_if = "Option::is_none")]
11388 pub prcg_id: Option<String>,
11389 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
11390 pub prtry: Option<Vec<ProprietaryReference11>>,
11391}
11392
11393impl TransactionReferences61 {
11394 pub fn validate(&self) -> Result<(), ValidationError> {
11395 if let Some(ref val) = self.msg_id {
11396 if val.chars().count() < 1 {
11397 return Err(ValidationError::new(
11398 1001,
11399 "msg_id is shorter than the minimum length of 1".to_string(),
11400 ));
11401 }
11402 if val.chars().count() > 35 {
11403 return Err(ValidationError::new(
11404 1002,
11405 "msg_id exceeds the maximum length of 35".to_string(),
11406 ));
11407 }
11408 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11409 if !pattern.is_match(val) {
11410 return Err(ValidationError::new(
11411 1005,
11412 "msg_id does not match the required pattern".to_string(),
11413 ));
11414 }
11415 }
11416 if let Some(ref val) = self.acct_svcr_ref {
11417 if val.chars().count() < 1 {
11418 return Err(ValidationError::new(
11419 1001,
11420 "acct_svcr_ref is shorter than the minimum length of 1".to_string(),
11421 ));
11422 }
11423 if val.chars().count() > 35 {
11424 return Err(ValidationError::new(
11425 1002,
11426 "acct_svcr_ref exceeds the maximum length of 35".to_string(),
11427 ));
11428 }
11429 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11430 if !pattern.is_match(val) {
11431 return Err(ValidationError::new(
11432 1005,
11433 "acct_svcr_ref does not match the required pattern".to_string(),
11434 ));
11435 }
11436 }
11437 if let Some(ref val) = self.pmt_inf_id {
11438 if val.chars().count() < 1 {
11439 return Err(ValidationError::new(
11440 1001,
11441 "pmt_inf_id is shorter than the minimum length of 1".to_string(),
11442 ));
11443 }
11444 if val.chars().count() > 35 {
11445 return Err(ValidationError::new(
11446 1002,
11447 "pmt_inf_id exceeds the maximum length of 35".to_string(),
11448 ));
11449 }
11450 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11451 if !pattern.is_match(val) {
11452 return Err(ValidationError::new(
11453 1005,
11454 "pmt_inf_id does not match the required pattern".to_string(),
11455 ));
11456 }
11457 }
11458 if let Some(ref val) = self.instr_id {
11459 if val.chars().count() < 1 {
11460 return Err(ValidationError::new(
11461 1001,
11462 "instr_id is shorter than the minimum length of 1".to_string(),
11463 ));
11464 }
11465 if val.chars().count() > 35 {
11466 return Err(ValidationError::new(
11467 1002,
11468 "instr_id exceeds the maximum length of 35".to_string(),
11469 ));
11470 }
11471 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11472 if !pattern.is_match(val) {
11473 return Err(ValidationError::new(
11474 1005,
11475 "instr_id does not match the required pattern".to_string(),
11476 ));
11477 }
11478 }
11479 if let Some(ref val) = self.end_to_end_id {
11480 if val.chars().count() < 1 {
11481 return Err(ValidationError::new(
11482 1001,
11483 "end_to_end_id is shorter than the minimum length of 1".to_string(),
11484 ));
11485 }
11486 if val.chars().count() > 35 {
11487 return Err(ValidationError::new(
11488 1002,
11489 "end_to_end_id exceeds the maximum length of 35".to_string(),
11490 ));
11491 }
11492 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11493 if !pattern.is_match(val) {
11494 return Err(ValidationError::new(
11495 1005,
11496 "end_to_end_id does not match the required pattern".to_string(),
11497 ));
11498 }
11499 }
11500 if let Some(ref val) = self.uetr {
11501 let pattern =
11502 Regex::new("[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}")
11503 .unwrap();
11504 if !pattern.is_match(val) {
11505 return Err(ValidationError::new(
11506 1005,
11507 "uetr does not match the required pattern".to_string(),
11508 ));
11509 }
11510 }
11511 if let Some(ref val) = self.tx_id {
11512 if val.chars().count() < 1 {
11513 return Err(ValidationError::new(
11514 1001,
11515 "tx_id is shorter than the minimum length of 1".to_string(),
11516 ));
11517 }
11518 if val.chars().count() > 35 {
11519 return Err(ValidationError::new(
11520 1002,
11521 "tx_id exceeds the maximum length of 35".to_string(),
11522 ));
11523 }
11524 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11525 if !pattern.is_match(val) {
11526 return Err(ValidationError::new(
11527 1005,
11528 "tx_id does not match the required pattern".to_string(),
11529 ));
11530 }
11531 }
11532 if let Some(ref val) = self.mndt_id {
11533 if val.chars().count() < 1 {
11534 return Err(ValidationError::new(
11535 1001,
11536 "mndt_id is shorter than the minimum length of 1".to_string(),
11537 ));
11538 }
11539 if val.chars().count() > 35 {
11540 return Err(ValidationError::new(
11541 1002,
11542 "mndt_id exceeds the maximum length of 35".to_string(),
11543 ));
11544 }
11545 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11546 if !pattern.is_match(val) {
11547 return Err(ValidationError::new(
11548 1005,
11549 "mndt_id does not match the required pattern".to_string(),
11550 ));
11551 }
11552 }
11553 if let Some(ref val) = self.chq_nb {
11554 if val.chars().count() < 1 {
11555 return Err(ValidationError::new(
11556 1001,
11557 "chq_nb is shorter than the minimum length of 1".to_string(),
11558 ));
11559 }
11560 if val.chars().count() > 35 {
11561 return Err(ValidationError::new(
11562 1002,
11563 "chq_nb exceeds the maximum length of 35".to_string(),
11564 ));
11565 }
11566 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11567 if !pattern.is_match(val) {
11568 return Err(ValidationError::new(
11569 1005,
11570 "chq_nb does not match the required pattern".to_string(),
11571 ));
11572 }
11573 }
11574 if let Some(ref val) = self.clr_sys_ref {
11575 if val.chars().count() < 1 {
11576 return Err(ValidationError::new(
11577 1001,
11578 "clr_sys_ref is shorter than the minimum length of 1".to_string(),
11579 ));
11580 }
11581 if val.chars().count() > 35 {
11582 return Err(ValidationError::new(
11583 1002,
11584 "clr_sys_ref exceeds the maximum length of 35".to_string(),
11585 ));
11586 }
11587 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11588 if !pattern.is_match(val) {
11589 return Err(ValidationError::new(
11590 1005,
11591 "clr_sys_ref does not match the required pattern".to_string(),
11592 ));
11593 }
11594 }
11595 if let Some(ref val) = self.acct_ownr_tx_id {
11596 if val.chars().count() < 1 {
11597 return Err(ValidationError::new(
11598 1001,
11599 "acct_ownr_tx_id is shorter than the minimum length of 1".to_string(),
11600 ));
11601 }
11602 if val.chars().count() > 35 {
11603 return Err(ValidationError::new(
11604 1002,
11605 "acct_ownr_tx_id exceeds the maximum length of 35".to_string(),
11606 ));
11607 }
11608 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11609 if !pattern.is_match(val) {
11610 return Err(ValidationError::new(
11611 1005,
11612 "acct_ownr_tx_id does not match the required pattern".to_string(),
11613 ));
11614 }
11615 }
11616 if let Some(ref val) = self.acct_svcr_tx_id {
11617 if val.chars().count() < 1 {
11618 return Err(ValidationError::new(
11619 1001,
11620 "acct_svcr_tx_id is shorter than the minimum length of 1".to_string(),
11621 ));
11622 }
11623 if val.chars().count() > 35 {
11624 return Err(ValidationError::new(
11625 1002,
11626 "acct_svcr_tx_id exceeds the maximum length of 35".to_string(),
11627 ));
11628 }
11629 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11630 if !pattern.is_match(val) {
11631 return Err(ValidationError::new(
11632 1005,
11633 "acct_svcr_tx_id does not match the required pattern".to_string(),
11634 ));
11635 }
11636 }
11637 if let Some(ref val) = self.mkt_infrstrctr_tx_id {
11638 if val.chars().count() < 1 {
11639 return Err(ValidationError::new(
11640 1001,
11641 "mkt_infrstrctr_tx_id is shorter than the minimum length of 1".to_string(),
11642 ));
11643 }
11644 if val.chars().count() > 35 {
11645 return Err(ValidationError::new(
11646 1002,
11647 "mkt_infrstrctr_tx_id exceeds the maximum length of 35".to_string(),
11648 ));
11649 }
11650 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11651 if !pattern.is_match(val) {
11652 return Err(ValidationError::new(
11653 1005,
11654 "mkt_infrstrctr_tx_id does not match the required pattern".to_string(),
11655 ));
11656 }
11657 }
11658 if let Some(ref val) = self.prcg_id {
11659 if val.chars().count() < 1 {
11660 return Err(ValidationError::new(
11661 1001,
11662 "prcg_id is shorter than the minimum length of 1".to_string(),
11663 ));
11664 }
11665 if val.chars().count() > 35 {
11666 return Err(ValidationError::new(
11667 1002,
11668 "prcg_id exceeds the maximum length of 35".to_string(),
11669 ));
11670 }
11671 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
11672 if !pattern.is_match(val) {
11673 return Err(ValidationError::new(
11674 1005,
11675 "prcg_id does not match the required pattern".to_string(),
11676 ));
11677 }
11678 }
11679 if let Some(ref vec) = self.prtry {
11680 for item in vec {
11681 item.validate()?
11682 }
11683 }
11684 Ok(())
11685 }
11686}
11687
11688#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11690pub enum UnitOfMeasure1Code {
11691 #[default]
11692 #[serde(rename = "PIEC")]
11693 CodePIEC,
11694 #[serde(rename = "TONS")]
11695 CodeTONS,
11696 #[serde(rename = "FOOT")]
11697 CodeFOOT,
11698 #[serde(rename = "GBGA")]
11699 CodeGBGA,
11700 #[serde(rename = "USGA")]
11701 CodeUSGA,
11702 #[serde(rename = "GRAM")]
11703 CodeGRAM,
11704 #[serde(rename = "INCH")]
11705 CodeINCH,
11706 #[serde(rename = "KILO")]
11707 CodeKILO,
11708 #[serde(rename = "PUND")]
11709 CodePUND,
11710 #[serde(rename = "METR")]
11711 CodeMETR,
11712 #[serde(rename = "CMET")]
11713 CodeCMET,
11714 #[serde(rename = "MMET")]
11715 CodeMMET,
11716 #[serde(rename = "LITR")]
11717 CodeLITR,
11718 #[serde(rename = "CELI")]
11719 CodeCELI,
11720 #[serde(rename = "MILI")]
11721 CodeMILI,
11722 #[serde(rename = "GBOU")]
11723 CodeGBOU,
11724 #[serde(rename = "USOU")]
11725 CodeUSOU,
11726 #[serde(rename = "GBQA")]
11727 CodeGBQA,
11728 #[serde(rename = "USQA")]
11729 CodeUSQA,
11730 #[serde(rename = "GBPI")]
11731 CodeGBPI,
11732 #[serde(rename = "USPI")]
11733 CodeUSPI,
11734 #[serde(rename = "MILE")]
11735 CodeMILE,
11736 #[serde(rename = "KMET")]
11737 CodeKMET,
11738 #[serde(rename = "YARD")]
11739 CodeYARD,
11740 #[serde(rename = "SQKI")]
11741 CodeSQKI,
11742 #[serde(rename = "HECT")]
11743 CodeHECT,
11744 #[serde(rename = "ARES")]
11745 CodeARES,
11746 #[serde(rename = "SMET")]
11747 CodeSMET,
11748 #[serde(rename = "SCMT")]
11749 CodeSCMT,
11750 #[serde(rename = "SMIL")]
11751 CodeSMIL,
11752 #[serde(rename = "SQMI")]
11753 CodeSQMI,
11754 #[serde(rename = "SQYA")]
11755 CodeSQYA,
11756 #[serde(rename = "SQFO")]
11757 CodeSQFO,
11758 #[serde(rename = "SQIN")]
11759 CodeSQIN,
11760 #[serde(rename = "ACRE")]
11761 CodeACRE,
11762}
11763
11764impl UnitOfMeasure1Code {
11765 pub fn validate(&self) -> Result<(), ValidationError> {
11766 Ok(())
11767 }
11768}
11769
11770#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11772pub enum UserInterface2Code {
11773 #[default]
11774 #[serde(rename = "MDSP")]
11775 CodeMDSP,
11776 #[serde(rename = "CDSP")]
11777 CodeCDSP,
11778}
11779
11780impl UserInterface2Code {
11781 pub fn validate(&self) -> Result<(), ValidationError> {
11782 Ok(())
11783 }
11784}
11785
11786#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
11788pub struct YieldedOrValueType1Choice {
11789 #[serde(rename = "Yldd", skip_serializing_if = "Option::is_none")]
11790 pub yldd: Option<bool>,
11791 #[serde(rename = "ValTp", skip_serializing_if = "Option::is_none")]
11792 pub val_tp: Option<PriceValueType1Code>,
11793}
11794
11795impl YieldedOrValueType1Choice {
11796 pub fn validate(&self) -> Result<(), ValidationError> {
11797 if let Some(ref val) = self.val_tp {
11798 val.validate()?
11799 }
11800 Ok(())
11801 }
11802}