1use crate::error::*;
21use regex::Regex;
22use serde::{Deserialize, Serialize};
23
24#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
26pub struct AccountIdentification4Choice {
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<GenericAccountIdentification1>,
31}
32
33impl AccountIdentification4Choice {
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 AccountIdentification4Choice1 {
54 #[serde(rename = "IBAN", skip_serializing_if = "Option::is_none")]
55 pub iban: Option<String>,
56 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
57 pub othr: Option<GenericAccountIdentification11>,
58}
59
60impl AccountIdentification4Choice1 {
61 pub fn validate(&self) -> Result<(), ValidationError> {
62 if let Some(ref val) = self.iban {
63 let pattern = Regex::new("[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}").unwrap();
64 if !pattern.is_match(val) {
65 return Err(ValidationError::new(
66 1005,
67 "iban does not match the required pattern".to_string(),
68 ));
69 }
70 }
71 if let Some(ref val) = self.othr {
72 val.validate()?
73 }
74 Ok(())
75 }
76}
77
78#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
80pub struct AccountSchemeName1Choice {
81 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
82 pub cd: Option<String>,
83 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
84 pub prtry: Option<String>,
85}
86
87impl AccountSchemeName1Choice {
88 pub fn validate(&self) -> Result<(), ValidationError> {
89 if let Some(ref val) = self.cd {
90 if val.chars().count() < 1 {
91 return Err(ValidationError::new(
92 1001,
93 "cd is shorter than the minimum length of 1".to_string(),
94 ));
95 }
96 if val.chars().count() > 4 {
97 return Err(ValidationError::new(
98 1002,
99 "cd exceeds the maximum length of 4".to_string(),
100 ));
101 }
102 }
103 if let Some(ref val) = self.prtry {
104 if val.chars().count() < 1 {
105 return Err(ValidationError::new(
106 1001,
107 "prtry is shorter than the minimum length of 1".to_string(),
108 ));
109 }
110 if val.chars().count() > 35 {
111 return Err(ValidationError::new(
112 1002,
113 "prtry exceeds the maximum length of 35".to_string(),
114 ));
115 }
116 }
117 Ok(())
118 }
119}
120
121#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
123pub struct AccountSchemeName1Choice1 {
124 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
125 pub cd: Option<String>,
126 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
127 pub prtry: Option<String>,
128}
129
130impl AccountSchemeName1Choice1 {
131 pub fn validate(&self) -> Result<(), ValidationError> {
132 if let Some(ref val) = self.cd {
133 if val.chars().count() < 1 {
134 return Err(ValidationError::new(
135 1001,
136 "cd is shorter than the minimum length of 1".to_string(),
137 ));
138 }
139 if val.chars().count() > 4 {
140 return Err(ValidationError::new(
141 1002,
142 "cd exceeds the maximum length of 4".to_string(),
143 ));
144 }
145 }
146 if let Some(ref val) = self.prtry {
147 if val.chars().count() < 1 {
148 return Err(ValidationError::new(
149 1001,
150 "prtry is shorter than the minimum length of 1".to_string(),
151 ));
152 }
153 if val.chars().count() > 35 {
154 return Err(ValidationError::new(
155 1002,
156 "prtry exceeds the maximum length of 35".to_string(),
157 ));
158 }
159 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
160 if !pattern.is_match(val) {
161 return Err(ValidationError::new(
162 1005,
163 "prtry does not match the required pattern".to_string(),
164 ));
165 }
166 }
167 Ok(())
168 }
169}
170
171#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
173pub struct ActiveOrHistoricCurrencyAndAmount {
174 #[serde(rename = "@Ccy")]
175 pub ccy: String,
176 #[serde(rename = "$value")]
177 pub value: f64,
178}
179
180impl ActiveOrHistoricCurrencyAndAmount {
181 pub fn validate(&self) -> Result<(), ValidationError> {
182 Ok(())
183 }
184}
185
186#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
188pub struct AmendmentInformationDetails131 {
189 #[serde(rename = "OrgnlMndtId", skip_serializing_if = "Option::is_none")]
190 pub orgnl_mndt_id: Option<String>,
191 #[serde(rename = "OrgnlCdtrSchmeId", skip_serializing_if = "Option::is_none")]
192 pub orgnl_cdtr_schme_id: Option<PartyIdentification1354>,
193 #[serde(rename = "OrgnlCdtrAgt", skip_serializing_if = "Option::is_none")]
194 pub orgnl_cdtr_agt: Option<BranchAndFinancialInstitutionIdentification64>,
195 #[serde(rename = "OrgnlCdtrAgtAcct", skip_serializing_if = "Option::is_none")]
196 pub orgnl_cdtr_agt_acct: Option<CashAccount38>,
197 #[serde(rename = "OrgnlDbtr", skip_serializing_if = "Option::is_none")]
198 pub orgnl_dbtr: Option<PartyIdentification1354>,
199 #[serde(rename = "OrgnlDbtrAcct", skip_serializing_if = "Option::is_none")]
200 pub orgnl_dbtr_acct: Option<CashAccount38>,
201 #[serde(rename = "OrgnlDbtrAgt", skip_serializing_if = "Option::is_none")]
202 pub orgnl_dbtr_agt: Option<BranchAndFinancialInstitutionIdentification65>,
203 #[serde(rename = "OrgnlDbtrAgtAcct", skip_serializing_if = "Option::is_none")]
204 pub orgnl_dbtr_agt_acct: Option<CashAccount38>,
205 #[serde(rename = "OrgnlFnlColltnDt", skip_serializing_if = "Option::is_none")]
206 pub orgnl_fnl_colltn_dt: Option<String>,
207 #[serde(rename = "OrgnlFrqcy", skip_serializing_if = "Option::is_none")]
208 pub orgnl_frqcy: Option<Frequency36Choice>,
209 #[serde(rename = "OrgnlRsn", skip_serializing_if = "Option::is_none")]
210 pub orgnl_rsn: Option<MandateSetupReason1Choice>,
211 #[serde(rename = "OrgnlTrckgDays", skip_serializing_if = "Option::is_none")]
212 pub orgnl_trckg_days: Option<String>,
213}
214
215impl AmendmentInformationDetails131 {
216 pub fn validate(&self) -> Result<(), ValidationError> {
217 if let Some(ref val) = self.orgnl_mndt_id {
218 if val.chars().count() < 1 {
219 return Err(ValidationError::new(
220 1001,
221 "orgnl_mndt_id is shorter than the minimum length of 1".to_string(),
222 ));
223 }
224 if val.chars().count() > 35 {
225 return Err(ValidationError::new(
226 1002,
227 "orgnl_mndt_id exceeds the maximum length of 35".to_string(),
228 ));
229 }
230 }
231 if let Some(ref val) = self.orgnl_cdtr_schme_id {
232 val.validate()?
233 }
234 if let Some(ref val) = self.orgnl_cdtr_agt {
235 val.validate()?
236 }
237 if let Some(ref val) = self.orgnl_cdtr_agt_acct {
238 val.validate()?
239 }
240 if let Some(ref val) = self.orgnl_dbtr {
241 val.validate()?
242 }
243 if let Some(ref val) = self.orgnl_dbtr_acct {
244 val.validate()?
245 }
246 if let Some(ref val) = self.orgnl_dbtr_agt {
247 val.validate()?
248 }
249 if let Some(ref val) = self.orgnl_dbtr_agt_acct {
250 val.validate()?
251 }
252 if let Some(ref val) = self.orgnl_frqcy {
253 val.validate()?
254 }
255 if let Some(ref val) = self.orgnl_rsn {
256 val.validate()?
257 }
258 if let Some(ref val) = self.orgnl_trckg_days {
259 let pattern = Regex::new("[0-9]{2}").unwrap();
260 if !pattern.is_match(val) {
261 return Err(ValidationError::new(
262 1005,
263 "orgnl_trckg_days does not match the required pattern".to_string(),
264 ));
265 }
266 }
267 Ok(())
268 }
269}
270
271#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
273pub struct AmountType4Choice1 {
274 #[serde(rename = "InstdAmt", skip_serializing_if = "Option::is_none")]
275 pub instd_amt: Option<CBPRAmount1>,
276 #[serde(rename = "EqvtAmt", skip_serializing_if = "Option::is_none")]
277 pub eqvt_amt: Option<EquivalentAmount21>,
278}
279
280impl AmountType4Choice1 {
281 pub fn validate(&self) -> Result<(), ValidationError> {
282 if let Some(ref val) = self.instd_amt {
283 val.validate()?
284 }
285 if let Some(ref val) = self.eqvt_amt {
286 val.validate()?
287 }
288 Ok(())
289 }
290}
291
292#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
294pub struct BranchAndFinancialInstitutionIdentification61 {
295 #[serde(rename = "FinInstnId")]
296 pub fin_instn_id: FinancialInstitutionIdentification181,
297}
298
299impl BranchAndFinancialInstitutionIdentification61 {
300 pub fn validate(&self) -> Result<(), ValidationError> {
301 self.fin_instn_id.validate()?;
302 Ok(())
303 }
304}
305
306#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
308pub struct BranchAndFinancialInstitutionIdentification62 {
309 #[serde(rename = "FinInstnId")]
310 pub fin_instn_id: FinancialInstitutionIdentification182,
311}
312
313impl BranchAndFinancialInstitutionIdentification62 {
314 pub fn validate(&self) -> Result<(), ValidationError> {
315 self.fin_instn_id.validate()?;
316 Ok(())
317 }
318}
319
320#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
324pub struct BranchAndFinancialInstitutionIdentification63 {
325 #[serde(rename = "FinInstnId")]
326 pub fin_instn_id: FinancialInstitutionIdentification181,
327 #[serde(rename = "BrnchId", skip_serializing_if = "Option::is_none")]
328 pub brnch_id: Option<BranchData31>,
329}
330
331impl BranchAndFinancialInstitutionIdentification63 {
332 pub fn validate(&self) -> Result<(), ValidationError> {
333 self.fin_instn_id.validate()?;
334 if let Some(ref val) = self.brnch_id {
335 val.validate()?
336 }
337 Ok(())
338 }
339}
340
341#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
343pub struct BranchAndFinancialInstitutionIdentification64 {
344 #[serde(rename = "FinInstnId")]
345 pub fin_instn_id: FinancialInstitutionIdentification183,
346}
347
348impl BranchAndFinancialInstitutionIdentification64 {
349 pub fn validate(&self) -> Result<(), ValidationError> {
350 self.fin_instn_id.validate()?;
351 Ok(())
352 }
353}
354
355#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
357pub struct BranchAndFinancialInstitutionIdentification65 {
358 #[serde(rename = "FinInstnId")]
359 pub fin_instn_id: FinancialInstitutionIdentification184,
360}
361
362impl BranchAndFinancialInstitutionIdentification65 {
363 pub fn validate(&self) -> Result<(), ValidationError> {
364 self.fin_instn_id.validate()?;
365 Ok(())
366 }
367}
368
369#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
371pub struct BranchAndFinancialInstitutionIdentification66 {
372 #[serde(rename = "FinInstnId")]
373 pub fin_instn_id: FinancialInstitutionIdentification185,
374}
375
376impl BranchAndFinancialInstitutionIdentification66 {
377 pub fn validate(&self) -> Result<(), ValidationError> {
378 self.fin_instn_id.validate()?;
379 Ok(())
380 }
381}
382
383#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
385pub struct BranchAndFinancialInstitutionIdentification67 {
386 #[serde(rename = "FinInstnId")]
387 pub fin_instn_id: FinancialInstitutionIdentification186,
388}
389
390impl BranchAndFinancialInstitutionIdentification67 {
391 pub fn validate(&self) -> Result<(), ValidationError> {
392 self.fin_instn_id.validate()?;
393 Ok(())
394 }
395}
396
397#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
399pub struct BranchAndFinancialInstitutionIdentification68 {
400 #[serde(rename = "FinInstnId")]
401 pub fin_instn_id: FinancialInstitutionIdentification187,
402}
403
404impl BranchAndFinancialInstitutionIdentification68 {
405 pub fn validate(&self) -> Result<(), ValidationError> {
406 self.fin_instn_id.validate()?;
407 Ok(())
408 }
409}
410
411#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
413pub struct BranchData31 {
414 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
415 pub id: Option<String>,
416}
417
418impl BranchData31 {
419 pub fn validate(&self) -> Result<(), ValidationError> {
420 if let Some(ref val) = self.id {
421 if val.chars().count() < 1 {
422 return Err(ValidationError::new(
423 1001,
424 "id is shorter than the minimum length of 1".to_string(),
425 ));
426 }
427 if val.chars().count() > 35 {
428 return Err(ValidationError::new(
429 1002,
430 "id exceeds the maximum length of 35".to_string(),
431 ));
432 }
433 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
434 if !pattern.is_match(val) {
435 return Err(ValidationError::new(
436 1005,
437 "id does not match the required pattern".to_string(),
438 ));
439 }
440 }
441 Ok(())
442 }
443}
444
445#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
447pub struct CBPRAmount1 {
448 #[serde(rename = "@Ccy")]
449 pub ccy: String,
450 #[serde(rename = "$value")]
451 pub value: f64,
452}
453
454impl CBPRAmount1 {
455 pub fn validate(&self) -> Result<(), ValidationError> {
456 Ok(())
457 }
458}
459
460#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
462pub struct CashAccount38 {
463 #[serde(rename = "Id")]
464 pub id: AccountIdentification4Choice,
465 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
466 pub tp: Option<CashAccountType2Choice>,
467 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
468 pub ccy: Option<String>,
469 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
470 pub nm: Option<String>,
471 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
472 pub prxy: Option<ProxyAccountIdentification1>,
473}
474
475impl CashAccount38 {
476 pub fn validate(&self) -> Result<(), ValidationError> {
477 self.id.validate()?;
478 if let Some(ref val) = self.tp {
479 val.validate()?
480 }
481 if let Some(ref val) = self.ccy {
482 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
483 if !pattern.is_match(val) {
484 return Err(ValidationError::new(
485 1005,
486 "ccy does not match the required pattern".to_string(),
487 ));
488 }
489 }
490 if let Some(ref val) = self.nm {
491 if val.chars().count() < 1 {
492 return Err(ValidationError::new(
493 1001,
494 "nm is shorter than the minimum length of 1".to_string(),
495 ));
496 }
497 if val.chars().count() > 70 {
498 return Err(ValidationError::new(
499 1002,
500 "nm exceeds the maximum length of 70".to_string(),
501 ));
502 }
503 }
504 if let Some(ref val) = self.prxy {
505 val.validate()?
506 }
507 Ok(())
508 }
509}
510
511#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
513pub struct CashAccount381 {
514 #[serde(rename = "Id")]
515 pub id: AccountIdentification4Choice1,
516 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
517 pub tp: Option<CashAccountType2Choice1>,
518 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
519 pub ccy: Option<String>,
520 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
521 pub nm: Option<String>,
522 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
523 pub prxy: Option<ProxyAccountIdentification11>,
524}
525
526impl CashAccount381 {
527 pub fn validate(&self) -> Result<(), ValidationError> {
528 self.id.validate()?;
529 if let Some(ref val) = self.tp {
530 val.validate()?
531 }
532 if let Some(ref val) = self.ccy {
533 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
534 if !pattern.is_match(val) {
535 return Err(ValidationError::new(
536 1005,
537 "ccy does not match the required pattern".to_string(),
538 ));
539 }
540 }
541 if let Some(ref val) = self.nm {
542 if val.chars().count() < 1 {
543 return Err(ValidationError::new(
544 1001,
545 "nm is shorter than the minimum length of 1".to_string(),
546 ));
547 }
548 if val.chars().count() > 70 {
549 return Err(ValidationError::new(
550 1002,
551 "nm exceeds the maximum length of 70".to_string(),
552 ));
553 }
554 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
555 if !pattern.is_match(val) {
556 return Err(ValidationError::new(
557 1005,
558 "nm does not match the required pattern".to_string(),
559 ));
560 }
561 }
562 if let Some(ref val) = self.prxy {
563 val.validate()?
564 }
565 Ok(())
566 }
567}
568
569#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
571pub struct CashAccount382 {
572 #[serde(rename = "Id")]
573 pub id: AccountIdentification4Choice1,
574 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
575 pub tp: Option<CashAccountType2Choice1>,
576 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
577 pub ccy: Option<String>,
578 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
579 pub nm: Option<String>,
580 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
581 pub prxy: Option<ProxyAccountIdentification11>,
582}
583
584impl CashAccount382 {
585 pub fn validate(&self) -> Result<(), ValidationError> {
586 self.id.validate()?;
587 if let Some(ref val) = self.tp {
588 val.validate()?
589 }
590 if let Some(ref val) = self.ccy {
591 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
592 if !pattern.is_match(val) {
593 return Err(ValidationError::new(
594 1005,
595 "ccy does not match the required pattern".to_string(),
596 ));
597 }
598 }
599 if let Some(ref val) = self.nm {
600 if val.chars().count() < 1 {
601 return Err(ValidationError::new(
602 1001,
603 "nm is shorter than the minimum length of 1".to_string(),
604 ));
605 }
606 if val.chars().count() > 70 {
607 return Err(ValidationError::new(
608 1002,
609 "nm exceeds the maximum length of 70".to_string(),
610 ));
611 }
612 let pattern = Regex::new(
613 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
614 )
615 .unwrap();
616 if !pattern.is_match(val) {
617 return Err(ValidationError::new(
618 1005,
619 "nm does not match the required pattern".to_string(),
620 ));
621 }
622 }
623 if let Some(ref val) = self.prxy {
624 val.validate()?
625 }
626 Ok(())
627 }
628}
629
630#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
632pub struct CashAccountType2Choice {
633 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
634 pub cd: Option<String>,
635 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
636 pub prtry: Option<String>,
637}
638
639impl CashAccountType2Choice {
640 pub fn validate(&self) -> Result<(), ValidationError> {
641 if let Some(ref val) = self.cd {
642 if val.chars().count() < 1 {
643 return Err(ValidationError::new(
644 1001,
645 "cd is shorter than the minimum length of 1".to_string(),
646 ));
647 }
648 if val.chars().count() > 4 {
649 return Err(ValidationError::new(
650 1002,
651 "cd exceeds the maximum length of 4".to_string(),
652 ));
653 }
654 }
655 if let Some(ref val) = self.prtry {
656 if val.chars().count() < 1 {
657 return Err(ValidationError::new(
658 1001,
659 "prtry is shorter than the minimum length of 1".to_string(),
660 ));
661 }
662 if val.chars().count() > 35 {
663 return Err(ValidationError::new(
664 1002,
665 "prtry exceeds the maximum length of 35".to_string(),
666 ));
667 }
668 }
669 Ok(())
670 }
671}
672
673#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
675pub struct CashAccountType2Choice1 {
676 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
677 pub cd: Option<String>,
678 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
679 pub prtry: Option<String>,
680}
681
682impl CashAccountType2Choice1 {
683 pub fn validate(&self) -> Result<(), ValidationError> {
684 if let Some(ref val) = self.cd {
685 if val.chars().count() < 1 {
686 return Err(ValidationError::new(
687 1001,
688 "cd is shorter than the minimum length of 1".to_string(),
689 ));
690 }
691 if val.chars().count() > 4 {
692 return Err(ValidationError::new(
693 1002,
694 "cd exceeds the maximum length of 4".to_string(),
695 ));
696 }
697 }
698 if let Some(ref val) = self.prtry {
699 if val.chars().count() < 1 {
700 return Err(ValidationError::new(
701 1001,
702 "prtry is shorter than the minimum length of 1".to_string(),
703 ));
704 }
705 if val.chars().count() > 35 {
706 return Err(ValidationError::new(
707 1002,
708 "prtry exceeds the maximum length of 35".to_string(),
709 ));
710 }
711 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
712 if !pattern.is_match(val) {
713 return Err(ValidationError::new(
714 1005,
715 "prtry does not match the required pattern".to_string(),
716 ));
717 }
718 }
719 Ok(())
720 }
721}
722
723#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
725pub struct CategoryPurpose1Choice1 {
726 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
727 pub cd: Option<String>,
728 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
729 pub prtry: Option<String>,
730}
731
732impl CategoryPurpose1Choice1 {
733 pub fn validate(&self) -> Result<(), ValidationError> {
734 if let Some(ref val) = self.cd {
735 if val.chars().count() < 1 {
736 return Err(ValidationError::new(
737 1001,
738 "cd is shorter than the minimum length of 1".to_string(),
739 ));
740 }
741 if val.chars().count() > 4 {
742 return Err(ValidationError::new(
743 1002,
744 "cd exceeds the maximum length of 4".to_string(),
745 ));
746 }
747 }
748 if let Some(ref val) = self.prtry {
749 if val.chars().count() < 1 {
750 return Err(ValidationError::new(
751 1001,
752 "prtry is shorter than the minimum length of 1".to_string(),
753 ));
754 }
755 if val.chars().count() > 35 {
756 return Err(ValidationError::new(
757 1002,
758 "prtry exceeds the maximum length of 35".to_string(),
759 ));
760 }
761 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
762 if !pattern.is_match(val) {
763 return Err(ValidationError::new(
764 1005,
765 "prtry does not match the required pattern".to_string(),
766 ));
767 }
768 }
769 Ok(())
770 }
771}
772
773#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
775pub enum ChargeBearerType1Code1 {
776 #[default]
777 #[serde(rename = "CRED")]
778 CodeCRED,
779 #[serde(rename = "SHAR")]
780 CodeSHAR,
781}
782
783impl ChargeBearerType1Code1 {
784 pub fn validate(&self) -> Result<(), ValidationError> {
785 Ok(())
786 }
787}
788
789#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
791pub struct Charges71 {
792 #[serde(rename = "Amt")]
793 pub amt: CBPRAmount1,
794 #[serde(rename = "Agt")]
795 pub agt: BranchAndFinancialInstitutionIdentification61,
796}
797
798impl Charges71 {
799 pub fn validate(&self) -> Result<(), ValidationError> {
800 self.amt.validate()?;
801 self.agt.validate()?;
802 Ok(())
803 }
804}
805
806#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
808pub enum ClearingChannel2Code {
809 #[default]
810 #[serde(rename = "RTGS")]
811 CodeRTGS,
812 #[serde(rename = "RTNS")]
813 CodeRTNS,
814 #[serde(rename = "MPNS")]
815 CodeMPNS,
816 #[serde(rename = "BOOK")]
817 CodeBOOK,
818}
819
820impl ClearingChannel2Code {
821 pub fn validate(&self) -> Result<(), ValidationError> {
822 Ok(())
823 }
824}
825
826#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
828pub struct ClearingSystemIdentification2Choice {
829 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
830 pub cd: Option<String>,
831 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
832 pub prtry: Option<String>,
833}
834
835impl ClearingSystemIdentification2Choice {
836 pub fn validate(&self) -> Result<(), ValidationError> {
837 if let Some(ref val) = self.cd {
838 if val.chars().count() < 1 {
839 return Err(ValidationError::new(
840 1001,
841 "cd is shorter than the minimum length of 1".to_string(),
842 ));
843 }
844 if val.chars().count() > 5 {
845 return Err(ValidationError::new(
846 1002,
847 "cd exceeds the maximum length of 5".to_string(),
848 ));
849 }
850 }
851 if let Some(ref val) = self.prtry {
852 if val.chars().count() < 1 {
853 return Err(ValidationError::new(
854 1001,
855 "prtry is shorter than the minimum length of 1".to_string(),
856 ));
857 }
858 if val.chars().count() > 35 {
859 return Err(ValidationError::new(
860 1002,
861 "prtry exceeds the maximum length of 35".to_string(),
862 ));
863 }
864 }
865 Ok(())
866 }
867}
868
869#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
871pub struct ClearingSystemIdentification2Choice1 {
872 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
873 pub cd: Option<String>,
874}
875
876impl ClearingSystemIdentification2Choice1 {
877 pub fn validate(&self) -> Result<(), ValidationError> {
878 if let Some(ref val) = self.cd {
879 if val.chars().count() < 1 {
880 return Err(ValidationError::new(
881 1001,
882 "cd is shorter than the minimum length of 1".to_string(),
883 ));
884 }
885 if val.chars().count() > 5 {
886 return Err(ValidationError::new(
887 1002,
888 "cd exceeds the maximum length of 5".to_string(),
889 ));
890 }
891 }
892 Ok(())
893 }
894}
895
896#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
898pub struct ClearingSystemIdentification2Choice2 {
899 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
900 pub cd: Option<String>,
901 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
902 pub prtry: Option<String>,
903}
904
905impl ClearingSystemIdentification2Choice2 {
906 pub fn validate(&self) -> Result<(), ValidationError> {
907 if let Some(ref val) = self.cd {
908 if val.chars().count() < 1 {
909 return Err(ValidationError::new(
910 1001,
911 "cd is shorter than the minimum length of 1".to_string(),
912 ));
913 }
914 if val.chars().count() > 5 {
915 return Err(ValidationError::new(
916 1002,
917 "cd exceeds the maximum length of 5".to_string(),
918 ));
919 }
920 }
921 if let Some(ref val) = self.prtry {
922 if val.chars().count() < 1 {
923 return Err(ValidationError::new(
924 1001,
925 "prtry is shorter than the minimum length of 1".to_string(),
926 ));
927 }
928 if val.chars().count() > 35 {
929 return Err(ValidationError::new(
930 1002,
931 "prtry exceeds the maximum length of 35".to_string(),
932 ));
933 }
934 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
935 if !pattern.is_match(val) {
936 return Err(ValidationError::new(
937 1005,
938 "prtry does not match the required pattern".to_string(),
939 ));
940 }
941 }
942 Ok(())
943 }
944}
945
946#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
948pub struct ClearingSystemMemberIdentification2 {
949 #[serde(rename = "ClrSysId", skip_serializing_if = "Option::is_none")]
950 pub clr_sys_id: Option<ClearingSystemIdentification2Choice>,
951 #[serde(rename = "MmbId")]
952 pub mmb_id: String,
953}
954
955impl ClearingSystemMemberIdentification2 {
956 pub fn validate(&self) -> Result<(), ValidationError> {
957 if let Some(ref val) = self.clr_sys_id {
958 val.validate()?
959 }
960 if self.mmb_id.chars().count() < 1 {
961 return Err(ValidationError::new(
962 1001,
963 "mmb_id is shorter than the minimum length of 1".to_string(),
964 ));
965 }
966 if self.mmb_id.chars().count() > 35 {
967 return Err(ValidationError::new(
968 1002,
969 "mmb_id exceeds the maximum length of 35".to_string(),
970 ));
971 }
972 Ok(())
973 }
974}
975
976#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
978pub struct ClearingSystemMemberIdentification21 {
979 #[serde(rename = "ClrSysId")]
980 pub clr_sys_id: ClearingSystemIdentification2Choice1,
981 #[serde(rename = "MmbId")]
982 pub mmb_id: String,
983}
984
985impl ClearingSystemMemberIdentification21 {
986 pub fn validate(&self) -> Result<(), ValidationError> {
987 self.clr_sys_id.validate()?;
988 if self.mmb_id.chars().count() < 1 {
989 return Err(ValidationError::new(
990 1001,
991 "mmb_id is shorter than the minimum length of 1".to_string(),
992 ));
993 }
994 if self.mmb_id.chars().count() > 28 {
995 return Err(ValidationError::new(
996 1002,
997 "mmb_id exceeds the maximum length of 28".to_string(),
998 ));
999 }
1000 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1001 if !pattern.is_match(&self.mmb_id) {
1002 return Err(ValidationError::new(
1003 1005,
1004 "mmb_id does not match the required pattern".to_string(),
1005 ));
1006 }
1007 Ok(())
1008 }
1009}
1010
1011#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1013pub struct ClearingSystemMemberIdentification22 {
1014 #[serde(rename = "ClrSysId")]
1015 pub clr_sys_id: ClearingSystemIdentification2Choice2,
1016 #[serde(rename = "MmbId")]
1017 pub mmb_id: String,
1018}
1019
1020impl ClearingSystemMemberIdentification22 {
1021 pub fn validate(&self) -> Result<(), ValidationError> {
1022 self.clr_sys_id.validate()?;
1023 if self.mmb_id.chars().count() < 1 {
1024 return Err(ValidationError::new(
1025 1001,
1026 "mmb_id is shorter than the minimum length of 1".to_string(),
1027 ));
1028 }
1029 if self.mmb_id.chars().count() > 28 {
1030 return Err(ValidationError::new(
1031 1002,
1032 "mmb_id exceeds the maximum length of 28".to_string(),
1033 ));
1034 }
1035 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1036 if !pattern.is_match(&self.mmb_id) {
1037 return Err(ValidationError::new(
1038 1005,
1039 "mmb_id does not match the required pattern".to_string(),
1040 ));
1041 }
1042 Ok(())
1043 }
1044}
1045
1046#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1048pub enum CreditDebitCode {
1049 #[default]
1050 #[serde(rename = "CRDT")]
1051 CodeCRDT,
1052 #[serde(rename = "DBIT")]
1053 CodeDBIT,
1054}
1055
1056impl CreditDebitCode {
1057 pub fn validate(&self) -> Result<(), ValidationError> {
1058 Ok(())
1059 }
1060}
1061
1062#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1068pub struct CreditorReferenceInformation21 {
1069 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1070 pub tp: Option<CreditorReferenceType21>,
1071 #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
1072 pub ref_attr: Option<String>,
1073}
1074
1075impl CreditorReferenceInformation21 {
1076 pub fn validate(&self) -> Result<(), ValidationError> {
1077 if let Some(ref val) = self.tp {
1078 val.validate()?
1079 }
1080 if let Some(ref val) = self.ref_attr {
1081 if val.chars().count() < 1 {
1082 return Err(ValidationError::new(
1083 1001,
1084 "ref_attr 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 "ref_attr exceeds the maximum length of 35".to_string(),
1091 ));
1092 }
1093 let pattern = Regex::new(
1094 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1095 )
1096 .unwrap();
1097 if !pattern.is_match(val) {
1098 return Err(ValidationError::new(
1099 1005,
1100 "ref_attr does not match the required pattern".to_string(),
1101 ));
1102 }
1103 }
1104 Ok(())
1105 }
1106}
1107
1108#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1110pub struct CreditorReferenceType1Choice1 {
1111 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1112 pub cd: Option<DocumentType3Code>,
1113 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1114 pub prtry: Option<String>,
1115}
1116
1117impl CreditorReferenceType1Choice1 {
1118 pub fn validate(&self) -> Result<(), ValidationError> {
1119 if let Some(ref val) = self.cd {
1120 val.validate()?
1121 }
1122 if let Some(ref val) = self.prtry {
1123 if val.chars().count() < 1 {
1124 return Err(ValidationError::new(
1125 1001,
1126 "prtry is shorter than the minimum length of 1".to_string(),
1127 ));
1128 }
1129 if val.chars().count() > 35 {
1130 return Err(ValidationError::new(
1131 1002,
1132 "prtry exceeds the maximum length of 35".to_string(),
1133 ));
1134 }
1135 let pattern = Regex::new(
1136 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1137 )
1138 .unwrap();
1139 if !pattern.is_match(val) {
1140 return Err(ValidationError::new(
1141 1005,
1142 "prtry does not match the required pattern".to_string(),
1143 ));
1144 }
1145 }
1146 Ok(())
1147 }
1148}
1149
1150#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1152pub struct CreditorReferenceType21 {
1153 #[serde(rename = "CdOrPrtry")]
1154 pub cd_or_prtry: CreditorReferenceType1Choice1,
1155 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1156 pub issr: Option<String>,
1157}
1158
1159impl CreditorReferenceType21 {
1160 pub fn validate(&self) -> Result<(), ValidationError> {
1161 self.cd_or_prtry.validate()?;
1162 if let Some(ref val) = self.issr {
1163 if val.chars().count() < 1 {
1164 return Err(ValidationError::new(
1165 1001,
1166 "issr is shorter than the minimum length of 1".to_string(),
1167 ));
1168 }
1169 if val.chars().count() > 35 {
1170 return Err(ValidationError::new(
1171 1002,
1172 "issr exceeds the maximum length of 35".to_string(),
1173 ));
1174 }
1175 let pattern = Regex::new(
1176 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1177 )
1178 .unwrap();
1179 if !pattern.is_match(val) {
1180 return Err(ValidationError::new(
1181 1005,
1182 "issr does not match the required pattern".to_string(),
1183 ));
1184 }
1185 }
1186 Ok(())
1187 }
1188}
1189
1190#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1192pub struct DateAndDateTime2Choice1 {
1193 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
1194 pub dt: Option<String>,
1195 #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
1196 pub dt_tm: Option<String>,
1197}
1198
1199impl DateAndDateTime2Choice1 {
1200 pub fn validate(&self) -> Result<(), ValidationError> {
1201 if let Some(ref val) = self.dt_tm {
1202 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
1203 if !pattern.is_match(val) {
1204 return Err(ValidationError::new(
1205 1005,
1206 "dt_tm does not match the required pattern".to_string(),
1207 ));
1208 }
1209 }
1210 Ok(())
1211 }
1212}
1213
1214#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1216pub struct DateAndPlaceOfBirth1 {
1217 #[serde(rename = "BirthDt")]
1218 pub birth_dt: String,
1219 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
1220 pub prvc_of_birth: Option<String>,
1221 #[serde(rename = "CityOfBirth")]
1222 pub city_of_birth: String,
1223 #[serde(rename = "CtryOfBirth")]
1224 pub ctry_of_birth: String,
1225}
1226
1227impl DateAndPlaceOfBirth1 {
1228 pub fn validate(&self) -> Result<(), ValidationError> {
1229 if let Some(ref val) = self.prvc_of_birth {
1230 if val.chars().count() < 1 {
1231 return Err(ValidationError::new(
1232 1001,
1233 "prvc_of_birth is shorter than the minimum length of 1".to_string(),
1234 ));
1235 }
1236 if val.chars().count() > 35 {
1237 return Err(ValidationError::new(
1238 1002,
1239 "prvc_of_birth exceeds the maximum length of 35".to_string(),
1240 ));
1241 }
1242 }
1243 if self.city_of_birth.chars().count() < 1 {
1244 return Err(ValidationError::new(
1245 1001,
1246 "city_of_birth is shorter than the minimum length of 1".to_string(),
1247 ));
1248 }
1249 if self.city_of_birth.chars().count() > 35 {
1250 return Err(ValidationError::new(
1251 1002,
1252 "city_of_birth exceeds the maximum length of 35".to_string(),
1253 ));
1254 }
1255 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
1256 if !pattern.is_match(&self.ctry_of_birth) {
1257 return Err(ValidationError::new(
1258 1005,
1259 "ctry_of_birth does not match the required pattern".to_string(),
1260 ));
1261 }
1262 Ok(())
1263 }
1264}
1265
1266#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1268pub struct DateAndPlaceOfBirth11 {
1269 #[serde(rename = "BirthDt")]
1270 pub birth_dt: String,
1271 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
1272 pub prvc_of_birth: Option<String>,
1273 #[serde(rename = "CityOfBirth")]
1274 pub city_of_birth: String,
1275 #[serde(rename = "CtryOfBirth")]
1276 pub ctry_of_birth: String,
1277}
1278
1279impl DateAndPlaceOfBirth11 {
1280 pub fn validate(&self) -> Result<(), ValidationError> {
1281 if let Some(ref val) = self.prvc_of_birth {
1282 if val.chars().count() < 1 {
1283 return Err(ValidationError::new(
1284 1001,
1285 "prvc_of_birth is shorter than the minimum length of 1".to_string(),
1286 ));
1287 }
1288 if val.chars().count() > 35 {
1289 return Err(ValidationError::new(
1290 1002,
1291 "prvc_of_birth exceeds the maximum length of 35".to_string(),
1292 ));
1293 }
1294 let pattern = Regex::new(
1295 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1296 )
1297 .unwrap();
1298 if !pattern.is_match(val) {
1299 return Err(ValidationError::new(
1300 1005,
1301 "prvc_of_birth does not match the required pattern".to_string(),
1302 ));
1303 }
1304 }
1305 if self.city_of_birth.chars().count() < 1 {
1306 return Err(ValidationError::new(
1307 1001,
1308 "city_of_birth is shorter than the minimum length of 1".to_string(),
1309 ));
1310 }
1311 if self.city_of_birth.chars().count() > 35 {
1312 return Err(ValidationError::new(
1313 1002,
1314 "city_of_birth exceeds the maximum length of 35".to_string(),
1315 ));
1316 }
1317 let pattern =
1318 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
1319 .unwrap();
1320 if !pattern.is_match(&self.city_of_birth) {
1321 return Err(ValidationError::new(
1322 1005,
1323 "city_of_birth does not match the required pattern".to_string(),
1324 ));
1325 }
1326 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
1327 if !pattern.is_match(&self.ctry_of_birth) {
1328 return Err(ValidationError::new(
1329 1005,
1330 "ctry_of_birth does not match the required pattern".to_string(),
1331 ));
1332 }
1333 Ok(())
1334 }
1335}
1336
1337#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1339pub struct DatePeriod2 {
1340 #[serde(rename = "FrDt")]
1341 pub fr_dt: String,
1342 #[serde(rename = "ToDt")]
1343 pub to_dt: String,
1344}
1345
1346impl DatePeriod2 {
1347 pub fn validate(&self) -> Result<(), ValidationError> {
1348 Ok(())
1349 }
1350}
1351
1352#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1354pub struct DiscountAmountAndType1 {
1355 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1356 pub tp: Option<DiscountAmountType1Choice>,
1357 #[serde(rename = "Amt")]
1358 pub amt: ActiveOrHistoricCurrencyAndAmount,
1359}
1360
1361impl DiscountAmountAndType1 {
1362 pub fn validate(&self) -> Result<(), ValidationError> {
1363 if let Some(ref val) = self.tp {
1364 val.validate()?
1365 }
1366 self.amt.validate()?;
1367 Ok(())
1368 }
1369}
1370
1371#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1373pub struct DiscountAmountAndType11 {
1374 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1375 pub tp: Option<DiscountAmountType1Choice1>,
1376 #[serde(rename = "Amt")]
1377 pub amt: ActiveOrHistoricCurrencyAndAmount,
1378}
1379
1380impl DiscountAmountAndType11 {
1381 pub fn validate(&self) -> Result<(), ValidationError> {
1382 if let Some(ref val) = self.tp {
1383 val.validate()?
1384 }
1385 self.amt.validate()?;
1386 Ok(())
1387 }
1388}
1389
1390#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1392pub struct DiscountAmountType1Choice {
1393 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1394 pub cd: Option<String>,
1395 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1396 pub prtry: Option<String>,
1397}
1398
1399impl DiscountAmountType1Choice {
1400 pub fn validate(&self) -> Result<(), ValidationError> {
1401 if let Some(ref val) = self.cd {
1402 if val.chars().count() < 1 {
1403 return Err(ValidationError::new(
1404 1001,
1405 "cd is shorter than the minimum length of 1".to_string(),
1406 ));
1407 }
1408 if val.chars().count() > 4 {
1409 return Err(ValidationError::new(
1410 1002,
1411 "cd exceeds the maximum length of 4".to_string(),
1412 ));
1413 }
1414 }
1415 if let Some(ref val) = self.prtry {
1416 if val.chars().count() < 1 {
1417 return Err(ValidationError::new(
1418 1001,
1419 "prtry is shorter than the minimum length of 1".to_string(),
1420 ));
1421 }
1422 if val.chars().count() > 35 {
1423 return Err(ValidationError::new(
1424 1002,
1425 "prtry exceeds the maximum length of 35".to_string(),
1426 ));
1427 }
1428 }
1429 Ok(())
1430 }
1431}
1432
1433#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1435pub struct DiscountAmountType1Choice1 {
1436 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1437 pub cd: Option<String>,
1438 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1439 pub prtry: Option<String>,
1440}
1441
1442impl DiscountAmountType1Choice1 {
1443 pub fn validate(&self) -> Result<(), ValidationError> {
1444 if let Some(ref val) = self.cd {
1445 if val.chars().count() < 1 {
1446 return Err(ValidationError::new(
1447 1001,
1448 "cd is shorter than the minimum length of 1".to_string(),
1449 ));
1450 }
1451 if val.chars().count() > 4 {
1452 return Err(ValidationError::new(
1453 1002,
1454 "cd exceeds the maximum length of 4".to_string(),
1455 ));
1456 }
1457 }
1458 if let Some(ref val) = self.prtry {
1459 if val.chars().count() < 1 {
1460 return Err(ValidationError::new(
1461 1001,
1462 "prtry is shorter than the minimum length of 1".to_string(),
1463 ));
1464 }
1465 if val.chars().count() > 35 {
1466 return Err(ValidationError::new(
1467 1002,
1468 "prtry exceeds the maximum length of 35".to_string(),
1469 ));
1470 }
1471 let pattern = Regex::new(
1472 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1473 )
1474 .unwrap();
1475 if !pattern.is_match(val) {
1476 return Err(ValidationError::new(
1477 1005,
1478 "prtry does not match the required pattern".to_string(),
1479 ));
1480 }
1481 }
1482 Ok(())
1483 }
1484}
1485
1486#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1488pub struct DocumentAdjustment11 {
1489 #[serde(rename = "Amt")]
1490 pub amt: ActiveOrHistoricCurrencyAndAmount,
1491 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
1492 pub cdt_dbt_ind: Option<CreditDebitCode>,
1493 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
1494 pub rsn: Option<String>,
1495 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
1496 pub addtl_inf: Option<String>,
1497}
1498
1499impl DocumentAdjustment11 {
1500 pub fn validate(&self) -> Result<(), ValidationError> {
1501 self.amt.validate()?;
1502 if let Some(ref val) = self.cdt_dbt_ind {
1503 val.validate()?
1504 }
1505 if let Some(ref val) = self.rsn {
1506 if val.chars().count() < 1 {
1507 return Err(ValidationError::new(
1508 1001,
1509 "rsn is shorter than the minimum length of 1".to_string(),
1510 ));
1511 }
1512 if val.chars().count() > 4 {
1513 return Err(ValidationError::new(
1514 1002,
1515 "rsn exceeds the maximum length of 4".to_string(),
1516 ));
1517 }
1518 let pattern = Regex::new(
1519 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1520 )
1521 .unwrap();
1522 if !pattern.is_match(val) {
1523 return Err(ValidationError::new(
1524 1005,
1525 "rsn does not match the required pattern".to_string(),
1526 ));
1527 }
1528 }
1529 if let Some(ref val) = self.addtl_inf {
1530 if val.chars().count() < 1 {
1531 return Err(ValidationError::new(
1532 1001,
1533 "addtl_inf is shorter than the minimum length of 1".to_string(),
1534 ));
1535 }
1536 if val.chars().count() > 140 {
1537 return Err(ValidationError::new(
1538 1002,
1539 "addtl_inf exceeds the maximum length of 140".to_string(),
1540 ));
1541 }
1542 let pattern = Regex::new(
1543 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1544 )
1545 .unwrap();
1546 if !pattern.is_match(val) {
1547 return Err(ValidationError::new(
1548 1005,
1549 "addtl_inf does not match the required pattern".to_string(),
1550 ));
1551 }
1552 }
1553 Ok(())
1554 }
1555}
1556
1557#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1559pub struct DocumentLineIdentification11 {
1560 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1561 pub tp: Option<DocumentLineType11>,
1562 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
1563 pub nb: Option<String>,
1564 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
1565 pub rltd_dt: Option<String>,
1566}
1567
1568impl DocumentLineIdentification11 {
1569 pub fn validate(&self) -> Result<(), ValidationError> {
1570 if let Some(ref val) = self.tp {
1571 val.validate()?
1572 }
1573 if let Some(ref val) = self.nb {
1574 if val.chars().count() < 1 {
1575 return Err(ValidationError::new(
1576 1001,
1577 "nb is shorter than the minimum length of 1".to_string(),
1578 ));
1579 }
1580 if val.chars().count() > 35 {
1581 return Err(ValidationError::new(
1582 1002,
1583 "nb exceeds the maximum length of 35".to_string(),
1584 ));
1585 }
1586 let pattern = Regex::new(
1587 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1588 )
1589 .unwrap();
1590 if !pattern.is_match(val) {
1591 return Err(ValidationError::new(
1592 1005,
1593 "nb does not match the required pattern".to_string(),
1594 ));
1595 }
1596 }
1597 Ok(())
1598 }
1599}
1600
1601#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1603pub struct DocumentLineInformation11 {
1604 #[serde(rename = "Id")]
1605 pub id: Vec<DocumentLineIdentification11>,
1606 #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
1607 pub desc: Option<String>,
1608 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
1609 pub amt: Option<RemittanceAmount31>,
1610}
1611
1612impl DocumentLineInformation11 {
1613 pub fn validate(&self) -> Result<(), ValidationError> {
1614 for item in &self.id {
1615 item.validate()?
1616 }
1617 if let Some(ref val) = self.desc {
1618 if val.chars().count() < 1 {
1619 return Err(ValidationError::new(
1620 1001,
1621 "desc is shorter than the minimum length of 1".to_string(),
1622 ));
1623 }
1624 if val.chars().count() > 35 {
1625 return Err(ValidationError::new(
1626 1002,
1627 "desc exceeds the maximum length of 35".to_string(),
1628 ));
1629 }
1630 let pattern = Regex::new(
1631 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1632 )
1633 .unwrap();
1634 if !pattern.is_match(val) {
1635 return Err(ValidationError::new(
1636 1005,
1637 "desc does not match the required pattern".to_string(),
1638 ));
1639 }
1640 }
1641 if let Some(ref val) = self.amt {
1642 val.validate()?
1643 }
1644 Ok(())
1645 }
1646}
1647
1648#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1650pub struct DocumentLineType1Choice {
1651 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1652 pub cd: Option<String>,
1653 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1654 pub prtry: Option<String>,
1655}
1656
1657impl DocumentLineType1Choice {
1658 pub fn validate(&self) -> Result<(), ValidationError> {
1659 if let Some(ref val) = self.cd {
1660 if val.chars().count() < 1 {
1661 return Err(ValidationError::new(
1662 1001,
1663 "cd is shorter than the minimum length of 1".to_string(),
1664 ));
1665 }
1666 if val.chars().count() > 4 {
1667 return Err(ValidationError::new(
1668 1002,
1669 "cd exceeds the maximum length of 4".to_string(),
1670 ));
1671 }
1672 }
1673 if let Some(ref val) = self.prtry {
1674 if val.chars().count() < 1 {
1675 return Err(ValidationError::new(
1676 1001,
1677 "prtry is shorter than the minimum length of 1".to_string(),
1678 ));
1679 }
1680 if val.chars().count() > 35 {
1681 return Err(ValidationError::new(
1682 1002,
1683 "prtry exceeds the maximum length of 35".to_string(),
1684 ));
1685 }
1686 }
1687 Ok(())
1688 }
1689}
1690
1691#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1693pub struct DocumentLineType11 {
1694 #[serde(rename = "CdOrPrtry")]
1695 pub cd_or_prtry: DocumentLineType1Choice,
1696 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1697 pub issr: Option<String>,
1698}
1699
1700impl DocumentLineType11 {
1701 pub fn validate(&self) -> Result<(), ValidationError> {
1702 self.cd_or_prtry.validate()?;
1703 if let Some(ref val) = self.issr {
1704 if val.chars().count() < 1 {
1705 return Err(ValidationError::new(
1706 1001,
1707 "issr is shorter than the minimum length of 1".to_string(),
1708 ));
1709 }
1710 if val.chars().count() > 35 {
1711 return Err(ValidationError::new(
1712 1002,
1713 "issr exceeds the maximum length of 35".to_string(),
1714 ));
1715 }
1716 let pattern = Regex::new(
1717 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1718 )
1719 .unwrap();
1720 if !pattern.is_match(val) {
1721 return Err(ValidationError::new(
1722 1005,
1723 "issr does not match the required pattern".to_string(),
1724 ));
1725 }
1726 }
1727 Ok(())
1728 }
1729}
1730
1731#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1733pub enum DocumentType3Code {
1734 #[default]
1735 #[serde(rename = "RADM")]
1736 CodeRADM,
1737 #[serde(rename = "RPIN")]
1738 CodeRPIN,
1739 #[serde(rename = "FXDR")]
1740 CodeFXDR,
1741 #[serde(rename = "DISP")]
1742 CodeDISP,
1743 #[serde(rename = "PUOR")]
1744 CodePUOR,
1745 #[serde(rename = "SCOR")]
1746 CodeSCOR,
1747}
1748
1749impl DocumentType3Code {
1750 pub fn validate(&self) -> Result<(), ValidationError> {
1751 Ok(())
1752 }
1753}
1754
1755#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1757pub enum DocumentType6Code {
1758 #[default]
1759 #[serde(rename = "MSIN")]
1760 CodeMSIN,
1761 #[serde(rename = "CNFA")]
1762 CodeCNFA,
1763 #[serde(rename = "DNFA")]
1764 CodeDNFA,
1765 #[serde(rename = "CINV")]
1766 CodeCINV,
1767 #[serde(rename = "CREN")]
1768 CodeCREN,
1769 #[serde(rename = "DEBN")]
1770 CodeDEBN,
1771 #[serde(rename = "HIRI")]
1772 CodeHIRI,
1773 #[serde(rename = "SBIN")]
1774 CodeSBIN,
1775 #[serde(rename = "CMCN")]
1776 CodeCMCN,
1777 #[serde(rename = "SOAC")]
1778 CodeSOAC,
1779 #[serde(rename = "DISP")]
1780 CodeDISP,
1781 #[serde(rename = "BOLD")]
1782 CodeBOLD,
1783 #[serde(rename = "VCHR")]
1784 CodeVCHR,
1785 #[serde(rename = "AROI")]
1786 CodeAROI,
1787 #[serde(rename = "TSUT")]
1788 CodeTSUT,
1789 #[serde(rename = "PUOR")]
1790 CodePUOR,
1791}
1792
1793impl DocumentType6Code {
1794 pub fn validate(&self) -> Result<(), ValidationError> {
1795 Ok(())
1796 }
1797}
1798
1799#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1801pub struct EquivalentAmount21 {
1802 #[serde(rename = "Amt")]
1803 pub amt: CBPRAmount1,
1804 #[serde(rename = "CcyOfTrf")]
1805 pub ccy_of_trf: String,
1806}
1807
1808impl EquivalentAmount21 {
1809 pub fn validate(&self) -> Result<(), ValidationError> {
1810 self.amt.validate()?;
1811 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
1812 if !pattern.is_match(&self.ccy_of_trf) {
1813 return Err(ValidationError::new(
1814 1005,
1815 "ccy_of_trf does not match the required pattern".to_string(),
1816 ));
1817 }
1818 Ok(())
1819 }
1820}
1821
1822#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1824pub struct FinancialIdentificationSchemeName1Choice1 {
1825 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1826 pub cd: Option<String>,
1827 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1828 pub prtry: Option<String>,
1829}
1830
1831impl FinancialIdentificationSchemeName1Choice1 {
1832 pub fn validate(&self) -> Result<(), ValidationError> {
1833 if let Some(ref val) = self.cd {
1834 if val.chars().count() < 1 {
1835 return Err(ValidationError::new(
1836 1001,
1837 "cd is shorter than the minimum length of 1".to_string(),
1838 ));
1839 }
1840 if val.chars().count() > 4 {
1841 return Err(ValidationError::new(
1842 1002,
1843 "cd exceeds the maximum length of 4".to_string(),
1844 ));
1845 }
1846 }
1847 if let Some(ref val) = self.prtry {
1848 if val.chars().count() < 1 {
1849 return Err(ValidationError::new(
1850 1001,
1851 "prtry is shorter than the minimum length of 1".to_string(),
1852 ));
1853 }
1854 if val.chars().count() > 35 {
1855 return Err(ValidationError::new(
1856 1002,
1857 "prtry exceeds the maximum length of 35".to_string(),
1858 ));
1859 }
1860 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
1861 if !pattern.is_match(val) {
1862 return Err(ValidationError::new(
1863 1005,
1864 "prtry does not match the required pattern".to_string(),
1865 ));
1866 }
1867 }
1868 Ok(())
1869 }
1870}
1871
1872#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1874pub struct FinancialInstitutionIdentification181 {
1875 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1876 pub bicfi: Option<String>,
1877 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1878 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1879 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1880 pub lei: Option<String>,
1881 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1882 pub nm: Option<String>,
1883 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1884 pub pstl_adr: Option<PostalAddress241>,
1885}
1886
1887impl FinancialInstitutionIdentification181 {
1888 pub fn validate(&self) -> Result<(), ValidationError> {
1889 if let Some(ref val) = self.bicfi {
1890 let pattern =
1891 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
1892 if !pattern.is_match(val) {
1893 return Err(ValidationError::new(
1894 1005,
1895 "bicfi does not match the required pattern".to_string(),
1896 ));
1897 }
1898 }
1899 if let Some(ref val) = self.clr_sys_mmb_id {
1900 val.validate()?
1901 }
1902 if let Some(ref val) = self.lei {
1903 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1904 if !pattern.is_match(val) {
1905 return Err(ValidationError::new(
1906 1005,
1907 "lei 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() > 140 {
1919 return Err(ValidationError::new(
1920 1002,
1921 "nm exceeds the maximum length of 140".to_string(),
1922 ));
1923 }
1924 let pattern = Regex::new(
1925 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1926 )
1927 .unwrap();
1928 if !pattern.is_match(val) {
1929 return Err(ValidationError::new(
1930 1005,
1931 "nm does not match the required pattern".to_string(),
1932 ));
1933 }
1934 }
1935 if let Some(ref val) = self.pstl_adr {
1936 val.validate()?
1937 }
1938 Ok(())
1939 }
1940}
1941
1942#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1944pub struct FinancialInstitutionIdentification182 {
1945 #[serde(rename = "BICFI")]
1946 pub bicfi: String,
1947 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1948 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1949 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1950 pub lei: Option<String>,
1951}
1952
1953impl FinancialInstitutionIdentification182 {
1954 pub fn validate(&self) -> Result<(), ValidationError> {
1955 let pattern =
1956 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
1957 if !pattern.is_match(&self.bicfi) {
1958 return Err(ValidationError::new(
1959 1005,
1960 "bicfi does not match the required pattern".to_string(),
1961 ));
1962 }
1963 if let Some(ref val) = self.clr_sys_mmb_id {
1964 val.validate()?
1965 }
1966 if let Some(ref val) = self.lei {
1967 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1968 if !pattern.is_match(val) {
1969 return Err(ValidationError::new(
1970 1005,
1971 "lei does not match the required pattern".to_string(),
1972 ));
1973 }
1974 }
1975 Ok(())
1976 }
1977}
1978
1979#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1981pub struct FinancialInstitutionIdentification183 {
1982 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1983 pub bicfi: Option<String>,
1984 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1985 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1986 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1987 pub lei: Option<String>,
1988 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1989 pub nm: Option<String>,
1990 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1991 pub pstl_adr: Option<PostalAddress243>,
1992}
1993
1994impl FinancialInstitutionIdentification183 {
1995 pub fn validate(&self) -> Result<(), ValidationError> {
1996 if let Some(ref val) = self.bicfi {
1997 let pattern =
1998 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
1999 if !pattern.is_match(val) {
2000 return Err(ValidationError::new(
2001 1005,
2002 "bicfi does not match the required pattern".to_string(),
2003 ));
2004 }
2005 }
2006 if let Some(ref val) = self.clr_sys_mmb_id {
2007 val.validate()?
2008 }
2009 if let Some(ref val) = self.lei {
2010 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
2011 if !pattern.is_match(val) {
2012 return Err(ValidationError::new(
2013 1005,
2014 "lei does not match the required pattern".to_string(),
2015 ));
2016 }
2017 }
2018 if let Some(ref val) = self.nm {
2019 if val.chars().count() < 1 {
2020 return Err(ValidationError::new(
2021 1001,
2022 "nm is shorter than the minimum length of 1".to_string(),
2023 ));
2024 }
2025 if val.chars().count() > 140 {
2026 return Err(ValidationError::new(
2027 1002,
2028 "nm exceeds the maximum length of 140".to_string(),
2029 ));
2030 }
2031 }
2032 if let Some(ref val) = self.pstl_adr {
2033 val.validate()?
2034 }
2035 Ok(())
2036 }
2037}
2038
2039#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2041pub struct FinancialInstitutionIdentification184 {
2042 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
2043 pub bicfi: Option<String>,
2044 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
2045 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification2>,
2046 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2047 pub lei: Option<String>,
2048 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2049 pub nm: Option<String>,
2050 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2051 pub pstl_adr: Option<PostalAddress243>,
2052}
2053
2054impl FinancialInstitutionIdentification184 {
2055 pub fn validate(&self) -> Result<(), ValidationError> {
2056 if let Some(ref val) = self.bicfi {
2057 let pattern =
2058 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
2059 if !pattern.is_match(val) {
2060 return Err(ValidationError::new(
2061 1005,
2062 "bicfi does not match the required pattern".to_string(),
2063 ));
2064 }
2065 }
2066 if let Some(ref val) = self.clr_sys_mmb_id {
2067 val.validate()?
2068 }
2069 if let Some(ref val) = self.lei {
2070 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
2071 if !pattern.is_match(val) {
2072 return Err(ValidationError::new(
2073 1005,
2074 "lei does not match the required pattern".to_string(),
2075 ));
2076 }
2077 }
2078 if let Some(ref val) = self.nm {
2079 if val.chars().count() < 1 {
2080 return Err(ValidationError::new(
2081 1001,
2082 "nm is shorter than the minimum length of 1".to_string(),
2083 ));
2084 }
2085 if val.chars().count() > 140 {
2086 return Err(ValidationError::new(
2087 1002,
2088 "nm exceeds the maximum length of 140".to_string(),
2089 ));
2090 }
2091 }
2092 if let Some(ref val) = self.pstl_adr {
2093 val.validate()?
2094 }
2095 Ok(())
2096 }
2097}
2098
2099#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2101pub struct FinancialInstitutionIdentification185 {
2102 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
2103 pub bicfi: Option<String>,
2104 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
2105 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
2106 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2107 pub lei: Option<String>,
2108 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2109 pub nm: Option<String>,
2110 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2111 pub pstl_adr: Option<PostalAddress241>,
2112 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2113 pub othr: Option<GenericFinancialIdentification11>,
2114}
2115
2116impl FinancialInstitutionIdentification185 {
2117 pub fn validate(&self) -> Result<(), ValidationError> {
2118 if let Some(ref val) = self.bicfi {
2119 let pattern =
2120 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
2121 if !pattern.is_match(val) {
2122 return Err(ValidationError::new(
2123 1005,
2124 "bicfi does not match the required pattern".to_string(),
2125 ));
2126 }
2127 }
2128 if let Some(ref val) = self.clr_sys_mmb_id {
2129 val.validate()?
2130 }
2131 if let Some(ref val) = self.lei {
2132 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
2133 if !pattern.is_match(val) {
2134 return Err(ValidationError::new(
2135 1005,
2136 "lei does not match the required pattern".to_string(),
2137 ));
2138 }
2139 }
2140 if let Some(ref val) = self.nm {
2141 if val.chars().count() < 1 {
2142 return Err(ValidationError::new(
2143 1001,
2144 "nm is shorter than the minimum length of 1".to_string(),
2145 ));
2146 }
2147 if val.chars().count() > 140 {
2148 return Err(ValidationError::new(
2149 1002,
2150 "nm exceeds the maximum length of 140".to_string(),
2151 ));
2152 }
2153 let pattern = Regex::new(
2154 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2155 )
2156 .unwrap();
2157 if !pattern.is_match(val) {
2158 return Err(ValidationError::new(
2159 1005,
2160 "nm does not match the required pattern".to_string(),
2161 ));
2162 }
2163 }
2164 if let Some(ref val) = self.pstl_adr {
2165 val.validate()?
2166 }
2167 if let Some(ref val) = self.othr {
2168 val.validate()?
2169 }
2170 Ok(())
2171 }
2172}
2173
2174#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2176pub struct FinancialInstitutionIdentification186 {
2177 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
2178 pub bicfi: Option<String>,
2179 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
2180 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification22>,
2181 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2182 pub lei: Option<String>,
2183 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2184 pub nm: Option<String>,
2185 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2186 pub pstl_adr: Option<PostalAddress241>,
2187}
2188
2189impl FinancialInstitutionIdentification186 {
2190 pub fn validate(&self) -> Result<(), ValidationError> {
2191 if let Some(ref val) = self.bicfi {
2192 let pattern =
2193 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
2194 if !pattern.is_match(val) {
2195 return Err(ValidationError::new(
2196 1005,
2197 "bicfi does not match the required pattern".to_string(),
2198 ));
2199 }
2200 }
2201 if let Some(ref val) = self.clr_sys_mmb_id {
2202 val.validate()?
2203 }
2204 if let Some(ref val) = self.lei {
2205 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
2206 if !pattern.is_match(val) {
2207 return Err(ValidationError::new(
2208 1005,
2209 "lei does not match the required pattern".to_string(),
2210 ));
2211 }
2212 }
2213 if let Some(ref val) = self.nm {
2214 if val.chars().count() < 1 {
2215 return Err(ValidationError::new(
2216 1001,
2217 "nm is shorter than the minimum length of 1".to_string(),
2218 ));
2219 }
2220 if val.chars().count() > 140 {
2221 return Err(ValidationError::new(
2222 1002,
2223 "nm exceeds the maximum length of 140".to_string(),
2224 ));
2225 }
2226 let pattern = Regex::new(
2227 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2228 )
2229 .unwrap();
2230 if !pattern.is_match(val) {
2231 return Err(ValidationError::new(
2232 1005,
2233 "nm does not match the required pattern".to_string(),
2234 ));
2235 }
2236 }
2237 if let Some(ref val) = self.pstl_adr {
2238 val.validate()?
2239 }
2240 Ok(())
2241 }
2242}
2243
2244#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2246pub struct FinancialInstitutionIdentification187 {
2247 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
2248 pub bicfi: Option<String>,
2249 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
2250 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
2251 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2252 pub lei: Option<String>,
2253 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2254 pub nm: Option<String>,
2255 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2256 pub pstl_adr: Option<PostalAddress241>,
2257 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2258 pub othr: Option<GenericFinancialIdentification11>,
2259}
2260
2261impl FinancialInstitutionIdentification187 {
2262 pub fn validate(&self) -> Result<(), ValidationError> {
2263 if let Some(ref val) = self.bicfi {
2264 let pattern =
2265 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
2266 if !pattern.is_match(val) {
2267 return Err(ValidationError::new(
2268 1005,
2269 "bicfi does not match the required pattern".to_string(),
2270 ));
2271 }
2272 }
2273 if let Some(ref val) = self.clr_sys_mmb_id {
2274 val.validate()?
2275 }
2276 if let Some(ref val) = self.lei {
2277 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
2278 if !pattern.is_match(val) {
2279 return Err(ValidationError::new(
2280 1005,
2281 "lei does not match the required pattern".to_string(),
2282 ));
2283 }
2284 }
2285 if let Some(ref val) = self.nm {
2286 if val.chars().count() < 1 {
2287 return Err(ValidationError::new(
2288 1001,
2289 "nm is shorter than the minimum length of 1".to_string(),
2290 ));
2291 }
2292 if val.chars().count() > 140 {
2293 return Err(ValidationError::new(
2294 1002,
2295 "nm exceeds the maximum length of 140".to_string(),
2296 ));
2297 }
2298 let pattern = Regex::new(
2299 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2300 )
2301 .unwrap();
2302 if !pattern.is_match(val) {
2303 return Err(ValidationError::new(
2304 1005,
2305 "nm does not match the required pattern".to_string(),
2306 ));
2307 }
2308 }
2309 if let Some(ref val) = self.pstl_adr {
2310 val.validate()?
2311 }
2312 if let Some(ref val) = self.othr {
2313 val.validate()?
2314 }
2315 Ok(())
2316 }
2317}
2318
2319#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2321pub struct Frequency36Choice {
2322 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
2323 pub tp: Option<Frequency6Code>,
2324 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
2325 pub prd: Option<FrequencyPeriod1>,
2326 #[serde(rename = "PtInTm", skip_serializing_if = "Option::is_none")]
2327 pub pt_in_tm: Option<FrequencyAndMoment1>,
2328}
2329
2330impl Frequency36Choice {
2331 pub fn validate(&self) -> Result<(), ValidationError> {
2332 if let Some(ref val) = self.tp {
2333 val.validate()?
2334 }
2335 if let Some(ref val) = self.prd {
2336 val.validate()?
2337 }
2338 if let Some(ref val) = self.pt_in_tm {
2339 val.validate()?
2340 }
2341 Ok(())
2342 }
2343}
2344
2345#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2347pub enum Frequency6Code {
2348 #[default]
2349 #[serde(rename = "YEAR")]
2350 CodeYEAR,
2351 #[serde(rename = "MNTH")]
2352 CodeMNTH,
2353 #[serde(rename = "QURT")]
2354 CodeQURT,
2355 #[serde(rename = "MIAN")]
2356 CodeMIAN,
2357 #[serde(rename = "WEEK")]
2358 CodeWEEK,
2359 #[serde(rename = "DAIL")]
2360 CodeDAIL,
2361 #[serde(rename = "ADHO")]
2362 CodeADHO,
2363 #[serde(rename = "INDA")]
2364 CodeINDA,
2365 #[serde(rename = "FRTN")]
2366 CodeFRTN,
2367}
2368
2369impl Frequency6Code {
2370 pub fn validate(&self) -> Result<(), ValidationError> {
2371 Ok(())
2372 }
2373}
2374
2375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2377pub struct FrequencyAndMoment1 {
2378 #[serde(rename = "Tp")]
2379 pub tp: Frequency6Code,
2380 #[serde(rename = "PtInTm")]
2381 pub pt_in_tm: String,
2382}
2383
2384impl FrequencyAndMoment1 {
2385 pub fn validate(&self) -> Result<(), ValidationError> {
2386 self.tp.validate()?;
2387 let pattern = Regex::new("[0-9]{2}").unwrap();
2388 if !pattern.is_match(&self.pt_in_tm) {
2389 return Err(ValidationError::new(
2390 1005,
2391 "pt_in_tm does not match the required pattern".to_string(),
2392 ));
2393 }
2394 Ok(())
2395 }
2396}
2397
2398#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2400pub struct FrequencyPeriod1 {
2401 #[serde(rename = "Tp")]
2402 pub tp: Frequency6Code,
2403 #[serde(rename = "CntPerPrd")]
2404 pub cnt_per_prd: f64,
2405}
2406
2407impl FrequencyPeriod1 {
2408 pub fn validate(&self) -> Result<(), ValidationError> {
2409 self.tp.validate()?;
2410 Ok(())
2411 }
2412}
2413
2414#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2416pub struct Garnishment31 {
2417 #[serde(rename = "Tp")]
2418 pub tp: GarnishmentType11,
2419 #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
2420 pub grnshee: Option<PartyIdentification1355>,
2421 #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
2422 pub grnshmt_admstr: Option<PartyIdentification1355>,
2423 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
2424 pub ref_nb: Option<String>,
2425 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
2426 pub dt: Option<String>,
2427 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
2428 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
2429 #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
2430 pub fmly_mdcl_insrnc_ind: Option<bool>,
2431 #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
2432 pub mplyee_termntn_ind: Option<bool>,
2433}
2434
2435impl Garnishment31 {
2436 pub fn validate(&self) -> Result<(), ValidationError> {
2437 self.tp.validate()?;
2438 if let Some(ref val) = self.grnshee {
2439 val.validate()?
2440 }
2441 if let Some(ref val) = self.grnshmt_admstr {
2442 val.validate()?
2443 }
2444 if let Some(ref val) = self.ref_nb {
2445 if val.chars().count() < 1 {
2446 return Err(ValidationError::new(
2447 1001,
2448 "ref_nb is shorter than the minimum length of 1".to_string(),
2449 ));
2450 }
2451 if val.chars().count() > 140 {
2452 return Err(ValidationError::new(
2453 1002,
2454 "ref_nb exceeds the maximum length of 140".to_string(),
2455 ));
2456 }
2457 let pattern = Regex::new(
2458 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2459 )
2460 .unwrap();
2461 if !pattern.is_match(val) {
2462 return Err(ValidationError::new(
2463 1005,
2464 "ref_nb does not match the required pattern".to_string(),
2465 ));
2466 }
2467 }
2468 if let Some(ref val) = self.rmtd_amt {
2469 val.validate()?
2470 }
2471 Ok(())
2472 }
2473}
2474
2475#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2477pub struct GarnishmentType1Choice1 {
2478 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2479 pub cd: Option<String>,
2480 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2481 pub prtry: Option<String>,
2482}
2483
2484impl GarnishmentType1Choice1 {
2485 pub fn validate(&self) -> Result<(), ValidationError> {
2486 if let Some(ref val) = self.cd {
2487 if val.chars().count() < 1 {
2488 return Err(ValidationError::new(
2489 1001,
2490 "cd is shorter than the minimum length of 1".to_string(),
2491 ));
2492 }
2493 if val.chars().count() > 4 {
2494 return Err(ValidationError::new(
2495 1002,
2496 "cd exceeds the maximum length of 4".to_string(),
2497 ));
2498 }
2499 }
2500 if let Some(ref val) = self.prtry {
2501 if val.chars().count() < 1 {
2502 return Err(ValidationError::new(
2503 1001,
2504 "prtry is shorter than the minimum length of 1".to_string(),
2505 ));
2506 }
2507 if val.chars().count() > 35 {
2508 return Err(ValidationError::new(
2509 1002,
2510 "prtry exceeds the maximum length of 35".to_string(),
2511 ));
2512 }
2513 let pattern = Regex::new(
2514 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2515 )
2516 .unwrap();
2517 if !pattern.is_match(val) {
2518 return Err(ValidationError::new(
2519 1005,
2520 "prtry does not match the required pattern".to_string(),
2521 ));
2522 }
2523 }
2524 Ok(())
2525 }
2526}
2527
2528#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2530pub struct GarnishmentType11 {
2531 #[serde(rename = "CdOrPrtry")]
2532 pub cd_or_prtry: GarnishmentType1Choice1,
2533 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2534 pub issr: Option<String>,
2535}
2536
2537impl GarnishmentType11 {
2538 pub fn validate(&self) -> Result<(), ValidationError> {
2539 self.cd_or_prtry.validate()?;
2540 if let Some(ref val) = self.issr {
2541 if val.chars().count() < 1 {
2542 return Err(ValidationError::new(
2543 1001,
2544 "issr is shorter than the minimum length of 1".to_string(),
2545 ));
2546 }
2547 if val.chars().count() > 35 {
2548 return Err(ValidationError::new(
2549 1002,
2550 "issr exceeds the maximum length of 35".to_string(),
2551 ));
2552 }
2553 let pattern = Regex::new(
2554 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2555 )
2556 .unwrap();
2557 if !pattern.is_match(val) {
2558 return Err(ValidationError::new(
2559 1005,
2560 "issr does not match the required pattern".to_string(),
2561 ));
2562 }
2563 }
2564 Ok(())
2565 }
2566}
2567
2568#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2570pub struct GenericAccountIdentification1 {
2571 #[serde(rename = "Id")]
2572 pub id: String,
2573 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2574 pub schme_nm: Option<AccountSchemeName1Choice>,
2575 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2576 pub issr: Option<String>,
2577}
2578
2579impl GenericAccountIdentification1 {
2580 pub fn validate(&self) -> Result<(), ValidationError> {
2581 if self.id.chars().count() < 1 {
2582 return Err(ValidationError::new(
2583 1001,
2584 "id is shorter than the minimum length of 1".to_string(),
2585 ));
2586 }
2587 if self.id.chars().count() > 34 {
2588 return Err(ValidationError::new(
2589 1002,
2590 "id exceeds the maximum length of 34".to_string(),
2591 ));
2592 }
2593 if let Some(ref val) = self.schme_nm {
2594 val.validate()?
2595 }
2596 if let Some(ref val) = self.issr {
2597 if val.chars().count() < 1 {
2598 return Err(ValidationError::new(
2599 1001,
2600 "issr is shorter than the minimum length of 1".to_string(),
2601 ));
2602 }
2603 if val.chars().count() > 35 {
2604 return Err(ValidationError::new(
2605 1002,
2606 "issr exceeds the maximum length of 35".to_string(),
2607 ));
2608 }
2609 }
2610 Ok(())
2611 }
2612}
2613
2614#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2616pub struct GenericAccountIdentification11 {
2617 #[serde(rename = "Id")]
2618 pub id: String,
2619 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2620 pub schme_nm: Option<AccountSchemeName1Choice1>,
2621 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2622 pub issr: Option<String>,
2623}
2624
2625impl GenericAccountIdentification11 {
2626 pub fn validate(&self) -> Result<(), ValidationError> {
2627 if self.id.chars().count() < 1 {
2628 return Err(ValidationError::new(
2629 1001,
2630 "id is shorter than the minimum length of 1".to_string(),
2631 ));
2632 }
2633 if self.id.chars().count() > 34 {
2634 return Err(ValidationError::new(
2635 1002,
2636 "id exceeds the maximum length of 34".to_string(),
2637 ));
2638 }
2639 let pattern = Regex::new("([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)").unwrap();
2640 if !pattern.is_match(&self.id) {
2641 return Err(ValidationError::new(
2642 1005,
2643 "id does not match the required pattern".to_string(),
2644 ));
2645 }
2646 if let Some(ref val) = self.schme_nm {
2647 val.validate()?
2648 }
2649 if let Some(ref val) = self.issr {
2650 if val.chars().count() < 1 {
2651 return Err(ValidationError::new(
2652 1001,
2653 "issr is shorter than the minimum length of 1".to_string(),
2654 ));
2655 }
2656 if val.chars().count() > 35 {
2657 return Err(ValidationError::new(
2658 1002,
2659 "issr exceeds the maximum length of 35".to_string(),
2660 ));
2661 }
2662 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2663 if !pattern.is_match(val) {
2664 return Err(ValidationError::new(
2665 1005,
2666 "issr does not match the required pattern".to_string(),
2667 ));
2668 }
2669 }
2670 Ok(())
2671 }
2672}
2673
2674#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2676pub struct GenericFinancialIdentification11 {
2677 #[serde(rename = "Id")]
2678 pub id: String,
2679 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2680 pub schme_nm: Option<FinancialIdentificationSchemeName1Choice1>,
2681 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2682 pub issr: Option<String>,
2683}
2684
2685impl GenericFinancialIdentification11 {
2686 pub fn validate(&self) -> Result<(), ValidationError> {
2687 if self.id.chars().count() < 1 {
2688 return Err(ValidationError::new(
2689 1001,
2690 "id is shorter than the minimum length of 1".to_string(),
2691 ));
2692 }
2693 if self.id.chars().count() > 35 {
2694 return Err(ValidationError::new(
2695 1002,
2696 "id exceeds the maximum length of 35".to_string(),
2697 ));
2698 }
2699 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2700 if !pattern.is_match(&self.id) {
2701 return Err(ValidationError::new(
2702 1005,
2703 "id does not match the required pattern".to_string(),
2704 ));
2705 }
2706 if let Some(ref val) = self.schme_nm {
2707 val.validate()?
2708 }
2709 if let Some(ref val) = self.issr {
2710 if val.chars().count() < 1 {
2711 return Err(ValidationError::new(
2712 1001,
2713 "issr is shorter than the minimum length of 1".to_string(),
2714 ));
2715 }
2716 if val.chars().count() > 35 {
2717 return Err(ValidationError::new(
2718 1002,
2719 "issr exceeds the maximum length of 35".to_string(),
2720 ));
2721 }
2722 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2723 if !pattern.is_match(val) {
2724 return Err(ValidationError::new(
2725 1005,
2726 "issr does not match the required pattern".to_string(),
2727 ));
2728 }
2729 }
2730 Ok(())
2731 }
2732}
2733
2734#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2736pub struct GenericOrganisationIdentification1 {
2737 #[serde(rename = "Id")]
2738 pub id: String,
2739 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2740 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice>,
2741 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2742 pub issr: Option<String>,
2743}
2744
2745impl GenericOrganisationIdentification1 {
2746 pub fn validate(&self) -> Result<(), ValidationError> {
2747 if self.id.chars().count() < 1 {
2748 return Err(ValidationError::new(
2749 1001,
2750 "id is shorter than the minimum length of 1".to_string(),
2751 ));
2752 }
2753 if self.id.chars().count() > 35 {
2754 return Err(ValidationError::new(
2755 1002,
2756 "id exceeds the maximum length of 35".to_string(),
2757 ));
2758 }
2759 if let Some(ref val) = self.schme_nm {
2760 val.validate()?
2761 }
2762 if let Some(ref val) = self.issr {
2763 if val.chars().count() < 1 {
2764 return Err(ValidationError::new(
2765 1001,
2766 "issr is shorter than the minimum length of 1".to_string(),
2767 ));
2768 }
2769 if val.chars().count() > 35 {
2770 return Err(ValidationError::new(
2771 1002,
2772 "issr exceeds the maximum length of 35".to_string(),
2773 ));
2774 }
2775 }
2776 Ok(())
2777 }
2778}
2779
2780#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2782pub struct GenericOrganisationIdentification11 {
2783 #[serde(rename = "Id")]
2784 pub id: String,
2785 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2786 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
2787 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2788 pub issr: Option<String>,
2789}
2790
2791impl GenericOrganisationIdentification11 {
2792 pub fn validate(&self) -> Result<(), ValidationError> {
2793 if self.id.chars().count() < 1 {
2794 return Err(ValidationError::new(
2795 1001,
2796 "id is shorter than the minimum length of 1".to_string(),
2797 ));
2798 }
2799 if self.id.chars().count() > 35 {
2800 return Err(ValidationError::new(
2801 1002,
2802 "id exceeds the maximum length of 35".to_string(),
2803 ));
2804 }
2805 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2806 if !pattern.is_match(&self.id) {
2807 return Err(ValidationError::new(
2808 1005,
2809 "id does not match the required pattern".to_string(),
2810 ));
2811 }
2812 if let Some(ref val) = self.schme_nm {
2813 val.validate()?
2814 }
2815 if let Some(ref val) = self.issr {
2816 if val.chars().count() < 1 {
2817 return Err(ValidationError::new(
2818 1001,
2819 "issr is shorter than the minimum length of 1".to_string(),
2820 ));
2821 }
2822 if val.chars().count() > 35 {
2823 return Err(ValidationError::new(
2824 1002,
2825 "issr exceeds the maximum length of 35".to_string(),
2826 ));
2827 }
2828 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2829 if !pattern.is_match(val) {
2830 return Err(ValidationError::new(
2831 1005,
2832 "issr does not match the required pattern".to_string(),
2833 ));
2834 }
2835 }
2836 Ok(())
2837 }
2838}
2839
2840#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2842pub struct GenericOrganisationIdentification12 {
2843 #[serde(rename = "Id")]
2844 pub id: String,
2845 #[serde(rename = "SchmeNm")]
2846 pub schme_nm: OrganisationIdentificationSchemeName1Choice2,
2847 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2848 pub issr: Option<String>,
2849}
2850
2851impl GenericOrganisationIdentification12 {
2852 pub fn validate(&self) -> Result<(), ValidationError> {
2853 if self.id.chars().count() < 1 {
2854 return Err(ValidationError::new(
2855 1001,
2856 "id is shorter than the minimum length of 1".to_string(),
2857 ));
2858 }
2859 if self.id.chars().count() > 35 {
2860 return Err(ValidationError::new(
2861 1002,
2862 "id exceeds the maximum length of 35".to_string(),
2863 ));
2864 }
2865 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2866 if !pattern.is_match(&self.id) {
2867 return Err(ValidationError::new(
2868 1005,
2869 "id does not match the required pattern".to_string(),
2870 ));
2871 }
2872 self.schme_nm.validate()?;
2873 if let Some(ref val) = self.issr {
2874 if val.chars().count() < 1 {
2875 return Err(ValidationError::new(
2876 1001,
2877 "issr is shorter than the minimum length of 1".to_string(),
2878 ));
2879 }
2880 if val.chars().count() > 35 {
2881 return Err(ValidationError::new(
2882 1002,
2883 "issr exceeds the maximum length of 35".to_string(),
2884 ));
2885 }
2886 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
2887 if !pattern.is_match(val) {
2888 return Err(ValidationError::new(
2889 1005,
2890 "issr does not match the required pattern".to_string(),
2891 ));
2892 }
2893 }
2894 Ok(())
2895 }
2896}
2897
2898#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2900pub struct GenericOrganisationIdentification13 {
2901 #[serde(rename = "Id")]
2902 pub id: String,
2903 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2904 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice3>,
2905 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2906 pub issr: Option<String>,
2907}
2908
2909impl GenericOrganisationIdentification13 {
2910 pub fn validate(&self) -> Result<(), ValidationError> {
2911 if self.id.chars().count() < 1 {
2912 return Err(ValidationError::new(
2913 1001,
2914 "id is shorter than the minimum length of 1".to_string(),
2915 ));
2916 }
2917 if self.id.chars().count() > 35 {
2918 return Err(ValidationError::new(
2919 1002,
2920 "id exceeds the maximum length of 35".to_string(),
2921 ));
2922 }
2923 let pattern =
2924 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
2925 .unwrap();
2926 if !pattern.is_match(&self.id) {
2927 return Err(ValidationError::new(
2928 1005,
2929 "id does not match the required pattern".to_string(),
2930 ));
2931 }
2932 if let Some(ref val) = self.schme_nm {
2933 val.validate()?
2934 }
2935 if let Some(ref val) = self.issr {
2936 if val.chars().count() < 1 {
2937 return Err(ValidationError::new(
2938 1001,
2939 "issr is shorter than the minimum length of 1".to_string(),
2940 ));
2941 }
2942 if val.chars().count() > 35 {
2943 return Err(ValidationError::new(
2944 1002,
2945 "issr exceeds the maximum length of 35".to_string(),
2946 ));
2947 }
2948 let pattern = Regex::new(
2949 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
2950 )
2951 .unwrap();
2952 if !pattern.is_match(val) {
2953 return Err(ValidationError::new(
2954 1005,
2955 "issr does not match the required pattern".to_string(),
2956 ));
2957 }
2958 }
2959 Ok(())
2960 }
2961}
2962
2963#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2965pub struct GenericPersonIdentification1 {
2966 #[serde(rename = "Id")]
2967 pub id: String,
2968 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2969 pub schme_nm: Option<PersonIdentificationSchemeName1Choice>,
2970 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2971 pub issr: Option<String>,
2972}
2973
2974impl GenericPersonIdentification1 {
2975 pub fn validate(&self) -> Result<(), ValidationError> {
2976 if self.id.chars().count() < 1 {
2977 return Err(ValidationError::new(
2978 1001,
2979 "id is shorter than the minimum length of 1".to_string(),
2980 ));
2981 }
2982 if self.id.chars().count() > 35 {
2983 return Err(ValidationError::new(
2984 1002,
2985 "id exceeds the maximum length of 35".to_string(),
2986 ));
2987 }
2988 if let Some(ref val) = self.schme_nm {
2989 val.validate()?
2990 }
2991 if let Some(ref val) = self.issr {
2992 if val.chars().count() < 1 {
2993 return Err(ValidationError::new(
2994 1001,
2995 "issr is shorter than the minimum length of 1".to_string(),
2996 ));
2997 }
2998 if val.chars().count() > 35 {
2999 return Err(ValidationError::new(
3000 1002,
3001 "issr exceeds the maximum length of 35".to_string(),
3002 ));
3003 }
3004 }
3005 Ok(())
3006 }
3007}
3008
3009#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3011pub struct GenericPersonIdentification11 {
3012 #[serde(rename = "Id")]
3013 pub id: String,
3014 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
3015 pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
3016 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3017 pub issr: Option<String>,
3018}
3019
3020impl GenericPersonIdentification11 {
3021 pub fn validate(&self) -> Result<(), ValidationError> {
3022 if self.id.chars().count() < 1 {
3023 return Err(ValidationError::new(
3024 1001,
3025 "id is shorter than the minimum length of 1".to_string(),
3026 ));
3027 }
3028 if self.id.chars().count() > 35 {
3029 return Err(ValidationError::new(
3030 1002,
3031 "id exceeds the maximum length of 35".to_string(),
3032 ));
3033 }
3034 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3035 if !pattern.is_match(&self.id) {
3036 return Err(ValidationError::new(
3037 1005,
3038 "id does not match the required pattern".to_string(),
3039 ));
3040 }
3041 if let Some(ref val) = self.schme_nm {
3042 val.validate()?
3043 }
3044 if let Some(ref val) = self.issr {
3045 if val.chars().count() < 1 {
3046 return Err(ValidationError::new(
3047 1001,
3048 "issr is shorter than the minimum length of 1".to_string(),
3049 ));
3050 }
3051 if val.chars().count() > 35 {
3052 return Err(ValidationError::new(
3053 1002,
3054 "issr exceeds the maximum length of 35".to_string(),
3055 ));
3056 }
3057 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3058 if !pattern.is_match(val) {
3059 return Err(ValidationError::new(
3060 1005,
3061 "issr does not match the required pattern".to_string(),
3062 ));
3063 }
3064 }
3065 Ok(())
3066 }
3067}
3068
3069#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3071pub struct GenericPersonIdentification12 {
3072 #[serde(rename = "Id")]
3073 pub id: String,
3074 #[serde(rename = "SchmeNm")]
3075 pub schme_nm: PersonIdentificationSchemeName1Choice2,
3076 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3077 pub issr: Option<String>,
3078}
3079
3080impl GenericPersonIdentification12 {
3081 pub fn validate(&self) -> Result<(), ValidationError> {
3082 if self.id.chars().count() < 1 {
3083 return Err(ValidationError::new(
3084 1001,
3085 "id is shorter than the minimum length of 1".to_string(),
3086 ));
3087 }
3088 if self.id.chars().count() > 35 {
3089 return Err(ValidationError::new(
3090 1002,
3091 "id exceeds the maximum length of 35".to_string(),
3092 ));
3093 }
3094 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3095 if !pattern.is_match(&self.id) {
3096 return Err(ValidationError::new(
3097 1005,
3098 "id does not match the required pattern".to_string(),
3099 ));
3100 }
3101 self.schme_nm.validate()?;
3102 if let Some(ref val) = self.issr {
3103 if val.chars().count() < 1 {
3104 return Err(ValidationError::new(
3105 1001,
3106 "issr is shorter than the minimum length of 1".to_string(),
3107 ));
3108 }
3109 if val.chars().count() > 35 {
3110 return Err(ValidationError::new(
3111 1002,
3112 "issr exceeds the maximum length of 35".to_string(),
3113 ));
3114 }
3115 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3116 if !pattern.is_match(val) {
3117 return Err(ValidationError::new(
3118 1005,
3119 "issr does not match the required pattern".to_string(),
3120 ));
3121 }
3122 }
3123 Ok(())
3124 }
3125}
3126
3127#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3129pub struct GenericPersonIdentification13 {
3130 #[serde(rename = "Id")]
3131 pub id: String,
3132 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
3133 pub schme_nm: Option<PersonIdentificationSchemeName1Choice3>,
3134 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
3135 pub issr: Option<String>,
3136}
3137
3138impl GenericPersonIdentification13 {
3139 pub fn validate(&self) -> Result<(), ValidationError> {
3140 if self.id.chars().count() < 1 {
3141 return Err(ValidationError::new(
3142 1001,
3143 "id is shorter than the minimum length of 1".to_string(),
3144 ));
3145 }
3146 if self.id.chars().count() > 35 {
3147 return Err(ValidationError::new(
3148 1002,
3149 "id exceeds the maximum length of 35".to_string(),
3150 ));
3151 }
3152 let pattern =
3153 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
3154 .unwrap();
3155 if !pattern.is_match(&self.id) {
3156 return Err(ValidationError::new(
3157 1005,
3158 "id does not match the required pattern".to_string(),
3159 ));
3160 }
3161 if let Some(ref val) = self.schme_nm {
3162 val.validate()?
3163 }
3164 if let Some(ref val) = self.issr {
3165 if val.chars().count() < 1 {
3166 return Err(ValidationError::new(
3167 1001,
3168 "issr is shorter than the minimum length of 1".to_string(),
3169 ));
3170 }
3171 if val.chars().count() > 35 {
3172 return Err(ValidationError::new(
3173 1002,
3174 "issr exceeds the maximum length of 35".to_string(),
3175 ));
3176 }
3177 let pattern = Regex::new(
3178 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3179 )
3180 .unwrap();
3181 if !pattern.is_match(val) {
3182 return Err(ValidationError::new(
3183 1005,
3184 "issr does not match the required pattern".to_string(),
3185 ));
3186 }
3187 }
3188 Ok(())
3189 }
3190}
3191
3192#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3194pub struct GroupHeader901 {
3195 #[serde(rename = "MsgId")]
3196 pub msg_id: String,
3197 #[serde(rename = "CreDtTm")]
3198 pub cre_dt_tm: String,
3199 #[serde(rename = "NbOfTxs")]
3200 pub nb_of_txs: Max15NumericTextfixed,
3201 #[serde(rename = "SttlmInf")]
3202 pub sttlm_inf: SettlementInstruction71,
3203}
3204
3205impl GroupHeader901 {
3206 pub fn validate(&self) -> Result<(), ValidationError> {
3207 if self.msg_id.chars().count() < 1 {
3208 return Err(ValidationError::new(
3209 1001,
3210 "msg_id is shorter than the minimum length of 1".to_string(),
3211 ));
3212 }
3213 if self.msg_id.chars().count() > 35 {
3214 return Err(ValidationError::new(
3215 1002,
3216 "msg_id exceeds the maximum length of 35".to_string(),
3217 ));
3218 }
3219 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3220 if !pattern.is_match(&self.msg_id) {
3221 return Err(ValidationError::new(
3222 1005,
3223 "msg_id does not match the required pattern".to_string(),
3224 ));
3225 }
3226 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
3227 if !pattern.is_match(&self.cre_dt_tm) {
3228 return Err(ValidationError::new(
3229 1005,
3230 "cre_dt_tm does not match the required pattern".to_string(),
3231 ));
3232 }
3233 self.nb_of_txs.validate()?;
3234 self.sttlm_inf.validate()?;
3235 Ok(())
3236 }
3237}
3238
3239#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3241pub struct LocalInstrument2Choice1 {
3242 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3243 pub cd: Option<String>,
3244 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3245 pub prtry: Option<String>,
3246}
3247
3248impl LocalInstrument2Choice1 {
3249 pub fn validate(&self) -> Result<(), ValidationError> {
3250 if let Some(ref val) = self.cd {
3251 if val.chars().count() < 1 {
3252 return Err(ValidationError::new(
3253 1001,
3254 "cd is shorter than the minimum length of 1".to_string(),
3255 ));
3256 }
3257 if val.chars().count() > 35 {
3258 return Err(ValidationError::new(
3259 1002,
3260 "cd exceeds the maximum length of 35".to_string(),
3261 ));
3262 }
3263 }
3264 if let Some(ref val) = self.prtry {
3265 if val.chars().count() < 1 {
3266 return Err(ValidationError::new(
3267 1001,
3268 "prtry is shorter than the minimum length of 1".to_string(),
3269 ));
3270 }
3271 if val.chars().count() > 35 {
3272 return Err(ValidationError::new(
3273 1002,
3274 "prtry exceeds the maximum length of 35".to_string(),
3275 ));
3276 }
3277 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3278 if !pattern.is_match(val) {
3279 return Err(ValidationError::new(
3280 1005,
3281 "prtry does not match the required pattern".to_string(),
3282 ));
3283 }
3284 }
3285 Ok(())
3286 }
3287}
3288
3289#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3291pub struct MandateRelatedInformation141 {
3292 #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
3293 pub mndt_id: Option<String>,
3294 #[serde(rename = "DtOfSgntr", skip_serializing_if = "Option::is_none")]
3295 pub dt_of_sgntr: Option<String>,
3296 #[serde(rename = "AmdmntInd", skip_serializing_if = "Option::is_none")]
3297 pub amdmnt_ind: Option<bool>,
3298 #[serde(rename = "AmdmntInfDtls", skip_serializing_if = "Option::is_none")]
3299 pub amdmnt_inf_dtls: Option<AmendmentInformationDetails131>,
3300 #[serde(rename = "ElctrncSgntr", skip_serializing_if = "Option::is_none")]
3301 pub elctrnc_sgntr: Option<String>,
3302 #[serde(rename = "FrstColltnDt", skip_serializing_if = "Option::is_none")]
3303 pub frst_colltn_dt: Option<String>,
3304 #[serde(rename = "FnlColltnDt", skip_serializing_if = "Option::is_none")]
3305 pub fnl_colltn_dt: Option<String>,
3306 #[serde(rename = "Frqcy", skip_serializing_if = "Option::is_none")]
3307 pub frqcy: Option<Frequency36Choice>,
3308 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
3309 pub rsn: Option<MandateSetupReason1Choice>,
3310 #[serde(rename = "TrckgDays", skip_serializing_if = "Option::is_none")]
3311 pub trckg_days: Option<String>,
3312}
3313
3314impl MandateRelatedInformation141 {
3315 pub fn validate(&self) -> Result<(), ValidationError> {
3316 if let Some(ref val) = self.mndt_id {
3317 if val.chars().count() < 1 {
3318 return Err(ValidationError::new(
3319 1001,
3320 "mndt_id is shorter than the minimum length of 1".to_string(),
3321 ));
3322 }
3323 if val.chars().count() > 35 {
3324 return Err(ValidationError::new(
3325 1002,
3326 "mndt_id exceeds the maximum length of 35".to_string(),
3327 ));
3328 }
3329 }
3330 if let Some(ref val) = self.amdmnt_inf_dtls {
3331 val.validate()?
3332 }
3333 if let Some(ref val) = self.elctrnc_sgntr {
3334 if val.chars().count() < 1 {
3335 return Err(ValidationError::new(
3336 1001,
3337 "elctrnc_sgntr is shorter than the minimum length of 1".to_string(),
3338 ));
3339 }
3340 if val.chars().count() > 1025 {
3341 return Err(ValidationError::new(
3342 1002,
3343 "elctrnc_sgntr exceeds the maximum length of 1025".to_string(),
3344 ));
3345 }
3346 }
3347 if let Some(ref val) = self.frqcy {
3348 val.validate()?
3349 }
3350 if let Some(ref val) = self.rsn {
3351 val.validate()?
3352 }
3353 if let Some(ref val) = self.trckg_days {
3354 let pattern = Regex::new("[0-9]{2}").unwrap();
3355 if !pattern.is_match(val) {
3356 return Err(ValidationError::new(
3357 1005,
3358 "trckg_days does not match the required pattern".to_string(),
3359 ));
3360 }
3361 }
3362 Ok(())
3363 }
3364}
3365
3366#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3368pub struct MandateSetupReason1Choice {
3369 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3370 pub cd: Option<String>,
3371 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3372 pub prtry: Option<String>,
3373}
3374
3375impl MandateSetupReason1Choice {
3376 pub fn validate(&self) -> Result<(), ValidationError> {
3377 if let Some(ref val) = self.cd {
3378 if val.chars().count() < 1 {
3379 return Err(ValidationError::new(
3380 1001,
3381 "cd is shorter than the minimum length of 1".to_string(),
3382 ));
3383 }
3384 if val.chars().count() > 4 {
3385 return Err(ValidationError::new(
3386 1002,
3387 "cd exceeds the maximum length of 4".to_string(),
3388 ));
3389 }
3390 }
3391 if let Some(ref val) = self.prtry {
3392 if val.chars().count() < 1 {
3393 return Err(ValidationError::new(
3394 1001,
3395 "prtry is shorter than the minimum length of 1".to_string(),
3396 ));
3397 }
3398 if val.chars().count() > 70 {
3399 return Err(ValidationError::new(
3400 1002,
3401 "prtry exceeds the maximum length of 70".to_string(),
3402 ));
3403 }
3404 }
3405 Ok(())
3406 }
3407}
3408
3409#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3411pub enum Max15NumericTextfixed {
3412 #[default]
3413 #[serde(rename = "1")]
3414 Code1,
3415}
3416
3417impl Max15NumericTextfixed {
3418 pub fn validate(&self) -> Result<(), ValidationError> {
3419 Ok(())
3420 }
3421}
3422
3423#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3425pub struct OrganisationIdentification29 {
3426 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
3427 pub any_bic: Option<String>,
3428 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3429 pub lei: Option<String>,
3430 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3431 pub othr: Option<Vec<GenericOrganisationIdentification1>>,
3432}
3433
3434impl OrganisationIdentification29 {
3435 pub fn validate(&self) -> Result<(), ValidationError> {
3436 if let Some(ref val) = self.any_bic {
3437 let pattern =
3438 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
3439 if !pattern.is_match(val) {
3440 return Err(ValidationError::new(
3441 1005,
3442 "any_bic does not match the required pattern".to_string(),
3443 ));
3444 }
3445 }
3446 if let Some(ref val) = self.lei {
3447 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
3448 if !pattern.is_match(val) {
3449 return Err(ValidationError::new(
3450 1005,
3451 "lei does not match the required pattern".to_string(),
3452 ));
3453 }
3454 }
3455 if let Some(ref vec) = self.othr {
3456 for item in vec {
3457 item.validate()?
3458 }
3459 }
3460 Ok(())
3461 }
3462}
3463
3464#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3466pub struct OrganisationIdentification291 {
3467 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
3468 pub any_bic: Option<String>,
3469 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3470 pub lei: Option<String>,
3471 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3472 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
3473}
3474
3475impl OrganisationIdentification291 {
3476 pub fn validate(&self) -> Result<(), ValidationError> {
3477 if let Some(ref val) = self.any_bic {
3478 let pattern =
3479 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
3480 if !pattern.is_match(val) {
3481 return Err(ValidationError::new(
3482 1005,
3483 "any_bic does not match the required pattern".to_string(),
3484 ));
3485 }
3486 }
3487 if let Some(ref val) = self.lei {
3488 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
3489 if !pattern.is_match(val) {
3490 return Err(ValidationError::new(
3491 1005,
3492 "lei does not match the required pattern".to_string(),
3493 ));
3494 }
3495 }
3496 if let Some(ref vec) = self.othr {
3497 for item in vec {
3498 item.validate()?
3499 }
3500 }
3501 Ok(())
3502 }
3503}
3504
3505#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3507pub struct OrganisationIdentification292 {
3508 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
3509 pub any_bic: Option<String>,
3510 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3511 pub lei: Option<String>,
3512 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3513 pub othr: Option<Vec<GenericOrganisationIdentification12>>,
3514}
3515
3516impl OrganisationIdentification292 {
3517 pub fn validate(&self) -> Result<(), ValidationError> {
3518 if let Some(ref val) = self.any_bic {
3519 let pattern =
3520 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
3521 if !pattern.is_match(val) {
3522 return Err(ValidationError::new(
3523 1005,
3524 "any_bic does not match the required pattern".to_string(),
3525 ));
3526 }
3527 }
3528 if let Some(ref val) = self.lei {
3529 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
3530 if !pattern.is_match(val) {
3531 return Err(ValidationError::new(
3532 1005,
3533 "lei does not match the required pattern".to_string(),
3534 ));
3535 }
3536 }
3537 if let Some(ref vec) = self.othr {
3538 for item in vec {
3539 item.validate()?
3540 }
3541 }
3542 Ok(())
3543 }
3544}
3545
3546#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3548pub struct OrganisationIdentification293 {
3549 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
3550 pub any_bic: Option<String>,
3551 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
3552 pub lei: Option<String>,
3553 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3554 pub othr: Option<Vec<GenericOrganisationIdentification13>>,
3555}
3556
3557impl OrganisationIdentification293 {
3558 pub fn validate(&self) -> Result<(), ValidationError> {
3559 if let Some(ref val) = self.any_bic {
3560 let pattern =
3561 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
3562 if !pattern.is_match(val) {
3563 return Err(ValidationError::new(
3564 1005,
3565 "any_bic does not match the required pattern".to_string(),
3566 ));
3567 }
3568 }
3569 if let Some(ref val) = self.lei {
3570 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
3571 if !pattern.is_match(val) {
3572 return Err(ValidationError::new(
3573 1005,
3574 "lei does not match the required pattern".to_string(),
3575 ));
3576 }
3577 }
3578 if let Some(ref vec) = self.othr {
3579 for item in vec {
3580 item.validate()?
3581 }
3582 }
3583 Ok(())
3584 }
3585}
3586
3587#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3589pub struct OrganisationIdentificationSchemeName1Choice {
3590 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3591 pub cd: Option<String>,
3592 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3593 pub prtry: Option<String>,
3594}
3595
3596impl OrganisationIdentificationSchemeName1Choice {
3597 pub fn validate(&self) -> Result<(), ValidationError> {
3598 if let Some(ref val) = self.cd {
3599 if val.chars().count() < 1 {
3600 return Err(ValidationError::new(
3601 1001,
3602 "cd is shorter than the minimum length of 1".to_string(),
3603 ));
3604 }
3605 if val.chars().count() > 4 {
3606 return Err(ValidationError::new(
3607 1002,
3608 "cd exceeds the maximum length of 4".to_string(),
3609 ));
3610 }
3611 }
3612 if let Some(ref val) = self.prtry {
3613 if val.chars().count() < 1 {
3614 return Err(ValidationError::new(
3615 1001,
3616 "prtry is shorter than the minimum length of 1".to_string(),
3617 ));
3618 }
3619 if val.chars().count() > 35 {
3620 return Err(ValidationError::new(
3621 1002,
3622 "prtry exceeds the maximum length of 35".to_string(),
3623 ));
3624 }
3625 }
3626 Ok(())
3627 }
3628}
3629
3630#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3632pub struct OrganisationIdentificationSchemeName1Choice1 {
3633 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3634 pub cd: Option<String>,
3635 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3636 pub prtry: Option<String>,
3637}
3638
3639impl OrganisationIdentificationSchemeName1Choice1 {
3640 pub fn validate(&self) -> Result<(), ValidationError> {
3641 if let Some(ref val) = self.cd {
3642 if val.chars().count() < 1 {
3643 return Err(ValidationError::new(
3644 1001,
3645 "cd is shorter than the minimum length of 1".to_string(),
3646 ));
3647 }
3648 if val.chars().count() > 4 {
3649 return Err(ValidationError::new(
3650 1002,
3651 "cd exceeds the maximum length of 4".to_string(),
3652 ));
3653 }
3654 }
3655 if let Some(ref val) = self.prtry {
3656 if val.chars().count() < 1 {
3657 return Err(ValidationError::new(
3658 1001,
3659 "prtry is shorter than the minimum length of 1".to_string(),
3660 ));
3661 }
3662 if val.chars().count() > 35 {
3663 return Err(ValidationError::new(
3664 1002,
3665 "prtry exceeds the maximum length of 35".to_string(),
3666 ));
3667 }
3668 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3669 if !pattern.is_match(val) {
3670 return Err(ValidationError::new(
3671 1005,
3672 "prtry does not match the required pattern".to_string(),
3673 ));
3674 }
3675 }
3676 Ok(())
3677 }
3678}
3679
3680#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3682pub struct OrganisationIdentificationSchemeName1Choice2 {
3683 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3684 pub cd: Option<String>,
3685}
3686
3687impl OrganisationIdentificationSchemeName1Choice2 {
3688 pub fn validate(&self) -> Result<(), ValidationError> {
3689 if let Some(ref val) = self.cd {
3690 if val.chars().count() < 1 {
3691 return Err(ValidationError::new(
3692 1001,
3693 "cd is shorter than the minimum length of 1".to_string(),
3694 ));
3695 }
3696 if val.chars().count() > 4 {
3697 return Err(ValidationError::new(
3698 1002,
3699 "cd exceeds the maximum length of 4".to_string(),
3700 ));
3701 }
3702 }
3703 Ok(())
3704 }
3705}
3706
3707#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3709pub struct OrganisationIdentificationSchemeName1Choice3 {
3710 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3711 pub cd: Option<String>,
3712 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3713 pub prtry: Option<String>,
3714}
3715
3716impl OrganisationIdentificationSchemeName1Choice3 {
3717 pub fn validate(&self) -> Result<(), ValidationError> {
3718 if let Some(ref val) = self.cd {
3719 if val.chars().count() < 1 {
3720 return Err(ValidationError::new(
3721 1001,
3722 "cd is shorter than the minimum length of 1".to_string(),
3723 ));
3724 }
3725 if val.chars().count() > 4 {
3726 return Err(ValidationError::new(
3727 1002,
3728 "cd exceeds the maximum length of 4".to_string(),
3729 ));
3730 }
3731 }
3732 if let Some(ref val) = self.prtry {
3733 if val.chars().count() < 1 {
3734 return Err(ValidationError::new(
3735 1001,
3736 "prtry is shorter than the minimum length of 1".to_string(),
3737 ));
3738 }
3739 if val.chars().count() > 35 {
3740 return Err(ValidationError::new(
3741 1002,
3742 "prtry exceeds the maximum length of 35".to_string(),
3743 ));
3744 }
3745 let pattern = Regex::new(
3746 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
3747 )
3748 .unwrap();
3749 if !pattern.is_match(val) {
3750 return Err(ValidationError::new(
3751 1005,
3752 "prtry does not match the required pattern".to_string(),
3753 ));
3754 }
3755 }
3756 Ok(())
3757 }
3758}
3759
3760#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3762pub struct OriginalGroupInformation291 {
3763 #[serde(rename = "OrgnlMsgId")]
3764 pub orgnl_msg_id: String,
3765 #[serde(rename = "OrgnlMsgNmId")]
3766 pub orgnl_msg_nm_id: String,
3767 #[serde(rename = "OrgnlCreDtTm", skip_serializing_if = "Option::is_none")]
3768 pub orgnl_cre_dt_tm: Option<String>,
3769}
3770
3771impl OriginalGroupInformation291 {
3772 pub fn validate(&self) -> Result<(), ValidationError> {
3773 if self.orgnl_msg_id.chars().count() < 1 {
3774 return Err(ValidationError::new(
3775 1001,
3776 "orgnl_msg_id is shorter than the minimum length of 1".to_string(),
3777 ));
3778 }
3779 if self.orgnl_msg_id.chars().count() > 35 {
3780 return Err(ValidationError::new(
3781 1002,
3782 "orgnl_msg_id exceeds the maximum length of 35".to_string(),
3783 ));
3784 }
3785 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3786 if !pattern.is_match(&self.orgnl_msg_id) {
3787 return Err(ValidationError::new(
3788 1005,
3789 "orgnl_msg_id does not match the required pattern".to_string(),
3790 ));
3791 }
3792 if self.orgnl_msg_nm_id.chars().count() < 1 {
3793 return Err(ValidationError::new(
3794 1001,
3795 "orgnl_msg_nm_id is shorter than the minimum length of 1".to_string(),
3796 ));
3797 }
3798 if self.orgnl_msg_nm_id.chars().count() > 35 {
3799 return Err(ValidationError::new(
3800 1002,
3801 "orgnl_msg_nm_id exceeds the maximum length of 35".to_string(),
3802 ));
3803 }
3804 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
3805 if !pattern.is_match(&self.orgnl_msg_nm_id) {
3806 return Err(ValidationError::new(
3807 1005,
3808 "orgnl_msg_nm_id does not match the required pattern".to_string(),
3809 ));
3810 }
3811 if let Some(ref val) = self.orgnl_cre_dt_tm {
3812 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
3813 if !pattern.is_match(val) {
3814 return Err(ValidationError::new(
3815 1005,
3816 "orgnl_cre_dt_tm does not match the required pattern".to_string(),
3817 ));
3818 }
3819 }
3820 Ok(())
3821 }
3822}
3823
3824#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3829pub struct OriginalTransactionReference281 {
3830 #[serde(rename = "IntrBkSttlmAmt", skip_serializing_if = "Option::is_none")]
3831 pub intr_bk_sttlm_amt: Option<CBPRAmount1>,
3832 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
3833 pub amt: Option<AmountType4Choice1>,
3834 #[serde(rename = "IntrBkSttlmDt", skip_serializing_if = "Option::is_none")]
3835 pub intr_bk_sttlm_dt: Option<String>,
3836 #[serde(rename = "ReqdColltnDt", skip_serializing_if = "Option::is_none")]
3837 pub reqd_colltn_dt: Option<String>,
3838 #[serde(rename = "ReqdExctnDt", skip_serializing_if = "Option::is_none")]
3839 pub reqd_exctn_dt: Option<DateAndDateTime2Choice1>,
3840 #[serde(rename = "CdtrSchmeId", skip_serializing_if = "Option::is_none")]
3841 pub cdtr_schme_id: Option<PartyIdentification1354>,
3842 #[serde(rename = "SttlmInf", skip_serializing_if = "Option::is_none")]
3843 pub sttlm_inf: Option<SettlementInstruction72>,
3844 #[serde(rename = "PmtTpInf", skip_serializing_if = "Option::is_none")]
3845 pub pmt_tp_inf: Option<PaymentTypeInformation271>,
3846 #[serde(rename = "PmtMtd", skip_serializing_if = "Option::is_none")]
3847 pub pmt_mtd: Option<PaymentMethod4Code>,
3848 #[serde(rename = "MndtRltdInf", skip_serializing_if = "Option::is_none")]
3849 pub mndt_rltd_inf: Option<MandateRelatedInformation141>,
3850 #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
3851 pub rmt_inf: Option<RemittanceInformation161>,
3852 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
3853 pub ultmt_dbtr: Option<Party40Choice1>,
3854 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
3855 pub dbtr: Option<Party40Choice4>,
3856 #[serde(rename = "DbtrAcct", skip_serializing_if = "Option::is_none")]
3857 pub dbtr_acct: Option<CashAccount381>,
3858 #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
3859 pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification67>,
3860 #[serde(rename = "DbtrAgtAcct", skip_serializing_if = "Option::is_none")]
3861 pub dbtr_agt_acct: Option<CashAccount381>,
3862 #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
3863 pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification63>,
3864 #[serde(rename = "CdtrAgtAcct", skip_serializing_if = "Option::is_none")]
3865 pub cdtr_agt_acct: Option<CashAccount381>,
3866 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
3867 pub cdtr: Option<Party40Choice5>,
3868 #[serde(rename = "CdtrAcct", skip_serializing_if = "Option::is_none")]
3869 pub cdtr_acct: Option<CashAccount381>,
3870 #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
3871 pub ultmt_cdtr: Option<Party40Choice1>,
3872 #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
3873 pub purp: Option<Purpose2Choice1>,
3874}
3875
3876impl OriginalTransactionReference281 {
3877 pub fn validate(&self) -> Result<(), ValidationError> {
3878 if let Some(ref val) = self.intr_bk_sttlm_amt {
3879 val.validate()?
3880 }
3881 if let Some(ref val) = self.amt {
3882 val.validate()?
3883 }
3884 if let Some(ref val) = self.reqd_exctn_dt {
3885 val.validate()?
3886 }
3887 if let Some(ref val) = self.cdtr_schme_id {
3888 val.validate()?
3889 }
3890 if let Some(ref val) = self.sttlm_inf {
3891 val.validate()?
3892 }
3893 if let Some(ref val) = self.pmt_tp_inf {
3894 val.validate()?
3895 }
3896 if let Some(ref val) = self.pmt_mtd {
3897 val.validate()?
3898 }
3899 if let Some(ref val) = self.mndt_rltd_inf {
3900 val.validate()?
3901 }
3902 if let Some(ref val) = self.rmt_inf {
3903 val.validate()?
3904 }
3905 if let Some(ref val) = self.ultmt_dbtr {
3906 val.validate()?
3907 }
3908 if let Some(ref val) = self.dbtr {
3909 val.validate()?
3910 }
3911 if let Some(ref val) = self.dbtr_acct {
3912 val.validate()?
3913 }
3914 if let Some(ref val) = self.dbtr_agt {
3915 val.validate()?
3916 }
3917 if let Some(ref val) = self.dbtr_agt_acct {
3918 val.validate()?
3919 }
3920 if let Some(ref val) = self.cdtr_agt {
3921 val.validate()?
3922 }
3923 if let Some(ref val) = self.cdtr_agt_acct {
3924 val.validate()?
3925 }
3926 if let Some(ref val) = self.cdtr {
3927 val.validate()?
3928 }
3929 if let Some(ref val) = self.cdtr_acct {
3930 val.validate()?
3931 }
3932 if let Some(ref val) = self.ultmt_cdtr {
3933 val.validate()?
3934 }
3935 if let Some(ref val) = self.purp {
3936 val.validate()?
3937 }
3938 Ok(())
3939 }
3940}
3941
3942#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3944pub struct Party38Choice {
3945 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
3946 pub org_id: Option<OrganisationIdentification29>,
3947 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
3948 pub prvt_id: Option<PersonIdentification13>,
3949}
3950
3951impl Party38Choice {
3952 pub fn validate(&self) -> Result<(), ValidationError> {
3953 if let Some(ref val) = self.org_id {
3954 val.validate()?
3955 }
3956 if let Some(ref val) = self.prvt_id {
3957 val.validate()?
3958 }
3959 Ok(())
3960 }
3961}
3962
3963#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3965pub struct Party38Choice1 {
3966 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
3967 pub org_id: Option<OrganisationIdentification291>,
3968 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
3969 pub prvt_id: Option<PersonIdentification131>,
3970}
3971
3972impl Party38Choice1 {
3973 pub fn validate(&self) -> Result<(), ValidationError> {
3974 if let Some(ref val) = self.org_id {
3975 val.validate()?
3976 }
3977 if let Some(ref val) = self.prvt_id {
3978 val.validate()?
3979 }
3980 Ok(())
3981 }
3982}
3983
3984#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3986pub struct Party38Choice2 {
3987 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
3988 pub org_id: Option<OrganisationIdentification292>,
3989 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
3990 pub prvt_id: Option<PersonIdentification132>,
3991}
3992
3993impl Party38Choice2 {
3994 pub fn validate(&self) -> Result<(), ValidationError> {
3995 if let Some(ref val) = self.org_id {
3996 val.validate()?
3997 }
3998 if let Some(ref val) = self.prvt_id {
3999 val.validate()?
4000 }
4001 Ok(())
4002 }
4003}
4004
4005#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4007pub struct Party38Choice3 {
4008 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
4009 pub org_id: Option<OrganisationIdentification293>,
4010 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
4011 pub prvt_id: Option<PersonIdentification133>,
4012}
4013
4014impl Party38Choice3 {
4015 pub fn validate(&self) -> Result<(), ValidationError> {
4016 if let Some(ref val) = self.org_id {
4017 val.validate()?
4018 }
4019 if let Some(ref val) = self.prvt_id {
4020 val.validate()?
4021 }
4022 Ok(())
4023 }
4024}
4025
4026#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4028pub struct Party40Choice1 {
4029 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
4030 pub pty: Option<PartyIdentification1351>,
4031}
4032
4033impl Party40Choice1 {
4034 pub fn validate(&self) -> Result<(), ValidationError> {
4035 if let Some(ref val) = self.pty {
4036 val.validate()?
4037 }
4038 Ok(())
4039 }
4040}
4041
4042#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4044pub struct Party40Choice2 {
4045 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
4046 pub pty: Option<PartyIdentification1352>,
4047 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
4048 pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
4049}
4050
4051impl Party40Choice2 {
4052 pub fn validate(&self) -> Result<(), ValidationError> {
4053 if let Some(ref val) = self.pty {
4054 val.validate()?
4055 }
4056 if let Some(ref val) = self.agt {
4057 val.validate()?
4058 }
4059 Ok(())
4060 }
4061}
4062
4063#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4065pub struct Party40Choice3 {
4066 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
4067 pub pty: Option<PartyIdentification1353>,
4068 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
4069 pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
4070}
4071
4072impl Party40Choice3 {
4073 pub fn validate(&self) -> Result<(), ValidationError> {
4074 if let Some(ref val) = self.pty {
4075 val.validate()?
4076 }
4077 if let Some(ref val) = self.agt {
4078 val.validate()?
4079 }
4080 Ok(())
4081 }
4082}
4083
4084#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4086pub struct Party40Choice4 {
4087 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
4088 pub pty: Option<PartyIdentification1352>,
4089 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
4090 pub agt: Option<BranchAndFinancialInstitutionIdentification66>,
4091}
4092
4093impl Party40Choice4 {
4094 pub fn validate(&self) -> Result<(), ValidationError> {
4095 if let Some(ref val) = self.pty {
4096 val.validate()?
4097 }
4098 if let Some(ref val) = self.agt {
4099 val.validate()?
4100 }
4101 Ok(())
4102 }
4103}
4104
4105#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4107pub struct Party40Choice5 {
4108 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
4109 pub pty: Option<PartyIdentification1353>,
4110 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
4111 pub agt: Option<BranchAndFinancialInstitutionIdentification68>,
4112}
4113
4114impl Party40Choice5 {
4115 pub fn validate(&self) -> Result<(), ValidationError> {
4116 if let Some(ref val) = self.pty {
4117 val.validate()?
4118 }
4119 if let Some(ref val) = self.agt {
4120 val.validate()?
4121 }
4122 Ok(())
4123 }
4124}
4125
4126#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4128pub struct PartyIdentification1351 {
4129 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4130 pub nm: Option<String>,
4131 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4132 pub pstl_adr: Option<PostalAddress242>,
4133 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
4134 pub id: Option<Party38Choice1>,
4135 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
4136 pub ctry_of_res: Option<String>,
4137}
4138
4139impl PartyIdentification1351 {
4140 pub fn validate(&self) -> Result<(), ValidationError> {
4141 if let Some(ref val) = self.nm {
4142 if val.chars().count() < 1 {
4143 return Err(ValidationError::new(
4144 1001,
4145 "nm is shorter than the minimum length of 1".to_string(),
4146 ));
4147 }
4148 if val.chars().count() > 140 {
4149 return Err(ValidationError::new(
4150 1002,
4151 "nm exceeds the maximum length of 140".to_string(),
4152 ));
4153 }
4154 let pattern = Regex::new(
4155 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4156 )
4157 .unwrap();
4158 if !pattern.is_match(val) {
4159 return Err(ValidationError::new(
4160 1005,
4161 "nm does not match the required pattern".to_string(),
4162 ));
4163 }
4164 }
4165 if let Some(ref val) = self.pstl_adr {
4166 val.validate()?
4167 }
4168 if let Some(ref val) = self.id {
4169 val.validate()?
4170 }
4171 if let Some(ref val) = self.ctry_of_res {
4172 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4173 if !pattern.is_match(val) {
4174 return Err(ValidationError::new(
4175 1005,
4176 "ctry_of_res does not match the required pattern".to_string(),
4177 ));
4178 }
4179 }
4180 Ok(())
4181 }
4182}
4183
4184#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4186pub struct PartyIdentification1352 {
4187 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4188 pub nm: Option<String>,
4189 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4190 pub pstl_adr: Option<PostalAddress241>,
4191 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
4192 pub id: Option<Party38Choice2>,
4193 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
4194 pub ctry_of_res: Option<String>,
4195}
4196
4197impl PartyIdentification1352 {
4198 pub fn validate(&self) -> Result<(), ValidationError> {
4199 if let Some(ref val) = self.nm {
4200 if val.chars().count() < 1 {
4201 return Err(ValidationError::new(
4202 1001,
4203 "nm is shorter than the minimum length of 1".to_string(),
4204 ));
4205 }
4206 if val.chars().count() > 140 {
4207 return Err(ValidationError::new(
4208 1002,
4209 "nm exceeds the maximum length of 140".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 "nm does not match the required pattern".to_string(),
4220 ));
4221 }
4222 }
4223 if let Some(ref val) = self.pstl_adr {
4224 val.validate()?
4225 }
4226 if let Some(ref val) = self.id {
4227 val.validate()?
4228 }
4229 if let Some(ref val) = self.ctry_of_res {
4230 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4231 if !pattern.is_match(val) {
4232 return Err(ValidationError::new(
4233 1005,
4234 "ctry_of_res does not match the required pattern".to_string(),
4235 ));
4236 }
4237 }
4238 Ok(())
4239 }
4240}
4241
4242#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4244pub struct PartyIdentification1353 {
4245 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4246 pub nm: Option<String>,
4247 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4248 pub pstl_adr: Option<PostalAddress241>,
4249 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
4250 pub id: Option<Party38Choice1>,
4251 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
4252 pub ctry_of_res: Option<String>,
4253}
4254
4255impl PartyIdentification1353 {
4256 pub fn validate(&self) -> Result<(), ValidationError> {
4257 if let Some(ref val) = self.nm {
4258 if val.chars().count() < 1 {
4259 return Err(ValidationError::new(
4260 1001,
4261 "nm is shorter than the minimum length of 1".to_string(),
4262 ));
4263 }
4264 if val.chars().count() > 140 {
4265 return Err(ValidationError::new(
4266 1002,
4267 "nm exceeds the maximum length of 140".to_string(),
4268 ));
4269 }
4270 let pattern = Regex::new(
4271 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4272 )
4273 .unwrap();
4274 if !pattern.is_match(val) {
4275 return Err(ValidationError::new(
4276 1005,
4277 "nm does not match the required pattern".to_string(),
4278 ));
4279 }
4280 }
4281 if let Some(ref val) = self.pstl_adr {
4282 val.validate()?
4283 }
4284 if let Some(ref val) = self.id {
4285 val.validate()?
4286 }
4287 if let Some(ref val) = self.ctry_of_res {
4288 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4289 if !pattern.is_match(val) {
4290 return Err(ValidationError::new(
4291 1005,
4292 "ctry_of_res does not match the required pattern".to_string(),
4293 ));
4294 }
4295 }
4296 Ok(())
4297 }
4298}
4299
4300#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4302pub struct PartyIdentification1354 {
4303 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4304 pub nm: Option<String>,
4305 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4306 pub pstl_adr: Option<PostalAddress243>,
4307 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
4308 pub id: Option<Party38Choice>,
4309 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
4310 pub ctry_of_res: Option<String>,
4311}
4312
4313impl PartyIdentification1354 {
4314 pub fn validate(&self) -> Result<(), ValidationError> {
4315 if let Some(ref val) = self.nm {
4316 if val.chars().count() < 1 {
4317 return Err(ValidationError::new(
4318 1001,
4319 "nm is shorter than the minimum length of 1".to_string(),
4320 ));
4321 }
4322 if val.chars().count() > 140 {
4323 return Err(ValidationError::new(
4324 1002,
4325 "nm exceeds the maximum length of 140".to_string(),
4326 ));
4327 }
4328 }
4329 if let Some(ref val) = self.pstl_adr {
4330 val.validate()?
4331 }
4332 if let Some(ref val) = self.id {
4333 val.validate()?
4334 }
4335 if let Some(ref val) = self.ctry_of_res {
4336 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4337 if !pattern.is_match(val) {
4338 return Err(ValidationError::new(
4339 1005,
4340 "ctry_of_res does not match the required pattern".to_string(),
4341 ));
4342 }
4343 }
4344 Ok(())
4345 }
4346}
4347
4348#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4350pub struct PartyIdentification1355 {
4351 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4352 pub nm: Option<String>,
4353 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
4354 pub pstl_adr: Option<PostalAddress242>,
4355 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
4356 pub id: Option<Party38Choice3>,
4357 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
4358 pub ctry_of_res: Option<String>,
4359}
4360
4361impl PartyIdentification1355 {
4362 pub fn validate(&self) -> Result<(), ValidationError> {
4363 if let Some(ref val) = self.nm {
4364 if val.chars().count() < 1 {
4365 return Err(ValidationError::new(
4366 1001,
4367 "nm is shorter than the minimum length of 1".to_string(),
4368 ));
4369 }
4370 if val.chars().count() > 140 {
4371 return Err(ValidationError::new(
4372 1002,
4373 "nm exceeds the maximum length of 140".to_string(),
4374 ));
4375 }
4376 let pattern = Regex::new(
4377 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
4378 )
4379 .unwrap();
4380 if !pattern.is_match(val) {
4381 return Err(ValidationError::new(
4382 1005,
4383 "nm does not match the required pattern".to_string(),
4384 ));
4385 }
4386 }
4387 if let Some(ref val) = self.pstl_adr {
4388 val.validate()?
4389 }
4390 if let Some(ref val) = self.id {
4391 val.validate()?
4392 }
4393 if let Some(ref val) = self.ctry_of_res {
4394 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4395 if !pattern.is_match(val) {
4396 return Err(ValidationError::new(
4397 1005,
4398 "ctry_of_res does not match the required pattern".to_string(),
4399 ));
4400 }
4401 }
4402 Ok(())
4403 }
4404}
4405
4406#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4408pub enum PaymentMethod4Code {
4409 #[default]
4410 #[serde(rename = "CHK")]
4411 CodeCHK,
4412 #[serde(rename = "TRF")]
4413 CodeTRF,
4414 #[serde(rename = "DD")]
4415 CodeDD,
4416 #[serde(rename = "TRA")]
4417 CodeTRA,
4418}
4419
4420impl PaymentMethod4Code {
4421 pub fn validate(&self) -> Result<(), ValidationError> {
4422 Ok(())
4423 }
4424}
4425
4426#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4428pub struct PaymentReturnReason61 {
4429 #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
4430 pub orgtr: Option<PartyIdentification1353>,
4431 #[serde(rename = "Rsn")]
4432 pub rsn: ReturnReason5Choice1,
4433 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
4434 pub addtl_inf: Option<Vec<String>>,
4435}
4436
4437impl PaymentReturnReason61 {
4438 pub fn validate(&self) -> Result<(), ValidationError> {
4439 if let Some(ref val) = self.orgtr {
4440 val.validate()?
4441 }
4442 self.rsn.validate()?;
4443 if let Some(ref vec) = self.addtl_inf {
4444 for item in vec {
4445 if item.chars().count() < 1 {
4446 return Err(ValidationError::new(
4447 1001,
4448 "addtl_inf is shorter than the minimum length of 1".to_string(),
4449 ));
4450 }
4451 if item.chars().count() > 105 {
4452 return Err(ValidationError::new(
4453 1002,
4454 "addtl_inf exceeds the maximum length of 105".to_string(),
4455 ));
4456 }
4457 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4458 if !pattern.is_match(&item) {
4459 return Err(ValidationError::new(
4460 1005,
4461 "addtl_inf does not match the required pattern".to_string(),
4462 ));
4463 }
4464 }
4465 }
4466 Ok(())
4467 }
4468}
4469
4470#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4472pub struct PaymentReturnV09 {
4473 #[serde(rename = "GrpHdr")]
4474 pub grp_hdr: GroupHeader901,
4475 #[serde(rename = "TxInf")]
4476 pub tx_inf: PaymentTransaction1121,
4477}
4478
4479impl PaymentReturnV09 {
4480 pub fn validate(&self) -> Result<(), ValidationError> {
4481 self.grp_hdr.validate()?;
4482 self.tx_inf.validate()?;
4483 Ok(())
4484 }
4485}
4486
4487#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4489pub struct PaymentTransaction1121 {
4490 #[serde(rename = "RtrId", skip_serializing_if = "Option::is_none")]
4491 pub rtr_id: Option<String>,
4492 #[serde(rename = "OrgnlGrpInf", skip_serializing_if = "Option::is_none")]
4493 pub orgnl_grp_inf: Option<OriginalGroupInformation291>,
4494 #[serde(rename = "OrgnlInstrId", skip_serializing_if = "Option::is_none")]
4495 pub orgnl_instr_id: Option<String>,
4496 #[serde(rename = "OrgnlEndToEndId")]
4497 pub orgnl_end_to_end_id: String,
4498 #[serde(rename = "OrgnlTxId", skip_serializing_if = "Option::is_none")]
4499 pub orgnl_tx_id: Option<String>,
4500 #[serde(rename = "OrgnlUETR")]
4501 pub orgnl_uetr: String,
4502 #[serde(rename = "OrgnlClrSysRef", skip_serializing_if = "Option::is_none")]
4503 pub orgnl_clr_sys_ref: Option<String>,
4504 #[serde(
4505 rename = "OrgnlIntrBkSttlmAmt",
4506 skip_serializing_if = "Option::is_none"
4507 )]
4508 pub orgnl_intr_bk_sttlm_amt: Option<CBPRAmount1>,
4509 #[serde(rename = "OrgnlIntrBkSttlmDt", skip_serializing_if = "Option::is_none")]
4510 pub orgnl_intr_bk_sttlm_dt: Option<String>,
4511 #[serde(rename = "RtrdIntrBkSttlmAmt")]
4512 pub rtrd_intr_bk_sttlm_amt: CBPRAmount1,
4513 #[serde(rename = "IntrBkSttlmDt")]
4514 pub intr_bk_sttlm_dt: String,
4515 #[serde(rename = "SttlmPrty", skip_serializing_if = "Option::is_none")]
4516 pub sttlm_prty: Option<Priority3Code>,
4517 #[serde(rename = "SttlmTmIndctn", skip_serializing_if = "Option::is_none")]
4518 pub sttlm_tm_indctn: Option<SettlementDateTimeIndication11>,
4519 #[serde(rename = "RtrdInstdAmt", skip_serializing_if = "Option::is_none")]
4520 pub rtrd_instd_amt: Option<CBPRAmount1>,
4521 #[serde(rename = "XchgRate", skip_serializing_if = "Option::is_none")]
4522 pub xchg_rate: Option<f64>,
4523 #[serde(rename = "ChrgBr")]
4524 pub chrg_br: ChargeBearerType1Code1,
4525 #[serde(rename = "ChrgsInf", skip_serializing_if = "Option::is_none")]
4526 pub chrgs_inf: Option<Vec<Charges71>>,
4527 #[serde(rename = "ClrSysRef", skip_serializing_if = "Option::is_none")]
4528 pub clr_sys_ref: Option<String>,
4529 #[serde(rename = "InstgAgt")]
4530 pub instg_agt: BranchAndFinancialInstitutionIdentification62,
4531 #[serde(rename = "InstdAgt")]
4532 pub instd_agt: BranchAndFinancialInstitutionIdentification62,
4533 #[serde(rename = "RtrChain")]
4534 pub rtr_chain: TransactionParties71,
4535 #[serde(rename = "RtrRsnInf")]
4536 pub rtr_rsn_inf: PaymentReturnReason61,
4537 #[serde(rename = "OrgnlTxRef", skip_serializing_if = "Option::is_none")]
4538 pub orgnl_tx_ref: Option<OriginalTransactionReference281>,
4539}
4540
4541impl PaymentTransaction1121 {
4542 pub fn validate(&self) -> Result<(), ValidationError> {
4543 if let Some(ref val) = self.rtr_id {
4544 if val.chars().count() < 1 {
4545 return Err(ValidationError::new(
4546 1001,
4547 "rtr_id is shorter than the minimum length of 1".to_string(),
4548 ));
4549 }
4550 if val.chars().count() > 35 {
4551 return Err(ValidationError::new(
4552 1002,
4553 "rtr_id exceeds the maximum length of 35".to_string(),
4554 ));
4555 }
4556 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4557 if !pattern.is_match(val) {
4558 return Err(ValidationError::new(
4559 1005,
4560 "rtr_id does not match the required pattern".to_string(),
4561 ));
4562 }
4563 }
4564 if let Some(ref val) = self.orgnl_grp_inf {
4565 val.validate()?
4566 }
4567 if let Some(ref val) = self.orgnl_instr_id {
4568 if val.chars().count() < 1 {
4569 return Err(ValidationError::new(
4570 1001,
4571 "orgnl_instr_id is shorter than the minimum length of 1".to_string(),
4572 ));
4573 }
4574 if val.chars().count() > 35 {
4575 return Err(ValidationError::new(
4576 1002,
4577 "orgnl_instr_id exceeds the maximum length of 35".to_string(),
4578 ));
4579 }
4580 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4581 if !pattern.is_match(val) {
4582 return Err(ValidationError::new(
4583 1005,
4584 "orgnl_instr_id does not match the required pattern".to_string(),
4585 ));
4586 }
4587 }
4588 if self.orgnl_end_to_end_id.chars().count() < 1 {
4589 return Err(ValidationError::new(
4590 1001,
4591 "orgnl_end_to_end_id is shorter than the minimum length of 1".to_string(),
4592 ));
4593 }
4594 if self.orgnl_end_to_end_id.chars().count() > 35 {
4595 return Err(ValidationError::new(
4596 1002,
4597 "orgnl_end_to_end_id exceeds the maximum length of 35".to_string(),
4598 ));
4599 }
4600 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4601 if !pattern.is_match(&self.orgnl_end_to_end_id) {
4602 return Err(ValidationError::new(
4603 1005,
4604 "orgnl_end_to_end_id does not match the required pattern".to_string(),
4605 ));
4606 }
4607 if let Some(ref val) = self.orgnl_tx_id {
4608 if val.chars().count() < 1 {
4609 return Err(ValidationError::new(
4610 1001,
4611 "orgnl_tx_id is shorter than the minimum length of 1".to_string(),
4612 ));
4613 }
4614 if val.chars().count() > 35 {
4615 return Err(ValidationError::new(
4616 1002,
4617 "orgnl_tx_id exceeds the maximum length of 35".to_string(),
4618 ));
4619 }
4620 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4621 if !pattern.is_match(val) {
4622 return Err(ValidationError::new(
4623 1005,
4624 "orgnl_tx_id does not match the required pattern".to_string(),
4625 ));
4626 }
4627 }
4628 let pattern =
4629 Regex::new("[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}")
4630 .unwrap();
4631 if !pattern.is_match(&self.orgnl_uetr) {
4632 return Err(ValidationError::new(
4633 1005,
4634 "orgnl_uetr does not match the required pattern".to_string(),
4635 ));
4636 }
4637 if let Some(ref val) = self.orgnl_clr_sys_ref {
4638 if val.chars().count() < 1 {
4639 return Err(ValidationError::new(
4640 1001,
4641 "orgnl_clr_sys_ref is shorter than the minimum length of 1".to_string(),
4642 ));
4643 }
4644 if val.chars().count() > 35 {
4645 return Err(ValidationError::new(
4646 1002,
4647 "orgnl_clr_sys_ref exceeds the maximum length of 35".to_string(),
4648 ));
4649 }
4650 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4651 if !pattern.is_match(val) {
4652 return Err(ValidationError::new(
4653 1005,
4654 "orgnl_clr_sys_ref does not match the required pattern".to_string(),
4655 ));
4656 }
4657 }
4658 if let Some(ref val) = self.orgnl_intr_bk_sttlm_amt {
4659 val.validate()?
4660 }
4661 self.rtrd_intr_bk_sttlm_amt.validate()?;
4662 if let Some(ref val) = self.sttlm_prty {
4663 val.validate()?
4664 }
4665 if let Some(ref val) = self.sttlm_tm_indctn {
4666 val.validate()?
4667 }
4668 if let Some(ref val) = self.rtrd_instd_amt {
4669 val.validate()?
4670 }
4671 self.chrg_br.validate()?;
4672 if let Some(ref vec) = self.chrgs_inf {
4673 for item in vec {
4674 item.validate()?
4675 }
4676 }
4677 if let Some(ref val) = self.clr_sys_ref {
4678 if val.chars().count() < 1 {
4679 return Err(ValidationError::new(
4680 1001,
4681 "clr_sys_ref is shorter than the minimum length of 1".to_string(),
4682 ));
4683 }
4684 if val.chars().count() > 35 {
4685 return Err(ValidationError::new(
4686 1002,
4687 "clr_sys_ref exceeds the maximum length of 35".to_string(),
4688 ));
4689 }
4690 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4691 if !pattern.is_match(val) {
4692 return Err(ValidationError::new(
4693 1005,
4694 "clr_sys_ref does not match the required pattern".to_string(),
4695 ));
4696 }
4697 }
4698 self.instg_agt.validate()?;
4699 self.instd_agt.validate()?;
4700 self.rtr_chain.validate()?;
4701 self.rtr_rsn_inf.validate()?;
4702 if let Some(ref val) = self.orgnl_tx_ref {
4703 val.validate()?
4704 }
4705 Ok(())
4706 }
4707}
4708
4709#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4712pub struct PaymentTypeInformation271 {
4713 #[serde(rename = "InstrPrty", skip_serializing_if = "Option::is_none")]
4714 pub instr_prty: Option<Priority2Code>,
4715 #[serde(rename = "ClrChanl", skip_serializing_if = "Option::is_none")]
4716 pub clr_chanl: Option<ClearingChannel2Code>,
4717 #[serde(rename = "SvcLvl", skip_serializing_if = "Option::is_none")]
4718 pub svc_lvl: Option<Vec<ServiceLevel8Choice1>>,
4719 #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
4720 pub lcl_instrm: Option<LocalInstrument2Choice1>,
4721 #[serde(rename = "SeqTp", skip_serializing_if = "Option::is_none")]
4722 pub seq_tp: Option<SequenceType3Code>,
4723 #[serde(rename = "CtgyPurp", skip_serializing_if = "Option::is_none")]
4724 pub ctgy_purp: Option<CategoryPurpose1Choice1>,
4725}
4726
4727impl PaymentTypeInformation271 {
4728 pub fn validate(&self) -> Result<(), ValidationError> {
4729 if let Some(ref val) = self.instr_prty {
4730 val.validate()?
4731 }
4732 if let Some(ref val) = self.clr_chanl {
4733 val.validate()?
4734 }
4735 if let Some(ref vec) = self.svc_lvl {
4736 for item in vec {
4737 item.validate()?
4738 }
4739 }
4740 if let Some(ref val) = self.lcl_instrm {
4741 val.validate()?
4742 }
4743 if let Some(ref val) = self.seq_tp {
4744 val.validate()?
4745 }
4746 if let Some(ref val) = self.ctgy_purp {
4747 val.validate()?
4748 }
4749 Ok(())
4750 }
4751}
4752
4753#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4755pub struct PersonIdentification13 {
4756 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
4757 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
4758 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4759 pub othr: Option<Vec<GenericPersonIdentification1>>,
4760}
4761
4762impl PersonIdentification13 {
4763 pub fn validate(&self) -> Result<(), ValidationError> {
4764 if let Some(ref val) = self.dt_and_plc_of_birth {
4765 val.validate()?
4766 }
4767 if let Some(ref vec) = self.othr {
4768 for item in vec {
4769 item.validate()?
4770 }
4771 }
4772 Ok(())
4773 }
4774}
4775
4776#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4778pub struct PersonIdentification131 {
4779 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
4780 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
4781 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4782 pub othr: Option<Vec<GenericPersonIdentification11>>,
4783}
4784
4785impl PersonIdentification131 {
4786 pub fn validate(&self) -> Result<(), ValidationError> {
4787 if let Some(ref val) = self.dt_and_plc_of_birth {
4788 val.validate()?
4789 }
4790 if let Some(ref vec) = self.othr {
4791 for item in vec {
4792 item.validate()?
4793 }
4794 }
4795 Ok(())
4796 }
4797}
4798
4799#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4801pub struct PersonIdentification132 {
4802 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
4803 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
4804 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4805 pub othr: Option<Vec<GenericPersonIdentification12>>,
4806}
4807
4808impl PersonIdentification132 {
4809 pub fn validate(&self) -> Result<(), ValidationError> {
4810 if let Some(ref val) = self.dt_and_plc_of_birth {
4811 val.validate()?
4812 }
4813 if let Some(ref vec) = self.othr {
4814 for item in vec {
4815 item.validate()?
4816 }
4817 }
4818 Ok(())
4819 }
4820}
4821
4822#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4824pub struct PersonIdentification133 {
4825 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
4826 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
4827 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
4828 pub othr: Option<Vec<GenericPersonIdentification13>>,
4829}
4830
4831impl PersonIdentification133 {
4832 pub fn validate(&self) -> Result<(), ValidationError> {
4833 if let Some(ref val) = self.dt_and_plc_of_birth {
4834 val.validate()?
4835 }
4836 if let Some(ref vec) = self.othr {
4837 for item in vec {
4838 item.validate()?
4839 }
4840 }
4841 Ok(())
4842 }
4843}
4844
4845#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4847pub struct PersonIdentificationSchemeName1Choice {
4848 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4849 pub cd: Option<String>,
4850 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4851 pub prtry: Option<String>,
4852}
4853
4854impl PersonIdentificationSchemeName1Choice {
4855 pub fn validate(&self) -> Result<(), ValidationError> {
4856 if let Some(ref val) = self.cd {
4857 if val.chars().count() < 1 {
4858 return Err(ValidationError::new(
4859 1001,
4860 "cd is shorter than the minimum length of 1".to_string(),
4861 ));
4862 }
4863 if val.chars().count() > 4 {
4864 return Err(ValidationError::new(
4865 1002,
4866 "cd exceeds the maximum length of 4".to_string(),
4867 ));
4868 }
4869 }
4870 if let Some(ref val) = self.prtry {
4871 if val.chars().count() < 1 {
4872 return Err(ValidationError::new(
4873 1001,
4874 "prtry is shorter than the minimum length of 1".to_string(),
4875 ));
4876 }
4877 if val.chars().count() > 35 {
4878 return Err(ValidationError::new(
4879 1002,
4880 "prtry exceeds the maximum length of 35".to_string(),
4881 ));
4882 }
4883 }
4884 Ok(())
4885 }
4886}
4887
4888#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4890pub struct PersonIdentificationSchemeName1Choice1 {
4891 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4892 pub cd: Option<String>,
4893 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4894 pub prtry: Option<String>,
4895}
4896
4897impl PersonIdentificationSchemeName1Choice1 {
4898 pub fn validate(&self) -> Result<(), ValidationError> {
4899 if let Some(ref val) = self.cd {
4900 if val.chars().count() < 1 {
4901 return Err(ValidationError::new(
4902 1001,
4903 "cd is shorter than the minimum length of 1".to_string(),
4904 ));
4905 }
4906 if val.chars().count() > 4 {
4907 return Err(ValidationError::new(
4908 1002,
4909 "cd exceeds the maximum length of 4".to_string(),
4910 ));
4911 }
4912 }
4913 if let Some(ref val) = self.prtry {
4914 if val.chars().count() < 1 {
4915 return Err(ValidationError::new(
4916 1001,
4917 "prtry is shorter than the minimum length of 1".to_string(),
4918 ));
4919 }
4920 if val.chars().count() > 35 {
4921 return Err(ValidationError::new(
4922 1002,
4923 "prtry exceeds the maximum length of 35".to_string(),
4924 ));
4925 }
4926 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
4927 if !pattern.is_match(val) {
4928 return Err(ValidationError::new(
4929 1005,
4930 "prtry does not match the required pattern".to_string(),
4931 ));
4932 }
4933 }
4934 Ok(())
4935 }
4936}
4937
4938#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4940pub struct PersonIdentificationSchemeName1Choice2 {
4941 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4942 pub cd: Option<String>,
4943}
4944
4945impl PersonIdentificationSchemeName1Choice2 {
4946 pub fn validate(&self) -> Result<(), ValidationError> {
4947 if let Some(ref val) = self.cd {
4948 if val.chars().count() < 1 {
4949 return Err(ValidationError::new(
4950 1001,
4951 "cd is shorter than the minimum length of 1".to_string(),
4952 ));
4953 }
4954 if val.chars().count() > 4 {
4955 return Err(ValidationError::new(
4956 1002,
4957 "cd exceeds the maximum length of 4".to_string(),
4958 ));
4959 }
4960 }
4961 Ok(())
4962 }
4963}
4964
4965#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4967pub struct PersonIdentificationSchemeName1Choice3 {
4968 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4969 pub cd: Option<String>,
4970 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4971 pub prtry: Option<String>,
4972}
4973
4974impl PersonIdentificationSchemeName1Choice3 {
4975 pub fn validate(&self) -> Result<(), ValidationError> {
4976 if let Some(ref val) = self.cd {
4977 if val.chars().count() < 1 {
4978 return Err(ValidationError::new(
4979 1001,
4980 "cd is shorter than the minimum length of 1".to_string(),
4981 ));
4982 }
4983 if val.chars().count() > 4 {
4984 return Err(ValidationError::new(
4985 1002,
4986 "cd exceeds the maximum length of 4".to_string(),
4987 ));
4988 }
4989 }
4990 if let Some(ref val) = self.prtry {
4991 if val.chars().count() < 1 {
4992 return Err(ValidationError::new(
4993 1001,
4994 "prtry is shorter than the minimum length of 1".to_string(),
4995 ));
4996 }
4997 if val.chars().count() > 35 {
4998 return Err(ValidationError::new(
4999 1002,
5000 "prtry exceeds the maximum length of 35".to_string(),
5001 ));
5002 }
5003 let pattern = Regex::new(
5004 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5005 )
5006 .unwrap();
5007 if !pattern.is_match(val) {
5008 return Err(ValidationError::new(
5009 1005,
5010 "prtry does not match the required pattern".to_string(),
5011 ));
5012 }
5013 }
5014 Ok(())
5015 }
5016}
5017
5018#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5020pub struct PostalAddress241 {
5021 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
5022 pub dept: Option<String>,
5023 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
5024 pub sub_dept: Option<String>,
5025 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
5026 pub strt_nm: Option<String>,
5027 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
5028 pub bldg_nb: Option<String>,
5029 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
5030 pub bldg_nm: Option<String>,
5031 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
5032 pub flr: Option<String>,
5033 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
5034 pub pst_bx: Option<String>,
5035 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
5036 pub room: Option<String>,
5037 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
5038 pub pst_cd: Option<String>,
5039 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
5040 pub twn_nm: Option<String>,
5041 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
5042 pub twn_lctn_nm: Option<String>,
5043 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
5044 pub dstrct_nm: Option<String>,
5045 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
5046 pub ctry_sub_dvsn: Option<String>,
5047 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
5048 pub ctry: Option<String>,
5049 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
5050 pub adr_line: Option<Vec<String>>,
5051}
5052
5053impl PostalAddress241 {
5054 pub fn validate(&self) -> Result<(), ValidationError> {
5055 if let Some(ref val) = self.dept {
5056 if val.chars().count() < 1 {
5057 return Err(ValidationError::new(
5058 1001,
5059 "dept is shorter than the minimum length of 1".to_string(),
5060 ));
5061 }
5062 if val.chars().count() > 70 {
5063 return Err(ValidationError::new(
5064 1002,
5065 "dept exceeds the maximum length of 70".to_string(),
5066 ));
5067 }
5068 let pattern = Regex::new(
5069 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5070 )
5071 .unwrap();
5072 if !pattern.is_match(val) {
5073 return Err(ValidationError::new(
5074 1005,
5075 "dept does not match the required pattern".to_string(),
5076 ));
5077 }
5078 }
5079 if let Some(ref val) = self.sub_dept {
5080 if val.chars().count() < 1 {
5081 return Err(ValidationError::new(
5082 1001,
5083 "sub_dept is shorter than the minimum length of 1".to_string(),
5084 ));
5085 }
5086 if val.chars().count() > 70 {
5087 return Err(ValidationError::new(
5088 1002,
5089 "sub_dept exceeds the maximum length of 70".to_string(),
5090 ));
5091 }
5092 let pattern = Regex::new(
5093 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5094 )
5095 .unwrap();
5096 if !pattern.is_match(val) {
5097 return Err(ValidationError::new(
5098 1005,
5099 "sub_dept does not match the required pattern".to_string(),
5100 ));
5101 }
5102 }
5103 if let Some(ref val) = self.strt_nm {
5104 if val.chars().count() < 1 {
5105 return Err(ValidationError::new(
5106 1001,
5107 "strt_nm is shorter than the minimum length of 1".to_string(),
5108 ));
5109 }
5110 if val.chars().count() > 70 {
5111 return Err(ValidationError::new(
5112 1002,
5113 "strt_nm exceeds the maximum length of 70".to_string(),
5114 ));
5115 }
5116 let pattern = Regex::new(
5117 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5118 )
5119 .unwrap();
5120 if !pattern.is_match(val) {
5121 return Err(ValidationError::new(
5122 1005,
5123 "strt_nm does not match the required pattern".to_string(),
5124 ));
5125 }
5126 }
5127 if let Some(ref val) = self.bldg_nb {
5128 if val.chars().count() < 1 {
5129 return Err(ValidationError::new(
5130 1001,
5131 "bldg_nb is shorter than the minimum length of 1".to_string(),
5132 ));
5133 }
5134 if val.chars().count() > 16 {
5135 return Err(ValidationError::new(
5136 1002,
5137 "bldg_nb exceeds the maximum length of 16".to_string(),
5138 ));
5139 }
5140 let pattern = Regex::new(
5141 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5142 )
5143 .unwrap();
5144 if !pattern.is_match(val) {
5145 return Err(ValidationError::new(
5146 1005,
5147 "bldg_nb does not match the required pattern".to_string(),
5148 ));
5149 }
5150 }
5151 if let Some(ref val) = self.bldg_nm {
5152 if val.chars().count() < 1 {
5153 return Err(ValidationError::new(
5154 1001,
5155 "bldg_nm is shorter than the minimum length of 1".to_string(),
5156 ));
5157 }
5158 if val.chars().count() > 35 {
5159 return Err(ValidationError::new(
5160 1002,
5161 "bldg_nm exceeds the maximum length of 35".to_string(),
5162 ));
5163 }
5164 let pattern = Regex::new(
5165 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5166 )
5167 .unwrap();
5168 if !pattern.is_match(val) {
5169 return Err(ValidationError::new(
5170 1005,
5171 "bldg_nm does not match the required pattern".to_string(),
5172 ));
5173 }
5174 }
5175 if let Some(ref val) = self.flr {
5176 if val.chars().count() < 1 {
5177 return Err(ValidationError::new(
5178 1001,
5179 "flr is shorter than the minimum length of 1".to_string(),
5180 ));
5181 }
5182 if val.chars().count() > 70 {
5183 return Err(ValidationError::new(
5184 1002,
5185 "flr exceeds the maximum length of 70".to_string(),
5186 ));
5187 }
5188 let pattern = Regex::new(
5189 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5190 )
5191 .unwrap();
5192 if !pattern.is_match(val) {
5193 return Err(ValidationError::new(
5194 1005,
5195 "flr does not match the required pattern".to_string(),
5196 ));
5197 }
5198 }
5199 if let Some(ref val) = self.pst_bx {
5200 if val.chars().count() < 1 {
5201 return Err(ValidationError::new(
5202 1001,
5203 "pst_bx is shorter than the minimum length of 1".to_string(),
5204 ));
5205 }
5206 if val.chars().count() > 16 {
5207 return Err(ValidationError::new(
5208 1002,
5209 "pst_bx exceeds the maximum length of 16".to_string(),
5210 ));
5211 }
5212 let pattern = Regex::new(
5213 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5214 )
5215 .unwrap();
5216 if !pattern.is_match(val) {
5217 return Err(ValidationError::new(
5218 1005,
5219 "pst_bx does not match the required pattern".to_string(),
5220 ));
5221 }
5222 }
5223 if let Some(ref val) = self.room {
5224 if val.chars().count() < 1 {
5225 return Err(ValidationError::new(
5226 1001,
5227 "room is shorter than the minimum length of 1".to_string(),
5228 ));
5229 }
5230 if val.chars().count() > 70 {
5231 return Err(ValidationError::new(
5232 1002,
5233 "room exceeds the maximum length of 70".to_string(),
5234 ));
5235 }
5236 let pattern = Regex::new(
5237 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5238 )
5239 .unwrap();
5240 if !pattern.is_match(val) {
5241 return Err(ValidationError::new(
5242 1005,
5243 "room does not match the required pattern".to_string(),
5244 ));
5245 }
5246 }
5247 if let Some(ref val) = self.pst_cd {
5248 if val.chars().count() < 1 {
5249 return Err(ValidationError::new(
5250 1001,
5251 "pst_cd is shorter than the minimum length of 1".to_string(),
5252 ));
5253 }
5254 if val.chars().count() > 16 {
5255 return Err(ValidationError::new(
5256 1002,
5257 "pst_cd exceeds the maximum length of 16".to_string(),
5258 ));
5259 }
5260 let pattern = Regex::new(
5261 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5262 )
5263 .unwrap();
5264 if !pattern.is_match(val) {
5265 return Err(ValidationError::new(
5266 1005,
5267 "pst_cd does not match the required pattern".to_string(),
5268 ));
5269 }
5270 }
5271 if let Some(ref val) = self.twn_nm {
5272 if val.chars().count() < 1 {
5273 return Err(ValidationError::new(
5274 1001,
5275 "twn_nm is shorter than the minimum length of 1".to_string(),
5276 ));
5277 }
5278 if val.chars().count() > 35 {
5279 return Err(ValidationError::new(
5280 1002,
5281 "twn_nm exceeds the maximum length of 35".to_string(),
5282 ));
5283 }
5284 let pattern = Regex::new(
5285 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5286 )
5287 .unwrap();
5288 if !pattern.is_match(val) {
5289 return Err(ValidationError::new(
5290 1005,
5291 "twn_nm does not match the required pattern".to_string(),
5292 ));
5293 }
5294 }
5295 if let Some(ref val) = self.twn_lctn_nm {
5296 if val.chars().count() < 1 {
5297 return Err(ValidationError::new(
5298 1001,
5299 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
5300 ));
5301 }
5302 if val.chars().count() > 35 {
5303 return Err(ValidationError::new(
5304 1002,
5305 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
5306 ));
5307 }
5308 let pattern = Regex::new(
5309 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5310 )
5311 .unwrap();
5312 if !pattern.is_match(val) {
5313 return Err(ValidationError::new(
5314 1005,
5315 "twn_lctn_nm does not match the required pattern".to_string(),
5316 ));
5317 }
5318 }
5319 if let Some(ref val) = self.dstrct_nm {
5320 if val.chars().count() < 1 {
5321 return Err(ValidationError::new(
5322 1001,
5323 "dstrct_nm is shorter than the minimum length of 1".to_string(),
5324 ));
5325 }
5326 if val.chars().count() > 35 {
5327 return Err(ValidationError::new(
5328 1002,
5329 "dstrct_nm exceeds the maximum length of 35".to_string(),
5330 ));
5331 }
5332 let pattern = Regex::new(
5333 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5334 )
5335 .unwrap();
5336 if !pattern.is_match(val) {
5337 return Err(ValidationError::new(
5338 1005,
5339 "dstrct_nm does not match the required pattern".to_string(),
5340 ));
5341 }
5342 }
5343 if let Some(ref val) = self.ctry_sub_dvsn {
5344 if val.chars().count() < 1 {
5345 return Err(ValidationError::new(
5346 1001,
5347 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
5348 ));
5349 }
5350 if val.chars().count() > 35 {
5351 return Err(ValidationError::new(
5352 1002,
5353 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
5354 ));
5355 }
5356 let pattern = Regex::new(
5357 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5358 )
5359 .unwrap();
5360 if !pattern.is_match(val) {
5361 return Err(ValidationError::new(
5362 1005,
5363 "ctry_sub_dvsn does not match the required pattern".to_string(),
5364 ));
5365 }
5366 }
5367 if let Some(ref val) = self.ctry {
5368 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
5369 if !pattern.is_match(val) {
5370 return Err(ValidationError::new(
5371 1005,
5372 "ctry does not match the required pattern".to_string(),
5373 ));
5374 }
5375 }
5376 if let Some(ref vec) = self.adr_line {
5377 for item in vec {
5378 if item.chars().count() < 1 {
5379 return Err(ValidationError::new(
5380 1001,
5381 "adr_line is shorter than the minimum length of 1".to_string(),
5382 ));
5383 }
5384 if item.chars().count() > 70 {
5385 return Err(ValidationError::new(
5386 1002,
5387 "adr_line exceeds the maximum length of 70".to_string(),
5388 ));
5389 }
5390 let pattern = Regex::new(
5391 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5392 )
5393 .unwrap();
5394 if !pattern.is_match(&item) {
5395 return Err(ValidationError::new(
5396 1005,
5397 "adr_line does not match the required pattern".to_string(),
5398 ));
5399 }
5400 }
5401 }
5402 Ok(())
5403 }
5404}
5405
5406#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5408pub struct PostalAddress242 {
5409 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
5410 pub dept: Option<String>,
5411 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
5412 pub sub_dept: Option<String>,
5413 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
5414 pub strt_nm: Option<String>,
5415 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
5416 pub bldg_nb: Option<String>,
5417 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
5418 pub bldg_nm: Option<String>,
5419 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
5420 pub flr: Option<String>,
5421 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
5422 pub pst_bx: Option<String>,
5423 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
5424 pub room: Option<String>,
5425 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
5426 pub pst_cd: Option<String>,
5427 #[serde(rename = "TwnNm")]
5428 pub twn_nm: String,
5429 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
5430 pub twn_lctn_nm: Option<String>,
5431 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
5432 pub dstrct_nm: Option<String>,
5433 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
5434 pub ctry_sub_dvsn: Option<String>,
5435 #[serde(rename = "Ctry")]
5436 pub ctry: String,
5437 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
5438 pub adr_line: Option<Vec<String>>,
5439}
5440
5441impl PostalAddress242 {
5442 pub fn validate(&self) -> Result<(), ValidationError> {
5443 if let Some(ref val) = self.dept {
5444 if val.chars().count() < 1 {
5445 return Err(ValidationError::new(
5446 1001,
5447 "dept is shorter than the minimum length of 1".to_string(),
5448 ));
5449 }
5450 if val.chars().count() > 70 {
5451 return Err(ValidationError::new(
5452 1002,
5453 "dept exceeds the maximum length of 70".to_string(),
5454 ));
5455 }
5456 let pattern = Regex::new(
5457 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5458 )
5459 .unwrap();
5460 if !pattern.is_match(val) {
5461 return Err(ValidationError::new(
5462 1005,
5463 "dept does not match the required pattern".to_string(),
5464 ));
5465 }
5466 }
5467 if let Some(ref val) = self.sub_dept {
5468 if val.chars().count() < 1 {
5469 return Err(ValidationError::new(
5470 1001,
5471 "sub_dept is shorter than the minimum length of 1".to_string(),
5472 ));
5473 }
5474 if val.chars().count() > 70 {
5475 return Err(ValidationError::new(
5476 1002,
5477 "sub_dept exceeds the maximum length of 70".to_string(),
5478 ));
5479 }
5480 let pattern = Regex::new(
5481 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5482 )
5483 .unwrap();
5484 if !pattern.is_match(val) {
5485 return Err(ValidationError::new(
5486 1005,
5487 "sub_dept does not match the required pattern".to_string(),
5488 ));
5489 }
5490 }
5491 if let Some(ref val) = self.strt_nm {
5492 if val.chars().count() < 1 {
5493 return Err(ValidationError::new(
5494 1001,
5495 "strt_nm is shorter than the minimum length of 1".to_string(),
5496 ));
5497 }
5498 if val.chars().count() > 70 {
5499 return Err(ValidationError::new(
5500 1002,
5501 "strt_nm exceeds the maximum length of 70".to_string(),
5502 ));
5503 }
5504 let pattern = Regex::new(
5505 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5506 )
5507 .unwrap();
5508 if !pattern.is_match(val) {
5509 return Err(ValidationError::new(
5510 1005,
5511 "strt_nm does not match the required pattern".to_string(),
5512 ));
5513 }
5514 }
5515 if let Some(ref val) = self.bldg_nb {
5516 if val.chars().count() < 1 {
5517 return Err(ValidationError::new(
5518 1001,
5519 "bldg_nb is shorter than the minimum length of 1".to_string(),
5520 ));
5521 }
5522 if val.chars().count() > 16 {
5523 return Err(ValidationError::new(
5524 1002,
5525 "bldg_nb exceeds the maximum length of 16".to_string(),
5526 ));
5527 }
5528 let pattern = Regex::new(
5529 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5530 )
5531 .unwrap();
5532 if !pattern.is_match(val) {
5533 return Err(ValidationError::new(
5534 1005,
5535 "bldg_nb does not match the required pattern".to_string(),
5536 ));
5537 }
5538 }
5539 if let Some(ref val) = self.bldg_nm {
5540 if val.chars().count() < 1 {
5541 return Err(ValidationError::new(
5542 1001,
5543 "bldg_nm is shorter than the minimum length of 1".to_string(),
5544 ));
5545 }
5546 if val.chars().count() > 35 {
5547 return Err(ValidationError::new(
5548 1002,
5549 "bldg_nm exceeds the maximum length of 35".to_string(),
5550 ));
5551 }
5552 let pattern = Regex::new(
5553 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5554 )
5555 .unwrap();
5556 if !pattern.is_match(val) {
5557 return Err(ValidationError::new(
5558 1005,
5559 "bldg_nm does not match the required pattern".to_string(),
5560 ));
5561 }
5562 }
5563 if let Some(ref val) = self.flr {
5564 if val.chars().count() < 1 {
5565 return Err(ValidationError::new(
5566 1001,
5567 "flr is shorter than the minimum length of 1".to_string(),
5568 ));
5569 }
5570 if val.chars().count() > 70 {
5571 return Err(ValidationError::new(
5572 1002,
5573 "flr exceeds the maximum length of 70".to_string(),
5574 ));
5575 }
5576 let pattern = Regex::new(
5577 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5578 )
5579 .unwrap();
5580 if !pattern.is_match(val) {
5581 return Err(ValidationError::new(
5582 1005,
5583 "flr does not match the required pattern".to_string(),
5584 ));
5585 }
5586 }
5587 if let Some(ref val) = self.pst_bx {
5588 if val.chars().count() < 1 {
5589 return Err(ValidationError::new(
5590 1001,
5591 "pst_bx is shorter than the minimum length of 1".to_string(),
5592 ));
5593 }
5594 if val.chars().count() > 16 {
5595 return Err(ValidationError::new(
5596 1002,
5597 "pst_bx exceeds the maximum length of 16".to_string(),
5598 ));
5599 }
5600 let pattern = Regex::new(
5601 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5602 )
5603 .unwrap();
5604 if !pattern.is_match(val) {
5605 return Err(ValidationError::new(
5606 1005,
5607 "pst_bx does not match the required pattern".to_string(),
5608 ));
5609 }
5610 }
5611 if let Some(ref val) = self.room {
5612 if val.chars().count() < 1 {
5613 return Err(ValidationError::new(
5614 1001,
5615 "room is shorter than the minimum length of 1".to_string(),
5616 ));
5617 }
5618 if val.chars().count() > 70 {
5619 return Err(ValidationError::new(
5620 1002,
5621 "room exceeds the maximum length of 70".to_string(),
5622 ));
5623 }
5624 let pattern = Regex::new(
5625 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5626 )
5627 .unwrap();
5628 if !pattern.is_match(val) {
5629 return Err(ValidationError::new(
5630 1005,
5631 "room does not match the required pattern".to_string(),
5632 ));
5633 }
5634 }
5635 if let Some(ref val) = self.pst_cd {
5636 if val.chars().count() < 1 {
5637 return Err(ValidationError::new(
5638 1001,
5639 "pst_cd is shorter than the minimum length of 1".to_string(),
5640 ));
5641 }
5642 if val.chars().count() > 16 {
5643 return Err(ValidationError::new(
5644 1002,
5645 "pst_cd exceeds the maximum length of 16".to_string(),
5646 ));
5647 }
5648 let pattern = Regex::new(
5649 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5650 )
5651 .unwrap();
5652 if !pattern.is_match(val) {
5653 return Err(ValidationError::new(
5654 1005,
5655 "pst_cd does not match the required pattern".to_string(),
5656 ));
5657 }
5658 }
5659 if self.twn_nm.chars().count() < 1 {
5660 return Err(ValidationError::new(
5661 1001,
5662 "twn_nm is shorter than the minimum length of 1".to_string(),
5663 ));
5664 }
5665 if self.twn_nm.chars().count() > 35 {
5666 return Err(ValidationError::new(
5667 1002,
5668 "twn_nm exceeds the maximum length of 35".to_string(),
5669 ));
5670 }
5671 let pattern =
5672 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
5673 .unwrap();
5674 if !pattern.is_match(&self.twn_nm) {
5675 return Err(ValidationError::new(
5676 1005,
5677 "twn_nm does not match the required pattern".to_string(),
5678 ));
5679 }
5680 if let Some(ref val) = self.twn_lctn_nm {
5681 if val.chars().count() < 1 {
5682 return Err(ValidationError::new(
5683 1001,
5684 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
5685 ));
5686 }
5687 if val.chars().count() > 35 {
5688 return Err(ValidationError::new(
5689 1002,
5690 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
5691 ));
5692 }
5693 let pattern = Regex::new(
5694 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5695 )
5696 .unwrap();
5697 if !pattern.is_match(val) {
5698 return Err(ValidationError::new(
5699 1005,
5700 "twn_lctn_nm does not match the required pattern".to_string(),
5701 ));
5702 }
5703 }
5704 if let Some(ref val) = self.dstrct_nm {
5705 if val.chars().count() < 1 {
5706 return Err(ValidationError::new(
5707 1001,
5708 "dstrct_nm is shorter than the minimum length of 1".to_string(),
5709 ));
5710 }
5711 if val.chars().count() > 35 {
5712 return Err(ValidationError::new(
5713 1002,
5714 "dstrct_nm exceeds the maximum length of 35".to_string(),
5715 ));
5716 }
5717 let pattern = Regex::new(
5718 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5719 )
5720 .unwrap();
5721 if !pattern.is_match(val) {
5722 return Err(ValidationError::new(
5723 1005,
5724 "dstrct_nm does not match the required pattern".to_string(),
5725 ));
5726 }
5727 }
5728 if let Some(ref val) = self.ctry_sub_dvsn {
5729 if val.chars().count() < 1 {
5730 return Err(ValidationError::new(
5731 1001,
5732 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
5733 ));
5734 }
5735 if val.chars().count() > 35 {
5736 return Err(ValidationError::new(
5737 1002,
5738 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
5739 ));
5740 }
5741 let pattern = Regex::new(
5742 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5743 )
5744 .unwrap();
5745 if !pattern.is_match(val) {
5746 return Err(ValidationError::new(
5747 1005,
5748 "ctry_sub_dvsn does not match the required pattern".to_string(),
5749 ));
5750 }
5751 }
5752 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
5753 if !pattern.is_match(&self.ctry) {
5754 return Err(ValidationError::new(
5755 1005,
5756 "ctry does not match the required pattern".to_string(),
5757 ));
5758 }
5759 if let Some(ref vec) = self.adr_line {
5760 for item in vec {
5761 if item.chars().count() < 1 {
5762 return Err(ValidationError::new(
5763 1001,
5764 "adr_line is shorter than the minimum length of 1".to_string(),
5765 ));
5766 }
5767 if item.chars().count() > 70 {
5768 return Err(ValidationError::new(
5769 1002,
5770 "adr_line exceeds the maximum length of 70".to_string(),
5771 ));
5772 }
5773 let pattern = Regex::new(
5774 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
5775 )
5776 .unwrap();
5777 if !pattern.is_match(&item) {
5778 return Err(ValidationError::new(
5779 1005,
5780 "adr_line does not match the required pattern".to_string(),
5781 ));
5782 }
5783 }
5784 }
5785 Ok(())
5786 }
5787}
5788
5789#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5791pub struct PostalAddress243 {
5792 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
5793 pub dept: Option<String>,
5794 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
5795 pub sub_dept: Option<String>,
5796 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
5797 pub strt_nm: Option<String>,
5798 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
5799 pub bldg_nb: Option<String>,
5800 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
5801 pub bldg_nm: Option<String>,
5802 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
5803 pub flr: Option<String>,
5804 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
5805 pub pst_bx: Option<String>,
5806 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
5807 pub room: Option<String>,
5808 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
5809 pub pst_cd: Option<String>,
5810 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
5811 pub twn_nm: Option<String>,
5812 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
5813 pub twn_lctn_nm: Option<String>,
5814 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
5815 pub dstrct_nm: Option<String>,
5816 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
5817 pub ctry_sub_dvsn: Option<String>,
5818 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
5819 pub ctry: Option<String>,
5820 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
5821 pub adr_line: Option<Vec<String>>,
5822}
5823
5824impl PostalAddress243 {
5825 pub fn validate(&self) -> Result<(), ValidationError> {
5826 if let Some(ref val) = self.dept {
5827 if val.chars().count() < 1 {
5828 return Err(ValidationError::new(
5829 1001,
5830 "dept is shorter than the minimum length of 1".to_string(),
5831 ));
5832 }
5833 if val.chars().count() > 70 {
5834 return Err(ValidationError::new(
5835 1002,
5836 "dept exceeds the maximum length of 70".to_string(),
5837 ));
5838 }
5839 }
5840 if let Some(ref val) = self.sub_dept {
5841 if val.chars().count() < 1 {
5842 return Err(ValidationError::new(
5843 1001,
5844 "sub_dept is shorter than the minimum length of 1".to_string(),
5845 ));
5846 }
5847 if val.chars().count() > 70 {
5848 return Err(ValidationError::new(
5849 1002,
5850 "sub_dept exceeds the maximum length of 70".to_string(),
5851 ));
5852 }
5853 }
5854 if let Some(ref val) = self.strt_nm {
5855 if val.chars().count() < 1 {
5856 return Err(ValidationError::new(
5857 1001,
5858 "strt_nm is shorter than the minimum length of 1".to_string(),
5859 ));
5860 }
5861 if val.chars().count() > 70 {
5862 return Err(ValidationError::new(
5863 1002,
5864 "strt_nm exceeds the maximum length of 70".to_string(),
5865 ));
5866 }
5867 }
5868 if let Some(ref val) = self.bldg_nb {
5869 if val.chars().count() < 1 {
5870 return Err(ValidationError::new(
5871 1001,
5872 "bldg_nb is shorter than the minimum length of 1".to_string(),
5873 ));
5874 }
5875 if val.chars().count() > 16 {
5876 return Err(ValidationError::new(
5877 1002,
5878 "bldg_nb exceeds the maximum length of 16".to_string(),
5879 ));
5880 }
5881 }
5882 if let Some(ref val) = self.bldg_nm {
5883 if val.chars().count() < 1 {
5884 return Err(ValidationError::new(
5885 1001,
5886 "bldg_nm is shorter than the minimum length of 1".to_string(),
5887 ));
5888 }
5889 if val.chars().count() > 35 {
5890 return Err(ValidationError::new(
5891 1002,
5892 "bldg_nm exceeds the maximum length of 35".to_string(),
5893 ));
5894 }
5895 }
5896 if let Some(ref val) = self.flr {
5897 if val.chars().count() < 1 {
5898 return Err(ValidationError::new(
5899 1001,
5900 "flr is shorter than the minimum length of 1".to_string(),
5901 ));
5902 }
5903 if val.chars().count() > 70 {
5904 return Err(ValidationError::new(
5905 1002,
5906 "flr exceeds the maximum length of 70".to_string(),
5907 ));
5908 }
5909 }
5910 if let Some(ref val) = self.pst_bx {
5911 if val.chars().count() < 1 {
5912 return Err(ValidationError::new(
5913 1001,
5914 "pst_bx is shorter than the minimum length of 1".to_string(),
5915 ));
5916 }
5917 if val.chars().count() > 16 {
5918 return Err(ValidationError::new(
5919 1002,
5920 "pst_bx exceeds the maximum length of 16".to_string(),
5921 ));
5922 }
5923 }
5924 if let Some(ref val) = self.room {
5925 if val.chars().count() < 1 {
5926 return Err(ValidationError::new(
5927 1001,
5928 "room is shorter than the minimum length of 1".to_string(),
5929 ));
5930 }
5931 if val.chars().count() > 70 {
5932 return Err(ValidationError::new(
5933 1002,
5934 "room exceeds the maximum length of 70".to_string(),
5935 ));
5936 }
5937 }
5938 if let Some(ref val) = self.pst_cd {
5939 if val.chars().count() < 1 {
5940 return Err(ValidationError::new(
5941 1001,
5942 "pst_cd is shorter than the minimum length of 1".to_string(),
5943 ));
5944 }
5945 if val.chars().count() > 16 {
5946 return Err(ValidationError::new(
5947 1002,
5948 "pst_cd exceeds the maximum length of 16".to_string(),
5949 ));
5950 }
5951 }
5952 if let Some(ref val) = self.twn_nm {
5953 if val.chars().count() < 1 {
5954 return Err(ValidationError::new(
5955 1001,
5956 "twn_nm is shorter than the minimum length of 1".to_string(),
5957 ));
5958 }
5959 if val.chars().count() > 35 {
5960 return Err(ValidationError::new(
5961 1002,
5962 "twn_nm exceeds the maximum length of 35".to_string(),
5963 ));
5964 }
5965 }
5966 if let Some(ref val) = self.twn_lctn_nm {
5967 if val.chars().count() < 1 {
5968 return Err(ValidationError::new(
5969 1001,
5970 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
5971 ));
5972 }
5973 if val.chars().count() > 35 {
5974 return Err(ValidationError::new(
5975 1002,
5976 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
5977 ));
5978 }
5979 }
5980 if let Some(ref val) = self.dstrct_nm {
5981 if val.chars().count() < 1 {
5982 return Err(ValidationError::new(
5983 1001,
5984 "dstrct_nm is shorter than the minimum length of 1".to_string(),
5985 ));
5986 }
5987 if val.chars().count() > 35 {
5988 return Err(ValidationError::new(
5989 1002,
5990 "dstrct_nm exceeds the maximum length of 35".to_string(),
5991 ));
5992 }
5993 }
5994 if let Some(ref val) = self.ctry_sub_dvsn {
5995 if val.chars().count() < 1 {
5996 return Err(ValidationError::new(
5997 1001,
5998 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
5999 ));
6000 }
6001 if val.chars().count() > 35 {
6002 return Err(ValidationError::new(
6003 1002,
6004 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
6005 ));
6006 }
6007 }
6008 if let Some(ref val) = self.ctry {
6009 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
6010 if !pattern.is_match(val) {
6011 return Err(ValidationError::new(
6012 1005,
6013 "ctry does not match the required pattern".to_string(),
6014 ));
6015 }
6016 }
6017 if let Some(ref vec) = self.adr_line {
6018 for item in vec {
6019 if item.chars().count() < 1 {
6020 return Err(ValidationError::new(
6021 1001,
6022 "adr_line is shorter than the minimum length of 1".to_string(),
6023 ));
6024 }
6025 if item.chars().count() > 70 {
6026 return Err(ValidationError::new(
6027 1002,
6028 "adr_line exceeds the maximum length of 70".to_string(),
6029 ));
6030 }
6031 }
6032 }
6033 Ok(())
6034 }
6035}
6036
6037#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6039pub enum Priority2Code {
6040 #[default]
6041 #[serde(rename = "HIGH")]
6042 CodeHIGH,
6043 #[serde(rename = "NORM")]
6044 CodeNORM,
6045}
6046
6047impl Priority2Code {
6048 pub fn validate(&self) -> Result<(), ValidationError> {
6049 Ok(())
6050 }
6051}
6052
6053#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6055pub enum Priority3Code {
6056 #[default]
6057 #[serde(rename = "URGT")]
6058 CodeURGT,
6059 #[serde(rename = "HIGH")]
6060 CodeHIGH,
6061 #[serde(rename = "NORM")]
6062 CodeNORM,
6063}
6064
6065impl Priority3Code {
6066 pub fn validate(&self) -> Result<(), ValidationError> {
6067 Ok(())
6068 }
6069}
6070
6071#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6073pub struct ProxyAccountIdentification1 {
6074 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
6075 pub tp: Option<ProxyAccountType1Choice>,
6076 #[serde(rename = "Id")]
6077 pub id: String,
6078}
6079
6080impl ProxyAccountIdentification1 {
6081 pub fn validate(&self) -> Result<(), ValidationError> {
6082 if let Some(ref val) = self.tp {
6083 val.validate()?
6084 }
6085 if self.id.chars().count() < 1 {
6086 return Err(ValidationError::new(
6087 1001,
6088 "id is shorter than the minimum length of 1".to_string(),
6089 ));
6090 }
6091 if self.id.chars().count() > 2048 {
6092 return Err(ValidationError::new(
6093 1002,
6094 "id exceeds the maximum length of 2048".to_string(),
6095 ));
6096 }
6097 Ok(())
6098 }
6099}
6100
6101#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6103pub struct ProxyAccountIdentification11 {
6104 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
6105 pub tp: Option<ProxyAccountType1Choice1>,
6106 #[serde(rename = "Id")]
6107 pub id: String,
6108}
6109
6110impl ProxyAccountIdentification11 {
6111 pub fn validate(&self) -> Result<(), ValidationError> {
6112 if let Some(ref val) = self.tp {
6113 val.validate()?
6114 }
6115 if self.id.chars().count() < 1 {
6116 return Err(ValidationError::new(
6117 1001,
6118 "id is shorter than the minimum length of 1".to_string(),
6119 ));
6120 }
6121 if self.id.chars().count() > 320 {
6122 return Err(ValidationError::new(
6123 1002,
6124 "id exceeds the maximum length of 320".to_string(),
6125 ));
6126 }
6127 let pattern =
6128 Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+")
6129 .unwrap();
6130 if !pattern.is_match(&self.id) {
6131 return Err(ValidationError::new(
6132 1005,
6133 "id does not match the required pattern".to_string(),
6134 ));
6135 }
6136 Ok(())
6137 }
6138}
6139
6140#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6142pub struct ProxyAccountType1Choice {
6143 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6144 pub cd: Option<String>,
6145 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6146 pub prtry: Option<String>,
6147}
6148
6149impl ProxyAccountType1Choice {
6150 pub fn validate(&self) -> Result<(), ValidationError> {
6151 if let Some(ref val) = self.cd {
6152 if val.chars().count() < 1 {
6153 return Err(ValidationError::new(
6154 1001,
6155 "cd is shorter than the minimum length of 1".to_string(),
6156 ));
6157 }
6158 if val.chars().count() > 4 {
6159 return Err(ValidationError::new(
6160 1002,
6161 "cd exceeds the maximum length of 4".to_string(),
6162 ));
6163 }
6164 }
6165 if let Some(ref val) = self.prtry {
6166 if val.chars().count() < 1 {
6167 return Err(ValidationError::new(
6168 1001,
6169 "prtry is shorter than the minimum length of 1".to_string(),
6170 ));
6171 }
6172 if val.chars().count() > 35 {
6173 return Err(ValidationError::new(
6174 1002,
6175 "prtry exceeds the maximum length of 35".to_string(),
6176 ));
6177 }
6178 }
6179 Ok(())
6180 }
6181}
6182
6183#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6185pub struct ProxyAccountType1Choice1 {
6186 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6187 pub cd: Option<String>,
6188 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6189 pub prtry: Option<String>,
6190}
6191
6192impl ProxyAccountType1Choice1 {
6193 pub fn validate(&self) -> Result<(), ValidationError> {
6194 if let Some(ref val) = self.cd {
6195 if val.chars().count() < 1 {
6196 return Err(ValidationError::new(
6197 1001,
6198 "cd is shorter than the minimum length of 1".to_string(),
6199 ));
6200 }
6201 if val.chars().count() > 4 {
6202 return Err(ValidationError::new(
6203 1002,
6204 "cd exceeds the maximum length of 4".to_string(),
6205 ));
6206 }
6207 }
6208 if let Some(ref val) = self.prtry {
6209 if val.chars().count() < 1 {
6210 return Err(ValidationError::new(
6211 1001,
6212 "prtry is shorter than the minimum length of 1".to_string(),
6213 ));
6214 }
6215 if val.chars().count() > 35 {
6216 return Err(ValidationError::new(
6217 1002,
6218 "prtry exceeds the maximum length of 35".to_string(),
6219 ));
6220 }
6221 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6222 if !pattern.is_match(val) {
6223 return Err(ValidationError::new(
6224 1005,
6225 "prtry does not match the required pattern".to_string(),
6226 ));
6227 }
6228 }
6229 Ok(())
6230 }
6231}
6232
6233#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6235pub struct Purpose2Choice1 {
6236 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6237 pub cd: Option<String>,
6238 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6239 pub prtry: Option<String>,
6240}
6241
6242impl Purpose2Choice1 {
6243 pub fn validate(&self) -> Result<(), ValidationError> {
6244 if let Some(ref val) = self.cd {
6245 if val.chars().count() < 1 {
6246 return Err(ValidationError::new(
6247 1001,
6248 "cd is shorter than the minimum length of 1".to_string(),
6249 ));
6250 }
6251 if val.chars().count() > 4 {
6252 return Err(ValidationError::new(
6253 1002,
6254 "cd exceeds the maximum length of 4".to_string(),
6255 ));
6256 }
6257 }
6258 if let Some(ref val) = self.prtry {
6259 if val.chars().count() < 1 {
6260 return Err(ValidationError::new(
6261 1001,
6262 "prtry is shorter than the minimum length of 1".to_string(),
6263 ));
6264 }
6265 if val.chars().count() > 35 {
6266 return Err(ValidationError::new(
6267 1002,
6268 "prtry exceeds the maximum length of 35".to_string(),
6269 ));
6270 }
6271 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6272 if !pattern.is_match(val) {
6273 return Err(ValidationError::new(
6274 1005,
6275 "prtry does not match the required pattern".to_string(),
6276 ));
6277 }
6278 }
6279 Ok(())
6280 }
6281}
6282
6283#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6285pub struct ReferredDocumentInformation71 {
6286 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
6287 pub tp: Option<ReferredDocumentType41>,
6288 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
6289 pub nb: Option<String>,
6290 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
6291 pub rltd_dt: Option<String>,
6292 #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
6293 pub line_dtls: Option<Vec<DocumentLineInformation11>>,
6294}
6295
6296impl ReferredDocumentInformation71 {
6297 pub fn validate(&self) -> Result<(), ValidationError> {
6298 if let Some(ref val) = self.tp {
6299 val.validate()?
6300 }
6301 if let Some(ref val) = self.nb {
6302 if val.chars().count() < 1 {
6303 return Err(ValidationError::new(
6304 1001,
6305 "nb is shorter than the minimum length of 1".to_string(),
6306 ));
6307 }
6308 if val.chars().count() > 35 {
6309 return Err(ValidationError::new(
6310 1002,
6311 "nb exceeds the maximum length of 35".to_string(),
6312 ));
6313 }
6314 let pattern = Regex::new(
6315 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6316 )
6317 .unwrap();
6318 if !pattern.is_match(val) {
6319 return Err(ValidationError::new(
6320 1005,
6321 "nb does not match the required pattern".to_string(),
6322 ));
6323 }
6324 }
6325 if let Some(ref vec) = self.line_dtls {
6326 for item in vec {
6327 item.validate()?
6328 }
6329 }
6330 Ok(())
6331 }
6332}
6333
6334#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6336pub struct ReferredDocumentType3Choice1 {
6337 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6338 pub cd: Option<DocumentType6Code>,
6339 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6340 pub prtry: Option<String>,
6341}
6342
6343impl ReferredDocumentType3Choice1 {
6344 pub fn validate(&self) -> Result<(), ValidationError> {
6345 if let Some(ref val) = self.cd {
6346 val.validate()?
6347 }
6348 if let Some(ref val) = self.prtry {
6349 if val.chars().count() < 1 {
6350 return Err(ValidationError::new(
6351 1001,
6352 "prtry is shorter than the minimum length of 1".to_string(),
6353 ));
6354 }
6355 if val.chars().count() > 35 {
6356 return Err(ValidationError::new(
6357 1002,
6358 "prtry exceeds the maximum length of 35".to_string(),
6359 ));
6360 }
6361 let pattern = Regex::new(
6362 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6363 )
6364 .unwrap();
6365 if !pattern.is_match(val) {
6366 return Err(ValidationError::new(
6367 1005,
6368 "prtry does not match the required pattern".to_string(),
6369 ));
6370 }
6371 }
6372 Ok(())
6373 }
6374}
6375
6376#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6378pub struct ReferredDocumentType41 {
6379 #[serde(rename = "CdOrPrtry")]
6380 pub cd_or_prtry: ReferredDocumentType3Choice1,
6381 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
6382 pub issr: Option<String>,
6383}
6384
6385impl ReferredDocumentType41 {
6386 pub fn validate(&self) -> Result<(), ValidationError> {
6387 self.cd_or_prtry.validate()?;
6388 if let Some(ref val) = self.issr {
6389 if val.chars().count() < 1 {
6390 return Err(ValidationError::new(
6391 1001,
6392 "issr is shorter than the minimum length of 1".to_string(),
6393 ));
6394 }
6395 if val.chars().count() > 35 {
6396 return Err(ValidationError::new(
6397 1002,
6398 "issr exceeds the maximum length of 35".to_string(),
6399 ));
6400 }
6401 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6402 if !pattern.is_match(val) {
6403 return Err(ValidationError::new(
6404 1005,
6405 "issr does not match the required pattern".to_string(),
6406 ));
6407 }
6408 }
6409 Ok(())
6410 }
6411}
6412
6413#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6415pub struct RemittanceAmount21 {
6416 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
6417 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6418 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
6419 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType11>>,
6420 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
6421 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6422 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
6423 pub tax_amt: Option<Vec<TaxAmountAndType12>>,
6424 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
6425 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
6426 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
6427 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6428}
6429
6430impl RemittanceAmount21 {
6431 pub fn validate(&self) -> Result<(), ValidationError> {
6432 if let Some(ref val) = self.due_pybl_amt {
6433 val.validate()?
6434 }
6435 if let Some(ref vec) = self.dscnt_apld_amt {
6436 for item in vec {
6437 item.validate()?
6438 }
6439 }
6440 if let Some(ref val) = self.cdt_note_amt {
6441 val.validate()?
6442 }
6443 if let Some(ref vec) = self.tax_amt {
6444 for item in vec {
6445 item.validate()?
6446 }
6447 }
6448 if let Some(ref vec) = self.adjstmnt_amt_and_rsn {
6449 for item in vec {
6450 item.validate()?
6451 }
6452 }
6453 if let Some(ref val) = self.rmtd_amt {
6454 val.validate()?
6455 }
6456 Ok(())
6457 }
6458}
6459
6460#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6462pub struct RemittanceAmount31 {
6463 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
6464 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6465 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
6466 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
6467 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
6468 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6469 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
6470 pub tax_amt: Option<Vec<TaxAmountAndType11>>,
6471 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
6472 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment11>>,
6473 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
6474 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6475}
6476
6477impl RemittanceAmount31 {
6478 pub fn validate(&self) -> Result<(), ValidationError> {
6479 if let Some(ref val) = self.due_pybl_amt {
6480 val.validate()?
6481 }
6482 if let Some(ref vec) = self.dscnt_apld_amt {
6483 for item in vec {
6484 item.validate()?
6485 }
6486 }
6487 if let Some(ref val) = self.cdt_note_amt {
6488 val.validate()?
6489 }
6490 if let Some(ref vec) = self.tax_amt {
6491 for item in vec {
6492 item.validate()?
6493 }
6494 }
6495 if let Some(ref vec) = self.adjstmnt_amt_and_rsn {
6496 for item in vec {
6497 item.validate()?
6498 }
6499 }
6500 if let Some(ref val) = self.rmtd_amt {
6501 val.validate()?
6502 }
6503 Ok(())
6504 }
6505}
6506
6507#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6509pub struct RemittanceInformation161 {
6510 #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
6511 pub ustrd: Option<String>,
6512 #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
6513 pub strd: Option<Vec<StructuredRemittanceInformation161>>,
6514}
6515
6516impl RemittanceInformation161 {
6517 pub fn validate(&self) -> Result<(), ValidationError> {
6518 if let Some(ref val) = self.ustrd {
6519 if val.chars().count() < 1 {
6520 return Err(ValidationError::new(
6521 1001,
6522 "ustrd is shorter than the minimum length of 1".to_string(),
6523 ));
6524 }
6525 if val.chars().count() > 140 {
6526 return Err(ValidationError::new(
6527 1002,
6528 "ustrd exceeds the maximum length of 140".to_string(),
6529 ));
6530 }
6531 let pattern = Regex::new(
6532 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6533 )
6534 .unwrap();
6535 if !pattern.is_match(val) {
6536 return Err(ValidationError::new(
6537 1005,
6538 "ustrd does not match the required pattern".to_string(),
6539 ));
6540 }
6541 }
6542 if let Some(ref vec) = self.strd {
6543 for item in vec {
6544 item.validate()?
6545 }
6546 }
6547 Ok(())
6548 }
6549}
6550
6551#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6553pub struct ReturnReason5Choice1 {
6554 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6555 pub cd: Option<String>,
6556}
6557
6558impl ReturnReason5Choice1 {
6559 pub fn validate(&self) -> Result<(), ValidationError> {
6560 if let Some(ref val) = self.cd {
6561 if val.chars().count() < 1 {
6562 return Err(ValidationError::new(
6563 1001,
6564 "cd is shorter than the minimum length of 1".to_string(),
6565 ));
6566 }
6567 if val.chars().count() > 4 {
6568 return Err(ValidationError::new(
6569 1002,
6570 "cd exceeds the maximum length of 4".to_string(),
6571 ));
6572 }
6573 }
6574 Ok(())
6575 }
6576}
6577
6578#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6580pub enum SequenceType3Code {
6581 #[default]
6582 #[serde(rename = "FRST")]
6583 CodeFRST,
6584 #[serde(rename = "RCUR")]
6585 CodeRCUR,
6586 #[serde(rename = "FNAL")]
6587 CodeFNAL,
6588 #[serde(rename = "OOFF")]
6589 CodeOOFF,
6590 #[serde(rename = "RPRE")]
6591 CodeRPRE,
6592}
6593
6594impl SequenceType3Code {
6595 pub fn validate(&self) -> Result<(), ValidationError> {
6596 Ok(())
6597 }
6598}
6599
6600#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6602pub struct ServiceLevel8Choice1 {
6603 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6604 pub cd: Option<String>,
6605 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6606 pub prtry: Option<String>,
6607}
6608
6609impl ServiceLevel8Choice1 {
6610 pub fn validate(&self) -> Result<(), ValidationError> {
6611 if let Some(ref val) = self.cd {
6612 if val.chars().count() < 1 {
6613 return Err(ValidationError::new(
6614 1001,
6615 "cd is shorter than the minimum length of 1".to_string(),
6616 ));
6617 }
6618 if val.chars().count() > 4 {
6619 return Err(ValidationError::new(
6620 1002,
6621 "cd exceeds the maximum length of 4".to_string(),
6622 ));
6623 }
6624 }
6625 if let Some(ref val) = self.prtry {
6626 if val.chars().count() < 1 {
6627 return Err(ValidationError::new(
6628 1001,
6629 "prtry is shorter than the minimum length of 1".to_string(),
6630 ));
6631 }
6632 if val.chars().count() > 35 {
6633 return Err(ValidationError::new(
6634 1002,
6635 "prtry exceeds the maximum length of 35".to_string(),
6636 ));
6637 }
6638 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6639 if !pattern.is_match(val) {
6640 return Err(ValidationError::new(
6641 1005,
6642 "prtry does not match the required pattern".to_string(),
6643 ));
6644 }
6645 }
6646 Ok(())
6647 }
6648}
6649
6650#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6652pub struct SettlementDateTimeIndication11 {
6653 #[serde(rename = "DbtDtTm", skip_serializing_if = "Option::is_none")]
6654 pub dbt_dt_tm: Option<String>,
6655 #[serde(rename = "CdtDtTm", skip_serializing_if = "Option::is_none")]
6656 pub cdt_dt_tm: Option<String>,
6657}
6658
6659impl SettlementDateTimeIndication11 {
6660 pub fn validate(&self) -> Result<(), ValidationError> {
6661 if let Some(ref val) = self.dbt_dt_tm {
6662 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
6663 if !pattern.is_match(val) {
6664 return Err(ValidationError::new(
6665 1005,
6666 "dbt_dt_tm does not match the required pattern".to_string(),
6667 ));
6668 }
6669 }
6670 if let Some(ref val) = self.cdt_dt_tm {
6671 let pattern = Regex::new(".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]").unwrap();
6672 if !pattern.is_match(val) {
6673 return Err(ValidationError::new(
6674 1005,
6675 "cdt_dt_tm does not match the required pattern".to_string(),
6676 ));
6677 }
6678 }
6679 Ok(())
6680 }
6681}
6682
6683#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6685pub struct SettlementInstruction71 {
6686 #[serde(rename = "SttlmMtd")]
6687 pub sttlm_mtd: SettlementMethod1Code1,
6688 #[serde(rename = "SttlmAcct", skip_serializing_if = "Option::is_none")]
6689 pub sttlm_acct: Option<CashAccount381>,
6690}
6691
6692impl SettlementInstruction71 {
6693 pub fn validate(&self) -> Result<(), ValidationError> {
6694 self.sttlm_mtd.validate()?;
6695 if let Some(ref val) = self.sttlm_acct {
6696 val.validate()?
6697 }
6698 Ok(())
6699 }
6700}
6701
6702#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6704pub struct SettlementInstruction72 {
6705 #[serde(rename = "SttlmMtd")]
6706 pub sttlm_mtd: SettlementMethod1Code2,
6707 #[serde(rename = "SttlmAcct", skip_serializing_if = "Option::is_none")]
6708 pub sttlm_acct: Option<CashAccount382>,
6709 #[serde(rename = "InstgRmbrsmntAgt", skip_serializing_if = "Option::is_none")]
6710 pub instg_rmbrsmnt_agt: Option<BranchAndFinancialInstitutionIdentification61>,
6711 #[serde(
6712 rename = "InstgRmbrsmntAgtAcct",
6713 skip_serializing_if = "Option::is_none"
6714 )]
6715 pub instg_rmbrsmnt_agt_acct: Option<CashAccount382>,
6716 #[serde(rename = "InstdRmbrsmntAgt", skip_serializing_if = "Option::is_none")]
6717 pub instd_rmbrsmnt_agt: Option<BranchAndFinancialInstitutionIdentification61>,
6718 #[serde(
6719 rename = "InstdRmbrsmntAgtAcct",
6720 skip_serializing_if = "Option::is_none"
6721 )]
6722 pub instd_rmbrsmnt_agt_acct: Option<CashAccount382>,
6723 #[serde(rename = "ThrdRmbrsmntAgt", skip_serializing_if = "Option::is_none")]
6724 pub thrd_rmbrsmnt_agt: Option<BranchAndFinancialInstitutionIdentification61>,
6725 #[serde(
6726 rename = "ThrdRmbrsmntAgtAcct",
6727 skip_serializing_if = "Option::is_none"
6728 )]
6729 pub thrd_rmbrsmnt_agt_acct: Option<CashAccount382>,
6730}
6731
6732impl SettlementInstruction72 {
6733 pub fn validate(&self) -> Result<(), ValidationError> {
6734 self.sttlm_mtd.validate()?;
6735 if let Some(ref val) = self.sttlm_acct {
6736 val.validate()?
6737 }
6738 if let Some(ref val) = self.instg_rmbrsmnt_agt {
6739 val.validate()?
6740 }
6741 if let Some(ref val) = self.instg_rmbrsmnt_agt_acct {
6742 val.validate()?
6743 }
6744 if let Some(ref val) = self.instd_rmbrsmnt_agt {
6745 val.validate()?
6746 }
6747 if let Some(ref val) = self.instd_rmbrsmnt_agt_acct {
6748 val.validate()?
6749 }
6750 if let Some(ref val) = self.thrd_rmbrsmnt_agt {
6751 val.validate()?
6752 }
6753 if let Some(ref val) = self.thrd_rmbrsmnt_agt_acct {
6754 val.validate()?
6755 }
6756 Ok(())
6757 }
6758}
6759
6760#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6762pub enum SettlementMethod1Code1 {
6763 #[default]
6764 #[serde(rename = "INDA")]
6765 CodeINDA,
6766 #[serde(rename = "INGA")]
6767 CodeINGA,
6768}
6769
6770impl SettlementMethod1Code1 {
6771 pub fn validate(&self) -> Result<(), ValidationError> {
6772 Ok(())
6773 }
6774}
6775
6776#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6778pub enum SettlementMethod1Code2 {
6779 #[default]
6780 #[serde(rename = "INDA")]
6781 CodeINDA,
6782 #[serde(rename = "INGA")]
6783 CodeINGA,
6784 #[serde(rename = "COVE")]
6785 CodeCOVE,
6786}
6787
6788impl SettlementMethod1Code2 {
6789 pub fn validate(&self) -> Result<(), ValidationError> {
6790 Ok(())
6791 }
6792}
6793
6794#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6796pub struct StructuredRemittanceInformation161 {
6797 #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
6798 pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation71>>,
6799 #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
6800 pub rfrd_doc_amt: Option<RemittanceAmount21>,
6801 #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
6802 pub cdtr_ref_inf: Option<CreditorReferenceInformation21>,
6803 #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
6804 pub invcr: Option<PartyIdentification1355>,
6805 #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
6806 pub invcee: Option<PartyIdentification1355>,
6807 #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
6808 pub tax_rmt: Option<TaxInformation71>,
6809 #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
6810 pub grnshmt_rmt: Option<Garnishment31>,
6811 #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
6812 pub addtl_rmt_inf: Option<Vec<String>>,
6813}
6814
6815impl StructuredRemittanceInformation161 {
6816 pub fn validate(&self) -> Result<(), ValidationError> {
6817 if let Some(ref vec) = self.rfrd_doc_inf {
6818 for item in vec {
6819 item.validate()?
6820 }
6821 }
6822 if let Some(ref val) = self.rfrd_doc_amt {
6823 val.validate()?
6824 }
6825 if let Some(ref val) = self.cdtr_ref_inf {
6826 val.validate()?
6827 }
6828 if let Some(ref val) = self.invcr {
6829 val.validate()?
6830 }
6831 if let Some(ref val) = self.invcee {
6832 val.validate()?
6833 }
6834 if let Some(ref val) = self.tax_rmt {
6835 val.validate()?
6836 }
6837 if let Some(ref val) = self.grnshmt_rmt {
6838 val.validate()?
6839 }
6840 if let Some(ref vec) = self.addtl_rmt_inf {
6841 for item in vec {
6842 if item.chars().count() < 1 {
6843 return Err(ValidationError::new(
6844 1001,
6845 "addtl_rmt_inf is shorter than the minimum length of 1".to_string(),
6846 ));
6847 }
6848 if item.chars().count() > 140 {
6849 return Err(ValidationError::new(
6850 1002,
6851 "addtl_rmt_inf exceeds the maximum length of 140".to_string(),
6852 ));
6853 }
6854 let pattern = Regex::new(
6855 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
6856 )
6857 .unwrap();
6858 if !pattern.is_match(&item) {
6859 return Err(ValidationError::new(
6860 1005,
6861 "addtl_rmt_inf does not match the required pattern".to_string(),
6862 ));
6863 }
6864 }
6865 }
6866 Ok(())
6867 }
6868}
6869
6870#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6872pub struct TaxAmount2 {
6873 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
6874 pub rate: Option<f64>,
6875 #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
6876 pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6877 #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
6878 pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
6879 #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
6880 pub dtls: Option<Vec<TaxRecordDetails2>>,
6881}
6882
6883impl TaxAmount2 {
6884 pub fn validate(&self) -> Result<(), ValidationError> {
6885 if let Some(ref val) = self.taxbl_base_amt {
6886 val.validate()?
6887 }
6888 if let Some(ref val) = self.ttl_amt {
6889 val.validate()?
6890 }
6891 if let Some(ref vec) = self.dtls {
6892 for item in vec {
6893 item.validate()?
6894 }
6895 }
6896 Ok(())
6897 }
6898}
6899
6900#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6902pub struct TaxAmountAndType11 {
6903 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
6904 pub tp: Option<TaxAmountType1Choice1>,
6905 #[serde(rename = "Amt")]
6906 pub amt: ActiveOrHistoricCurrencyAndAmount,
6907}
6908
6909impl TaxAmountAndType11 {
6910 pub fn validate(&self) -> Result<(), ValidationError> {
6911 if let Some(ref val) = self.tp {
6912 val.validate()?
6913 }
6914 self.amt.validate()?;
6915 Ok(())
6916 }
6917}
6918
6919#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6921pub struct TaxAmountAndType12 {
6922 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
6923 pub tp: Option<TaxAmountType1Choice2>,
6924 #[serde(rename = "Amt")]
6925 pub amt: ActiveOrHistoricCurrencyAndAmount,
6926}
6927
6928impl TaxAmountAndType12 {
6929 pub fn validate(&self) -> Result<(), ValidationError> {
6930 if let Some(ref val) = self.tp {
6931 val.validate()?
6932 }
6933 self.amt.validate()?;
6934 Ok(())
6935 }
6936}
6937
6938#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6940pub struct TaxAmountType1Choice1 {
6941 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6942 pub cd: Option<String>,
6943 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6944 pub prtry: Option<String>,
6945}
6946
6947impl TaxAmountType1Choice1 {
6948 pub fn validate(&self) -> Result<(), ValidationError> {
6949 if let Some(ref val) = self.cd {
6950 if val.chars().count() < 1 {
6951 return Err(ValidationError::new(
6952 1001,
6953 "cd is shorter than the minimum length of 1".to_string(),
6954 ));
6955 }
6956 if val.chars().count() > 4 {
6957 return Err(ValidationError::new(
6958 1002,
6959 "cd exceeds the maximum length of 4".to_string(),
6960 ));
6961 }
6962 }
6963 if let Some(ref val) = self.prtry {
6964 if val.chars().count() < 1 {
6965 return Err(ValidationError::new(
6966 1001,
6967 "prtry is shorter than the minimum length of 1".to_string(),
6968 ));
6969 }
6970 if val.chars().count() > 35 {
6971 return Err(ValidationError::new(
6972 1002,
6973 "prtry exceeds the maximum length of 35".to_string(),
6974 ));
6975 }
6976 let pattern = Regex::new("[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+").unwrap();
6977 if !pattern.is_match(val) {
6978 return Err(ValidationError::new(
6979 1005,
6980 "prtry does not match the required pattern".to_string(),
6981 ));
6982 }
6983 }
6984 Ok(())
6985 }
6986}
6987
6988#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6990pub struct TaxAmountType1Choice2 {
6991 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
6992 pub cd: Option<String>,
6993 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
6994 pub prtry: Option<String>,
6995}
6996
6997impl TaxAmountType1Choice2 {
6998 pub fn validate(&self) -> Result<(), ValidationError> {
6999 if let Some(ref val) = self.cd {
7000 if val.chars().count() < 1 {
7001 return Err(ValidationError::new(
7002 1001,
7003 "cd is shorter than the minimum length of 1".to_string(),
7004 ));
7005 }
7006 if val.chars().count() > 4 {
7007 return Err(ValidationError::new(
7008 1002,
7009 "cd exceeds the maximum length of 4".to_string(),
7010 ));
7011 }
7012 }
7013 if let Some(ref val) = self.prtry {
7014 if val.chars().count() < 1 {
7015 return Err(ValidationError::new(
7016 1001,
7017 "prtry is shorter than the minimum length of 1".to_string(),
7018 ));
7019 }
7020 if val.chars().count() > 35 {
7021 return Err(ValidationError::new(
7022 1002,
7023 "prtry exceeds the maximum length of 35".to_string(),
7024 ));
7025 }
7026 let pattern = Regex::new(
7027 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7028 )
7029 .unwrap();
7030 if !pattern.is_match(val) {
7031 return Err(ValidationError::new(
7032 1005,
7033 "prtry does not match the required pattern".to_string(),
7034 ));
7035 }
7036 }
7037 Ok(())
7038 }
7039}
7040
7041#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7043pub struct TaxAuthorisation11 {
7044 #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
7045 pub titl: Option<String>,
7046 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
7047 pub nm: Option<String>,
7048}
7049
7050impl TaxAuthorisation11 {
7051 pub fn validate(&self) -> Result<(), ValidationError> {
7052 if let Some(ref val) = self.titl {
7053 if val.chars().count() < 1 {
7054 return Err(ValidationError::new(
7055 1001,
7056 "titl is shorter than the minimum length of 1".to_string(),
7057 ));
7058 }
7059 if val.chars().count() > 35 {
7060 return Err(ValidationError::new(
7061 1002,
7062 "titl exceeds the maximum length of 35".to_string(),
7063 ));
7064 }
7065 let pattern = Regex::new(
7066 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7067 )
7068 .unwrap();
7069 if !pattern.is_match(val) {
7070 return Err(ValidationError::new(
7071 1005,
7072 "titl does not match the required pattern".to_string(),
7073 ));
7074 }
7075 }
7076 if let Some(ref val) = self.nm {
7077 if val.chars().count() < 1 {
7078 return Err(ValidationError::new(
7079 1001,
7080 "nm is shorter than the minimum length of 1".to_string(),
7081 ));
7082 }
7083 if val.chars().count() > 140 {
7084 return Err(ValidationError::new(
7085 1002,
7086 "nm exceeds the maximum length of 140".to_string(),
7087 ));
7088 }
7089 let pattern = Regex::new(
7090 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7091 )
7092 .unwrap();
7093 if !pattern.is_match(val) {
7094 return Err(ValidationError::new(
7095 1005,
7096 "nm does not match the required pattern".to_string(),
7097 ));
7098 }
7099 }
7100 Ok(())
7101 }
7102}
7103
7104#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7106pub struct TaxInformation71 {
7107 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
7108 pub cdtr: Option<TaxParty11>,
7109 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
7110 pub dbtr: Option<TaxParty21>,
7111 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
7112 pub ultmt_dbtr: Option<TaxParty21>,
7113 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
7114 pub admstn_zone: Option<String>,
7115 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
7116 pub ref_nb: Option<String>,
7117 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
7118 pub mtd: Option<String>,
7119 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
7120 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
7121 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
7122 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
7123 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
7124 pub dt: Option<String>,
7125 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
7126 pub seq_nb: Option<f64>,
7127 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
7128 pub rcrd: Option<Vec<TaxRecord21>>,
7129}
7130
7131impl TaxInformation71 {
7132 pub fn validate(&self) -> Result<(), ValidationError> {
7133 if let Some(ref val) = self.cdtr {
7134 val.validate()?
7135 }
7136 if let Some(ref val) = self.dbtr {
7137 val.validate()?
7138 }
7139 if let Some(ref val) = self.ultmt_dbtr {
7140 val.validate()?
7141 }
7142 if let Some(ref val) = self.admstn_zone {
7143 if val.chars().count() < 1 {
7144 return Err(ValidationError::new(
7145 1001,
7146 "admstn_zone is shorter than the minimum length of 1".to_string(),
7147 ));
7148 }
7149 if val.chars().count() > 35 {
7150 return Err(ValidationError::new(
7151 1002,
7152 "admstn_zone exceeds the maximum length of 35".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 "admstn_zone does not match the required pattern".to_string(),
7163 ));
7164 }
7165 }
7166 if let Some(ref val) = self.ref_nb {
7167 if val.chars().count() < 1 {
7168 return Err(ValidationError::new(
7169 1001,
7170 "ref_nb is shorter than the minimum length of 1".to_string(),
7171 ));
7172 }
7173 if val.chars().count() > 140 {
7174 return Err(ValidationError::new(
7175 1002,
7176 "ref_nb exceeds the maximum length of 140".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 "ref_nb does not match the required pattern".to_string(),
7187 ));
7188 }
7189 }
7190 if let Some(ref val) = self.mtd {
7191 if val.chars().count() < 1 {
7192 return Err(ValidationError::new(
7193 1001,
7194 "mtd 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 "mtd 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 "mtd does not match the required pattern".to_string(),
7211 ));
7212 }
7213 }
7214 if let Some(ref val) = self.ttl_taxbl_base_amt {
7215 val.validate()?
7216 }
7217 if let Some(ref val) = self.ttl_tax_amt {
7218 val.validate()?
7219 }
7220 if let Some(ref vec) = self.rcrd {
7221 for item in vec {
7222 item.validate()?
7223 }
7224 }
7225 Ok(())
7226 }
7227}
7228
7229#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7231pub struct TaxParty11 {
7232 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
7233 pub tax_id: Option<String>,
7234 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
7235 pub regn_id: Option<String>,
7236 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
7237 pub tax_tp: Option<String>,
7238}
7239
7240impl TaxParty11 {
7241 pub fn validate(&self) -> Result<(), ValidationError> {
7242 if let Some(ref val) = self.tax_id {
7243 if val.chars().count() < 1 {
7244 return Err(ValidationError::new(
7245 1001,
7246 "tax_id is shorter than the minimum length of 1".to_string(),
7247 ));
7248 }
7249 if val.chars().count() > 35 {
7250 return Err(ValidationError::new(
7251 1002,
7252 "tax_id exceeds the maximum length of 35".to_string(),
7253 ));
7254 }
7255 let pattern = Regex::new(
7256 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7257 )
7258 .unwrap();
7259 if !pattern.is_match(val) {
7260 return Err(ValidationError::new(
7261 1005,
7262 "tax_id does not match the required pattern".to_string(),
7263 ));
7264 }
7265 }
7266 if let Some(ref val) = self.regn_id {
7267 if val.chars().count() < 1 {
7268 return Err(ValidationError::new(
7269 1001,
7270 "regn_id is shorter than the minimum length of 1".to_string(),
7271 ));
7272 }
7273 if val.chars().count() > 35 {
7274 return Err(ValidationError::new(
7275 1002,
7276 "regn_id exceeds the maximum length of 35".to_string(),
7277 ));
7278 }
7279 let pattern = Regex::new(
7280 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7281 )
7282 .unwrap();
7283 if !pattern.is_match(val) {
7284 return Err(ValidationError::new(
7285 1005,
7286 "regn_id does not match the required pattern".to_string(),
7287 ));
7288 }
7289 }
7290 if let Some(ref val) = self.tax_tp {
7291 if val.chars().count() < 1 {
7292 return Err(ValidationError::new(
7293 1001,
7294 "tax_tp is shorter than the minimum length of 1".to_string(),
7295 ));
7296 }
7297 if val.chars().count() > 35 {
7298 return Err(ValidationError::new(
7299 1002,
7300 "tax_tp exceeds the maximum length of 35".to_string(),
7301 ));
7302 }
7303 let pattern = Regex::new(
7304 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7305 )
7306 .unwrap();
7307 if !pattern.is_match(val) {
7308 return Err(ValidationError::new(
7309 1005,
7310 "tax_tp does not match the required pattern".to_string(),
7311 ));
7312 }
7313 }
7314 Ok(())
7315 }
7316}
7317
7318#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7320pub struct TaxParty21 {
7321 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
7322 pub tax_id: Option<String>,
7323 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
7324 pub regn_id: Option<String>,
7325 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
7326 pub tax_tp: Option<String>,
7327 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
7328 pub authstn: Option<TaxAuthorisation11>,
7329}
7330
7331impl TaxParty21 {
7332 pub fn validate(&self) -> Result<(), ValidationError> {
7333 if let Some(ref val) = self.tax_id {
7334 if val.chars().count() < 1 {
7335 return Err(ValidationError::new(
7336 1001,
7337 "tax_id is shorter than the minimum length of 1".to_string(),
7338 ));
7339 }
7340 if val.chars().count() > 35 {
7341 return Err(ValidationError::new(
7342 1002,
7343 "tax_id exceeds the maximum length of 35".to_string(),
7344 ));
7345 }
7346 let pattern = Regex::new(
7347 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7348 )
7349 .unwrap();
7350 if !pattern.is_match(val) {
7351 return Err(ValidationError::new(
7352 1005,
7353 "tax_id does not match the required pattern".to_string(),
7354 ));
7355 }
7356 }
7357 if let Some(ref val) = self.regn_id {
7358 if val.chars().count() < 1 {
7359 return Err(ValidationError::new(
7360 1001,
7361 "regn_id is shorter than the minimum length of 1".to_string(),
7362 ));
7363 }
7364 if val.chars().count() > 35 {
7365 return Err(ValidationError::new(
7366 1002,
7367 "regn_id exceeds the maximum length of 35".to_string(),
7368 ));
7369 }
7370 let pattern = Regex::new(
7371 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7372 )
7373 .unwrap();
7374 if !pattern.is_match(val) {
7375 return Err(ValidationError::new(
7376 1005,
7377 "regn_id does not match the required pattern".to_string(),
7378 ));
7379 }
7380 }
7381 if let Some(ref val) = self.tax_tp {
7382 if val.chars().count() < 1 {
7383 return Err(ValidationError::new(
7384 1001,
7385 "tax_tp is shorter than the minimum length of 1".to_string(),
7386 ));
7387 }
7388 if val.chars().count() > 35 {
7389 return Err(ValidationError::new(
7390 1002,
7391 "tax_tp exceeds the maximum length of 35".to_string(),
7392 ));
7393 }
7394 let pattern = Regex::new(
7395 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7396 )
7397 .unwrap();
7398 if !pattern.is_match(val) {
7399 return Err(ValidationError::new(
7400 1005,
7401 "tax_tp does not match the required pattern".to_string(),
7402 ));
7403 }
7404 }
7405 if let Some(ref val) = self.authstn {
7406 val.validate()?
7407 }
7408 Ok(())
7409 }
7410}
7411
7412#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7414pub struct TaxPeriod2 {
7415 #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
7416 pub yr: Option<String>,
7417 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
7418 pub tp: Option<TaxRecordPeriod1Code>,
7419 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
7420 pub fr_to_dt: Option<DatePeriod2>,
7421}
7422
7423impl TaxPeriod2 {
7424 pub fn validate(&self) -> Result<(), ValidationError> {
7425 if let Some(ref val) = self.tp {
7426 val.validate()?
7427 }
7428 if let Some(ref val) = self.fr_to_dt {
7429 val.validate()?
7430 }
7431 Ok(())
7432 }
7433}
7434
7435#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7437pub struct TaxRecord21 {
7438 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
7439 pub tp: Option<String>,
7440 #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
7441 pub ctgy: Option<String>,
7442 #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
7443 pub ctgy_dtls: Option<String>,
7444 #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
7445 pub dbtr_sts: Option<String>,
7446 #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
7447 pub cert_id: Option<String>,
7448 #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
7449 pub frms_cd: Option<String>,
7450 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
7451 pub prd: Option<TaxPeriod2>,
7452 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
7453 pub tax_amt: Option<TaxAmount2>,
7454 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
7455 pub addtl_inf: Option<String>,
7456}
7457
7458impl TaxRecord21 {
7459 pub fn validate(&self) -> Result<(), ValidationError> {
7460 if let Some(ref val) = self.tp {
7461 if val.chars().count() < 1 {
7462 return Err(ValidationError::new(
7463 1001,
7464 "tp is shorter than the minimum length of 1".to_string(),
7465 ));
7466 }
7467 if val.chars().count() > 35 {
7468 return Err(ValidationError::new(
7469 1002,
7470 "tp exceeds the maximum length of 35".to_string(),
7471 ));
7472 }
7473 let pattern = Regex::new(
7474 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7475 )
7476 .unwrap();
7477 if !pattern.is_match(val) {
7478 return Err(ValidationError::new(
7479 1005,
7480 "tp does not match the required pattern".to_string(),
7481 ));
7482 }
7483 }
7484 if let Some(ref val) = self.ctgy {
7485 if val.chars().count() < 1 {
7486 return Err(ValidationError::new(
7487 1001,
7488 "ctgy is shorter than the minimum length of 1".to_string(),
7489 ));
7490 }
7491 if val.chars().count() > 35 {
7492 return Err(ValidationError::new(
7493 1002,
7494 "ctgy exceeds the maximum length of 35".to_string(),
7495 ));
7496 }
7497 let pattern = Regex::new(
7498 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7499 )
7500 .unwrap();
7501 if !pattern.is_match(val) {
7502 return Err(ValidationError::new(
7503 1005,
7504 "ctgy does not match the required pattern".to_string(),
7505 ));
7506 }
7507 }
7508 if let Some(ref val) = self.ctgy_dtls {
7509 if val.chars().count() < 1 {
7510 return Err(ValidationError::new(
7511 1001,
7512 "ctgy_dtls is shorter than the minimum length of 1".to_string(),
7513 ));
7514 }
7515 if val.chars().count() > 35 {
7516 return Err(ValidationError::new(
7517 1002,
7518 "ctgy_dtls exceeds the maximum length of 35".to_string(),
7519 ));
7520 }
7521 let pattern = Regex::new(
7522 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7523 )
7524 .unwrap();
7525 if !pattern.is_match(val) {
7526 return Err(ValidationError::new(
7527 1005,
7528 "ctgy_dtls does not match the required pattern".to_string(),
7529 ));
7530 }
7531 }
7532 if let Some(ref val) = self.dbtr_sts {
7533 if val.chars().count() < 1 {
7534 return Err(ValidationError::new(
7535 1001,
7536 "dbtr_sts is shorter than the minimum length of 1".to_string(),
7537 ));
7538 }
7539 if val.chars().count() > 35 {
7540 return Err(ValidationError::new(
7541 1002,
7542 "dbtr_sts exceeds the maximum length of 35".to_string(),
7543 ));
7544 }
7545 let pattern = Regex::new(
7546 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7547 )
7548 .unwrap();
7549 if !pattern.is_match(val) {
7550 return Err(ValidationError::new(
7551 1005,
7552 "dbtr_sts does not match the required pattern".to_string(),
7553 ));
7554 }
7555 }
7556 if let Some(ref val) = self.cert_id {
7557 if val.chars().count() < 1 {
7558 return Err(ValidationError::new(
7559 1001,
7560 "cert_id is shorter than the minimum length of 1".to_string(),
7561 ));
7562 }
7563 if val.chars().count() > 35 {
7564 return Err(ValidationError::new(
7565 1002,
7566 "cert_id exceeds the maximum length of 35".to_string(),
7567 ));
7568 }
7569 let pattern = Regex::new(
7570 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7571 )
7572 .unwrap();
7573 if !pattern.is_match(val) {
7574 return Err(ValidationError::new(
7575 1005,
7576 "cert_id does not match the required pattern".to_string(),
7577 ));
7578 }
7579 }
7580 if let Some(ref val) = self.frms_cd {
7581 if val.chars().count() < 1 {
7582 return Err(ValidationError::new(
7583 1001,
7584 "frms_cd is shorter than the minimum length of 1".to_string(),
7585 ));
7586 }
7587 if val.chars().count() > 35 {
7588 return Err(ValidationError::new(
7589 1002,
7590 "frms_cd exceeds the maximum length of 35".to_string(),
7591 ));
7592 }
7593 let pattern = Regex::new(
7594 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7595 )
7596 .unwrap();
7597 if !pattern.is_match(val) {
7598 return Err(ValidationError::new(
7599 1005,
7600 "frms_cd does not match the required pattern".to_string(),
7601 ));
7602 }
7603 }
7604 if let Some(ref val) = self.prd {
7605 val.validate()?
7606 }
7607 if let Some(ref val) = self.tax_amt {
7608 val.validate()?
7609 }
7610 if let Some(ref val) = self.addtl_inf {
7611 if val.chars().count() < 1 {
7612 return Err(ValidationError::new(
7613 1001,
7614 "addtl_inf is shorter than the minimum length of 1".to_string(),
7615 ));
7616 }
7617 if val.chars().count() > 140 {
7618 return Err(ValidationError::new(
7619 1002,
7620 "addtl_inf exceeds the maximum length of 140".to_string(),
7621 ));
7622 }
7623 let pattern = Regex::new(
7624 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
7625 )
7626 .unwrap();
7627 if !pattern.is_match(val) {
7628 return Err(ValidationError::new(
7629 1005,
7630 "addtl_inf does not match the required pattern".to_string(),
7631 ));
7632 }
7633 }
7634 Ok(())
7635 }
7636}
7637
7638#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7640pub struct TaxRecordDetails2 {
7641 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
7642 pub prd: Option<TaxPeriod2>,
7643 #[serde(rename = "Amt")]
7644 pub amt: ActiveOrHistoricCurrencyAndAmount,
7645}
7646
7647impl TaxRecordDetails2 {
7648 pub fn validate(&self) -> Result<(), ValidationError> {
7649 if let Some(ref val) = self.prd {
7650 val.validate()?
7651 }
7652 self.amt.validate()?;
7653 Ok(())
7654 }
7655}
7656
7657#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7659pub enum TaxRecordPeriod1Code {
7660 #[default]
7661 #[serde(rename = "MM01")]
7662 CodeMM01,
7663 #[serde(rename = "MM02")]
7664 CodeMM02,
7665 #[serde(rename = "MM03")]
7666 CodeMM03,
7667 #[serde(rename = "MM04")]
7668 CodeMM04,
7669 #[serde(rename = "MM05")]
7670 CodeMM05,
7671 #[serde(rename = "MM06")]
7672 CodeMM06,
7673 #[serde(rename = "MM07")]
7674 CodeMM07,
7675 #[serde(rename = "MM08")]
7676 CodeMM08,
7677 #[serde(rename = "MM09")]
7678 CodeMM09,
7679 #[serde(rename = "MM10")]
7680 CodeMM10,
7681 #[serde(rename = "MM11")]
7682 CodeMM11,
7683 #[serde(rename = "MM12")]
7684 CodeMM12,
7685 #[serde(rename = "QTR1")]
7686 CodeQTR1,
7687 #[serde(rename = "QTR2")]
7688 CodeQTR2,
7689 #[serde(rename = "QTR3")]
7690 CodeQTR3,
7691 #[serde(rename = "QTR4")]
7692 CodeQTR4,
7693 #[serde(rename = "HLF1")]
7694 CodeHLF1,
7695 #[serde(rename = "HLF2")]
7696 CodeHLF2,
7697}
7698
7699impl TaxRecordPeriod1Code {
7700 pub fn validate(&self) -> Result<(), ValidationError> {
7701 Ok(())
7702 }
7703}
7704
7705#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
7707pub struct TransactionParties71 {
7708 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
7709 pub ultmt_dbtr: Option<Party40Choice1>,
7710 #[serde(rename = "Dbtr")]
7711 pub dbtr: Party40Choice2,
7712 #[serde(rename = "InitgPty", skip_serializing_if = "Option::is_none")]
7713 pub initg_pty: Option<Party40Choice1>,
7714 #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
7715 pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
7716 #[serde(rename = "PrvsInstgAgt1", skip_serializing_if = "Option::is_none")]
7717 pub prvs_instg_agt1: Option<BranchAndFinancialInstitutionIdentification61>,
7718 #[serde(rename = "PrvsInstgAgt2", skip_serializing_if = "Option::is_none")]
7719 pub prvs_instg_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
7720 #[serde(rename = "PrvsInstgAgt3", skip_serializing_if = "Option::is_none")]
7721 pub prvs_instg_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
7722 #[serde(rename = "IntrmyAgt1", skip_serializing_if = "Option::is_none")]
7723 pub intrmy_agt1: Option<BranchAndFinancialInstitutionIdentification61>,
7724 #[serde(rename = "IntrmyAgt2", skip_serializing_if = "Option::is_none")]
7725 pub intrmy_agt2: Option<BranchAndFinancialInstitutionIdentification61>,
7726 #[serde(rename = "IntrmyAgt3", skip_serializing_if = "Option::is_none")]
7727 pub intrmy_agt3: Option<BranchAndFinancialInstitutionIdentification61>,
7728 #[serde(rename = "CdtrAgt", skip_serializing_if = "Option::is_none")]
7729 pub cdtr_agt: Option<BranchAndFinancialInstitutionIdentification63>,
7730 #[serde(rename = "Cdtr")]
7731 pub cdtr: Party40Choice3,
7732 #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
7733 pub ultmt_cdtr: Option<Party40Choice1>,
7734}
7735
7736impl TransactionParties71 {
7737 pub fn validate(&self) -> Result<(), ValidationError> {
7738 if let Some(ref val) = self.ultmt_dbtr {
7739 val.validate()?
7740 }
7741 self.dbtr.validate()?;
7742 if let Some(ref val) = self.initg_pty {
7743 val.validate()?
7744 }
7745 if let Some(ref val) = self.dbtr_agt {
7746 val.validate()?
7747 }
7748 if let Some(ref val) = self.prvs_instg_agt1 {
7749 val.validate()?
7750 }
7751 if let Some(ref val) = self.prvs_instg_agt2 {
7752 val.validate()?
7753 }
7754 if let Some(ref val) = self.prvs_instg_agt3 {
7755 val.validate()?
7756 }
7757 if let Some(ref val) = self.intrmy_agt1 {
7758 val.validate()?
7759 }
7760 if let Some(ref val) = self.intrmy_agt2 {
7761 val.validate()?
7762 }
7763 if let Some(ref val) = self.intrmy_agt3 {
7764 val.validate()?
7765 }
7766 if let Some(ref val) = self.cdtr_agt {
7767 val.validate()?
7768 }
7769 self.cdtr.validate()?;
7770 if let Some(ref val) = self.ultmt_cdtr {
7771 val.validate()?
7772 }
7773 Ok(())
7774 }
7775}