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 AccountSchemeName1Choice {
54 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
55 pub cd: Option<String>,
56 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
57 pub prtry: Option<String>,
58}
59
60impl AccountSchemeName1Choice {
61 pub fn validate(&self) -> Result<(), ValidationError> {
62 if let Some(ref val) = self.cd {
63 if val.chars().count() < 1 {
64 return Err(ValidationError::new(
65 1001,
66 "cd is shorter than the minimum length of 1".to_string(),
67 ));
68 }
69 if val.chars().count() > 4 {
70 return Err(ValidationError::new(
71 1002,
72 "cd exceeds the maximum length of 4".to_string(),
73 ));
74 }
75 }
76 if let Some(ref val) = self.prtry {
77 if val.chars().count() < 1 {
78 return Err(ValidationError::new(
79 1001,
80 "prtry is shorter than the minimum length of 1".to_string(),
81 ));
82 }
83 if val.chars().count() > 35 {
84 return Err(ValidationError::new(
85 1002,
86 "prtry exceeds the maximum length of 35".to_string(),
87 ));
88 }
89 }
90 Ok(())
91 }
92}
93
94#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
96pub struct ActiveOrHistoricCurrencyAndAmount {
97 #[serde(rename = "@Ccy")]
98 pub ccy: String,
99 #[serde(rename = "$value")]
100 pub value: f64,
101}
102
103impl ActiveOrHistoricCurrencyAndAmount {
104 pub fn validate(&self) -> Result<(), ValidationError> {
105 Ok(())
106 }
107}
108
109#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
111pub enum AddressType2Code {
112 #[default]
113 #[serde(rename = "ADDR")]
114 CodeADDR,
115 #[serde(rename = "PBOX")]
116 CodePBOX,
117 #[serde(rename = "HOME")]
118 CodeHOME,
119 #[serde(rename = "BIZZ")]
120 CodeBIZZ,
121 #[serde(rename = "MLTO")]
122 CodeMLTO,
123 #[serde(rename = "DLVY")]
124 CodeDLVY,
125}
126
127impl AddressType2Code {
128 pub fn validate(&self) -> Result<(), ValidationError> {
129 Ok(())
130 }
131}
132
133#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
135pub struct AddressType3Choice {
136 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
137 pub cd: Option<AddressType2Code>,
138 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
139 pub prtry: Option<GenericIdentification30>,
140}
141
142impl AddressType3Choice {
143 pub fn validate(&self) -> Result<(), ValidationError> {
144 if let Some(ref val) = self.cd {
145 val.validate()?
146 }
147 if let Some(ref val) = self.prtry {
148 val.validate()?
149 }
150 Ok(())
151 }
152}
153
154#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
156pub struct AmendmentInformationDetails131 {
157 #[serde(rename = "OrgnlMndtId", skip_serializing_if = "Option::is_none")]
158 pub orgnl_mndt_id: Option<String>,
159 #[serde(rename = "OrgnlCdtrSchmeId", skip_serializing_if = "Option::is_none")]
160 pub orgnl_cdtr_schme_id: Option<PartyIdentification135>,
161 #[serde(rename = "OrgnlCdtrAgt", skip_serializing_if = "Option::is_none")]
162 pub orgnl_cdtr_agt: Option<BranchAndFinancialInstitutionIdentification64>,
163 #[serde(rename = "OrgnlCdtrAgtAcct", skip_serializing_if = "Option::is_none")]
164 pub orgnl_cdtr_agt_acct: Option<CashAccount38>,
165 #[serde(rename = "OrgnlDbtr", skip_serializing_if = "Option::is_none")]
166 pub orgnl_dbtr: Option<PartyIdentification135>,
167 #[serde(rename = "OrgnlDbtrAcct", skip_serializing_if = "Option::is_none")]
168 pub orgnl_dbtr_acct: Option<CashAccount381>,
169 #[serde(rename = "OrgnlDbtrAgt", skip_serializing_if = "Option::is_none")]
170 pub orgnl_dbtr_agt: Option<BranchAndFinancialInstitutionIdentification65>,
171 #[serde(rename = "OrgnlDbtrAgtAcct", skip_serializing_if = "Option::is_none")]
172 pub orgnl_dbtr_agt_acct: Option<CashAccount38>,
173 #[serde(rename = "OrgnlFnlColltnDt", skip_serializing_if = "Option::is_none")]
174 pub orgnl_fnl_colltn_dt: Option<String>,
175 #[serde(rename = "OrgnlFrqcy", skip_serializing_if = "Option::is_none")]
176 pub orgnl_frqcy: Option<Frequency36Choice>,
177 #[serde(rename = "OrgnlRsn", skip_serializing_if = "Option::is_none")]
178 pub orgnl_rsn: Option<MandateSetupReason1Choice>,
179 #[serde(rename = "OrgnlTrckgDays", skip_serializing_if = "Option::is_none")]
180 pub orgnl_trckg_days: Option<String>,
181}
182
183impl AmendmentInformationDetails131 {
184 pub fn validate(&self) -> Result<(), ValidationError> {
185 if let Some(ref val) = self.orgnl_mndt_id {
186 if val.chars().count() < 1 {
187 return Err(ValidationError::new(
188 1001,
189 "orgnl_mndt_id is shorter than the minimum length of 1".to_string(),
190 ));
191 }
192 if val.chars().count() > 35 {
193 return Err(ValidationError::new(
194 1002,
195 "orgnl_mndt_id exceeds the maximum length of 35".to_string(),
196 ));
197 }
198 }
199 if let Some(ref val) = self.orgnl_cdtr_schme_id {
200 val.validate()?
201 }
202 if let Some(ref val) = self.orgnl_cdtr_agt {
203 val.validate()?
204 }
205 if let Some(ref val) = self.orgnl_cdtr_agt_acct {
206 val.validate()?
207 }
208 if let Some(ref val) = self.orgnl_dbtr {
209 val.validate()?
210 }
211 if let Some(ref val) = self.orgnl_dbtr_acct {
212 val.validate()?
213 }
214 if let Some(ref val) = self.orgnl_dbtr_agt {
215 val.validate()?
216 }
217 if let Some(ref val) = self.orgnl_dbtr_agt_acct {
218 val.validate()?
219 }
220 if let Some(ref val) = self.orgnl_frqcy {
221 val.validate()?
222 }
223 if let Some(ref val) = self.orgnl_rsn {
224 val.validate()?
225 }
226 if let Some(ref val) = self.orgnl_trckg_days {
227 let pattern = Regex::new("[0-9]{2}").unwrap();
228 if !pattern.is_match(val) {
229 return Err(ValidationError::new(
230 1005,
231 "orgnl_trckg_days does not match the required pattern".to_string(),
232 ));
233 }
234 }
235 Ok(())
236 }
237}
238
239#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
241pub struct Authorisation1Choice {
242 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
243 pub cd: Option<Authorisation1Code>,
244 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
245 pub prtry: Option<String>,
246}
247
248impl Authorisation1Choice {
249 pub fn validate(&self) -> Result<(), ValidationError> {
250 if let Some(ref val) = self.cd {
251 val.validate()?
252 }
253 if let Some(ref val) = self.prtry {
254 if val.chars().count() < 1 {
255 return Err(ValidationError::new(
256 1001,
257 "prtry is shorter than the minimum length of 1".to_string(),
258 ));
259 }
260 if val.chars().count() > 128 {
261 return Err(ValidationError::new(
262 1002,
263 "prtry exceeds the maximum length of 128".to_string(),
264 ));
265 }
266 }
267 Ok(())
268 }
269}
270
271#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
273pub enum Authorisation1Code {
274 #[default]
275 #[serde(rename = "AUTH")]
276 CodeAUTH,
277 #[serde(rename = "FDET")]
278 CodeFDET,
279 #[serde(rename = "FSUM")]
280 CodeFSUM,
281 #[serde(rename = "ILEV")]
282 CodeILEV,
283}
284
285impl Authorisation1Code {
286 pub fn validate(&self) -> Result<(), ValidationError> {
287 Ok(())
288 }
289}
290
291#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
293pub struct BranchAndFinancialInstitutionIdentification61 {
294 #[serde(rename = "FinInstnId")]
295 pub fin_instn_id: FinancialInstitutionIdentification181,
296}
297
298impl BranchAndFinancialInstitutionIdentification61 {
299 pub fn validate(&self) -> Result<(), ValidationError> {
300 self.fin_instn_id.validate()?;
301 Ok(())
302 }
303}
304
305#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
307pub struct BranchAndFinancialInstitutionIdentification62 {
308 #[serde(rename = "FinInstnId")]
309 pub fin_instn_id: FinancialInstitutionIdentification182,
310}
311
312impl BranchAndFinancialInstitutionIdentification62 {
313 pub fn validate(&self) -> Result<(), ValidationError> {
314 self.fin_instn_id.validate()?;
315 Ok(())
316 }
317}
318
319#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
321pub struct BranchAndFinancialInstitutionIdentification63 {
322 #[serde(rename = "FinInstnId")]
323 pub fin_instn_id: FinancialInstitutionIdentification183,
324}
325
326impl BranchAndFinancialInstitutionIdentification63 {
327 pub fn validate(&self) -> Result<(), ValidationError> {
328 self.fin_instn_id.validate()?;
329 Ok(())
330 }
331}
332
333#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
335pub struct BranchAndFinancialInstitutionIdentification64 {
336 #[serde(rename = "FinInstnId")]
337 pub fin_instn_id: FinancialInstitutionIdentification184,
338}
339
340impl BranchAndFinancialInstitutionIdentification64 {
341 pub fn validate(&self) -> Result<(), ValidationError> {
342 self.fin_instn_id.validate()?;
343 Ok(())
344 }
345}
346
347#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
349pub struct BranchAndFinancialInstitutionIdentification65 {
350 #[serde(rename = "FinInstnId")]
351 pub fin_instn_id: FinancialInstitutionIdentification18,
352}
353
354impl BranchAndFinancialInstitutionIdentification65 {
355 pub fn validate(&self) -> Result<(), ValidationError> {
356 self.fin_instn_id.validate()?;
357 Ok(())
358 }
359}
360
361#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
363pub struct CashAccount38 {
364 #[serde(rename = "Id")]
365 pub id: AccountIdentification4Choice,
366 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
367 pub tp: Option<CashAccountType2Choice>,
368 #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
369 pub ccy: Option<String>,
370 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
371 pub nm: Option<String>,
372 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
373 pub prxy: Option<ProxyAccountIdentification1>,
374}
375
376impl CashAccount38 {
377 pub fn validate(&self) -> Result<(), ValidationError> {
378 self.id.validate()?;
379 if let Some(ref val) = self.tp {
380 val.validate()?
381 }
382 if let Some(ref val) = self.ccy {
383 let pattern = Regex::new("[A-Z]{3,3}").unwrap();
384 if !pattern.is_match(val) {
385 return Err(ValidationError::new(
386 1005,
387 "ccy does not match the required pattern".to_string(),
388 ));
389 }
390 }
391 if let Some(ref val) = self.nm {
392 if val.chars().count() < 1 {
393 return Err(ValidationError::new(
394 1001,
395 "nm is shorter than the minimum length of 1".to_string(),
396 ));
397 }
398 if val.chars().count() > 70 {
399 return Err(ValidationError::new(
400 1002,
401 "nm exceeds the maximum length of 70".to_string(),
402 ));
403 }
404 }
405 if let Some(ref val) = self.prxy {
406 val.validate()?
407 }
408 Ok(())
409 }
410}
411
412#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
414pub struct CashAccount381 {
415 #[serde(rename = "Id")]
416 pub id: AccountIdentification4Choice,
417 #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
418 pub prxy: Option<ProxyAccountIdentification1>,
419}
420
421impl CashAccount381 {
422 pub fn validate(&self) -> Result<(), ValidationError> {
423 self.id.validate()?;
424 if let Some(ref val) = self.prxy {
425 val.validate()?
426 }
427 Ok(())
428 }
429}
430
431#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
433pub struct CashAccountType2Choice {
434 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
435 pub cd: Option<String>,
436 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
437 pub prtry: Option<String>,
438}
439
440impl CashAccountType2Choice {
441 pub fn validate(&self) -> Result<(), ValidationError> {
442 if let Some(ref val) = self.cd {
443 if val.chars().count() < 1 {
444 return Err(ValidationError::new(
445 1001,
446 "cd is shorter than the minimum length of 1".to_string(),
447 ));
448 }
449 if val.chars().count() > 4 {
450 return Err(ValidationError::new(
451 1002,
452 "cd exceeds the maximum length of 4".to_string(),
453 ));
454 }
455 }
456 if let Some(ref val) = self.prtry {
457 if val.chars().count() < 1 {
458 return Err(ValidationError::new(
459 1001,
460 "prtry is shorter than the minimum length of 1".to_string(),
461 ));
462 }
463 if val.chars().count() > 35 {
464 return Err(ValidationError::new(
465 1002,
466 "prtry exceeds the maximum length of 35".to_string(),
467 ));
468 }
469 }
470 Ok(())
471 }
472}
473
474#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
476pub struct CategoryPurpose1Choice {
477 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
478 pub cd: Option<String>,
479 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
480 pub prtry: Option<String>,
481}
482
483impl CategoryPurpose1Choice {
484 pub fn validate(&self) -> Result<(), ValidationError> {
485 if let Some(ref val) = self.cd {
486 if val.chars().count() < 1 {
487 return Err(ValidationError::new(
488 1001,
489 "cd is shorter than the minimum length of 1".to_string(),
490 ));
491 }
492 if val.chars().count() > 4 {
493 return Err(ValidationError::new(
494 1002,
495 "cd exceeds the maximum length of 4".to_string(),
496 ));
497 }
498 }
499 if let Some(ref val) = self.prtry {
500 if val.chars().count() < 1 {
501 return Err(ValidationError::new(
502 1001,
503 "prtry is shorter than the minimum length of 1".to_string(),
504 ));
505 }
506 if val.chars().count() > 35 {
507 return Err(ValidationError::new(
508 1002,
509 "prtry exceeds the maximum length of 35".to_string(),
510 ));
511 }
512 }
513 Ok(())
514 }
515}
516
517#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
519pub enum ChargeBearerType1Code1 {
520 #[default]
521 #[serde(rename = "DEBT")]
522 CodeDEBT,
523 #[serde(rename = "CRED")]
524 CodeCRED,
525 #[serde(rename = "SHAR")]
526 CodeSHAR,
527}
528
529impl ChargeBearerType1Code1 {
530 pub fn validate(&self) -> Result<(), ValidationError> {
531 Ok(())
532 }
533}
534
535#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
537pub struct ClearingSystemIdentification2Choice {
538 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
539 pub cd: Option<String>,
540 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
541 pub prtry: Option<String>,
542}
543
544impl ClearingSystemIdentification2Choice {
545 pub fn validate(&self) -> Result<(), ValidationError> {
546 if let Some(ref val) = self.cd {
547 if val.chars().count() < 1 {
548 return Err(ValidationError::new(
549 1001,
550 "cd is shorter than the minimum length of 1".to_string(),
551 ));
552 }
553 if val.chars().count() > 5 {
554 return Err(ValidationError::new(
555 1002,
556 "cd exceeds the maximum length of 5".to_string(),
557 ));
558 }
559 }
560 if let Some(ref val) = self.prtry {
561 if val.chars().count() < 1 {
562 return Err(ValidationError::new(
563 1001,
564 "prtry is shorter than the minimum length of 1".to_string(),
565 ));
566 }
567 if val.chars().count() > 35 {
568 return Err(ValidationError::new(
569 1002,
570 "prtry exceeds the maximum length of 35".to_string(),
571 ));
572 }
573 }
574 Ok(())
575 }
576}
577
578#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
580pub struct ClearingSystemIdentification2Choice1 {
581 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
582 pub cd: Option<String>,
583}
584
585impl ClearingSystemIdentification2Choice1 {
586 pub fn validate(&self) -> Result<(), ValidationError> {
587 if let Some(ref val) = self.cd {
588 if val.chars().count() < 1 {
589 return Err(ValidationError::new(
590 1001,
591 "cd is shorter than the minimum length of 1".to_string(),
592 ));
593 }
594 if val.chars().count() > 5 {
595 return Err(ValidationError::new(
596 1002,
597 "cd exceeds the maximum length of 5".to_string(),
598 ));
599 }
600 }
601 Ok(())
602 }
603}
604
605#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
607pub struct ClearingSystemMemberIdentification2 {
608 #[serde(rename = "ClrSysId", skip_serializing_if = "Option::is_none")]
609 pub clr_sys_id: Option<ClearingSystemIdentification2Choice>,
610 #[serde(rename = "MmbId")]
611 pub mmb_id: String,
612}
613
614impl ClearingSystemMemberIdentification2 {
615 pub fn validate(&self) -> Result<(), ValidationError> {
616 if let Some(ref val) = self.clr_sys_id {
617 val.validate()?
618 }
619 if self.mmb_id.chars().count() < 1 {
620 return Err(ValidationError::new(
621 1001,
622 "mmb_id is shorter than the minimum length of 1".to_string(),
623 ));
624 }
625 if self.mmb_id.chars().count() > 35 {
626 return Err(ValidationError::new(
627 1002,
628 "mmb_id exceeds the maximum length of 35".to_string(),
629 ));
630 }
631 Ok(())
632 }
633}
634
635#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
637pub struct ClearingSystemMemberIdentification21 {
638 #[serde(rename = "ClrSysId")]
639 pub clr_sys_id: ClearingSystemIdentification2Choice1,
640 #[serde(rename = "MmbId")]
641 pub mmb_id: String,
642}
643
644impl ClearingSystemMemberIdentification21 {
645 pub fn validate(&self) -> Result<(), ValidationError> {
646 self.clr_sys_id.validate()?;
647 if self.mmb_id.chars().count() < 1 {
648 return Err(ValidationError::new(
649 1001,
650 "mmb_id is shorter than the minimum length of 1".to_string(),
651 ));
652 }
653 if self.mmb_id.chars().count() > 35 {
654 return Err(ValidationError::new(
655 1002,
656 "mmb_id exceeds the maximum length of 35".to_string(),
657 ));
658 }
659 Ok(())
660 }
661}
662
663#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
665pub struct Contact4 {
666 #[serde(rename = "NmPrfx", skip_serializing_if = "Option::is_none")]
667 pub nm_prfx: Option<NamePrefix2Code>,
668 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
669 pub nm: Option<String>,
670 #[serde(rename = "PhneNb", skip_serializing_if = "Option::is_none")]
671 pub phne_nb: Option<String>,
672 #[serde(rename = "MobNb", skip_serializing_if = "Option::is_none")]
673 pub mob_nb: Option<String>,
674 #[serde(rename = "FaxNb", skip_serializing_if = "Option::is_none")]
675 pub fax_nb: Option<String>,
676 #[serde(rename = "EmailAdr", skip_serializing_if = "Option::is_none")]
677 pub email_adr: Option<String>,
678 #[serde(rename = "EmailPurp", skip_serializing_if = "Option::is_none")]
679 pub email_purp: Option<String>,
680 #[serde(rename = "JobTitl", skip_serializing_if = "Option::is_none")]
681 pub job_titl: Option<String>,
682 #[serde(rename = "Rspnsblty", skip_serializing_if = "Option::is_none")]
683 pub rspnsblty: Option<String>,
684 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
685 pub dept: Option<String>,
686 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
687 pub othr: Option<Vec<OtherContact1>>,
688 #[serde(rename = "PrefrdMtd", skip_serializing_if = "Option::is_none")]
689 pub prefrd_mtd: Option<PreferredContactMethod1Code>,
690}
691
692impl Contact4 {
693 pub fn validate(&self) -> Result<(), ValidationError> {
694 if let Some(ref val) = self.nm_prfx {
695 val.validate()?
696 }
697 if let Some(ref val) = self.nm {
698 if val.chars().count() < 1 {
699 return Err(ValidationError::new(
700 1001,
701 "nm is shorter than the minimum length of 1".to_string(),
702 ));
703 }
704 if val.chars().count() > 140 {
705 return Err(ValidationError::new(
706 1002,
707 "nm exceeds the maximum length of 140".to_string(),
708 ));
709 }
710 }
711 if let Some(ref val) = self.phne_nb {
712 let pattern = Regex::new("\\+[0-9]{1,3}-[0-9()+\\-]{1,30}").unwrap();
713 if !pattern.is_match(val) {
714 return Err(ValidationError::new(
715 1005,
716 "phne_nb does not match the required pattern".to_string(),
717 ));
718 }
719 }
720 if let Some(ref val) = self.mob_nb {
721 let pattern = Regex::new("\\+[0-9]{1,3}-[0-9()+\\-]{1,30}").unwrap();
722 if !pattern.is_match(val) {
723 return Err(ValidationError::new(
724 1005,
725 "mob_nb does not match the required pattern".to_string(),
726 ));
727 }
728 }
729 if let Some(ref val) = self.fax_nb {
730 let pattern = Regex::new("\\+[0-9]{1,3}-[0-9()+\\-]{1,30}").unwrap();
731 if !pattern.is_match(val) {
732 return Err(ValidationError::new(
733 1005,
734 "fax_nb does not match the required pattern".to_string(),
735 ));
736 }
737 }
738 if let Some(ref val) = self.email_adr {
739 if val.chars().count() < 1 {
740 return Err(ValidationError::new(
741 1001,
742 "email_adr is shorter than the minimum length of 1".to_string(),
743 ));
744 }
745 if val.chars().count() > 2048 {
746 return Err(ValidationError::new(
747 1002,
748 "email_adr exceeds the maximum length of 2048".to_string(),
749 ));
750 }
751 }
752 if let Some(ref val) = self.email_purp {
753 if val.chars().count() < 1 {
754 return Err(ValidationError::new(
755 1001,
756 "email_purp is shorter than the minimum length of 1".to_string(),
757 ));
758 }
759 if val.chars().count() > 35 {
760 return Err(ValidationError::new(
761 1002,
762 "email_purp exceeds the maximum length of 35".to_string(),
763 ));
764 }
765 }
766 if let Some(ref val) = self.job_titl {
767 if val.chars().count() < 1 {
768 return Err(ValidationError::new(
769 1001,
770 "job_titl is shorter than the minimum length of 1".to_string(),
771 ));
772 }
773 if val.chars().count() > 35 {
774 return Err(ValidationError::new(
775 1002,
776 "job_titl exceeds the maximum length of 35".to_string(),
777 ));
778 }
779 }
780 if let Some(ref val) = self.rspnsblty {
781 if val.chars().count() < 1 {
782 return Err(ValidationError::new(
783 1001,
784 "rspnsblty is shorter than the minimum length of 1".to_string(),
785 ));
786 }
787 if val.chars().count() > 35 {
788 return Err(ValidationError::new(
789 1002,
790 "rspnsblty exceeds the maximum length of 35".to_string(),
791 ));
792 }
793 }
794 if let Some(ref val) = self.dept {
795 if val.chars().count() < 1 {
796 return Err(ValidationError::new(
797 1001,
798 "dept is shorter than the minimum length of 1".to_string(),
799 ));
800 }
801 if val.chars().count() > 70 {
802 return Err(ValidationError::new(
803 1002,
804 "dept exceeds the maximum length of 70".to_string(),
805 ));
806 }
807 }
808 if let Some(ref vec) = self.othr {
809 for item in vec {
810 item.validate()?
811 }
812 }
813 if let Some(ref val) = self.prefrd_mtd {
814 val.validate()?
815 }
816 Ok(())
817 }
818}
819
820#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
822pub enum CreditDebitCode {
823 #[default]
824 #[serde(rename = "CRDT")]
825 CodeCRDT,
826 #[serde(rename = "DBIT")]
827 CodeDBIT,
828}
829
830impl CreditDebitCode {
831 pub fn validate(&self) -> Result<(), ValidationError> {
832 Ok(())
833 }
834}
835
836#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
842pub struct CreditorReferenceInformation2 {
843 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
844 pub tp: Option<CreditorReferenceType2>,
845 #[serde(rename = "Ref", skip_serializing_if = "Option::is_none")]
846 pub ref_attr: Option<String>,
847}
848
849impl CreditorReferenceInformation2 {
850 pub fn validate(&self) -> Result<(), ValidationError> {
851 if let Some(ref val) = self.tp {
852 val.validate()?
853 }
854 if let Some(ref val) = self.ref_attr {
855 if val.chars().count() < 1 {
856 return Err(ValidationError::new(
857 1001,
858 "ref_attr is shorter than the minimum length of 1".to_string(),
859 ));
860 }
861 if val.chars().count() > 35 {
862 return Err(ValidationError::new(
863 1002,
864 "ref_attr exceeds the maximum length of 35".to_string(),
865 ));
866 }
867 }
868 Ok(())
869 }
870}
871
872#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
874pub struct CreditorReferenceType1Choice {
875 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
876 pub cd: Option<DocumentType3Code>,
877 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
878 pub prtry: Option<String>,
879}
880
881impl CreditorReferenceType1Choice {
882 pub fn validate(&self) -> Result<(), ValidationError> {
883 if let Some(ref val) = self.cd {
884 val.validate()?
885 }
886 if let Some(ref val) = self.prtry {
887 if val.chars().count() < 1 {
888 return Err(ValidationError::new(
889 1001,
890 "prtry is shorter than the minimum length of 1".to_string(),
891 ));
892 }
893 if val.chars().count() > 35 {
894 return Err(ValidationError::new(
895 1002,
896 "prtry exceeds the maximum length of 35".to_string(),
897 ));
898 }
899 }
900 Ok(())
901 }
902}
903
904#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
906pub struct CreditorReferenceType2 {
907 #[serde(rename = "CdOrPrtry")]
908 pub cd_or_prtry: CreditorReferenceType1Choice,
909 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
910 pub issr: Option<String>,
911}
912
913impl CreditorReferenceType2 {
914 pub fn validate(&self) -> Result<(), ValidationError> {
915 self.cd_or_prtry.validate()?;
916 if let Some(ref val) = self.issr {
917 if val.chars().count() < 1 {
918 return Err(ValidationError::new(
919 1001,
920 "issr is shorter than the minimum length of 1".to_string(),
921 ));
922 }
923 if val.chars().count() > 35 {
924 return Err(ValidationError::new(
925 1002,
926 "issr exceeds the maximum length of 35".to_string(),
927 ));
928 }
929 }
930 Ok(())
931 }
932}
933
934#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
936pub struct CustomerDirectDebitInitiationV08 {
937 #[serde(rename = "GrpHdr")]
938 pub grp_hdr: GroupHeader831,
939 #[serde(rename = "PmtInf")]
940 pub pmt_inf: PaymentInstruction291,
941}
942
943impl CustomerDirectDebitInitiationV08 {
944 pub fn validate(&self) -> Result<(), ValidationError> {
945 self.grp_hdr.validate()?;
946 self.pmt_inf.validate()?;
947 Ok(())
948 }
949}
950
951#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
953pub struct DateAndPlaceOfBirth1 {
954 #[serde(rename = "BirthDt")]
955 pub birth_dt: String,
956 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
957 pub prvc_of_birth: Option<String>,
958 #[serde(rename = "CityOfBirth")]
959 pub city_of_birth: String,
960 #[serde(rename = "CtryOfBirth")]
961 pub ctry_of_birth: String,
962}
963
964impl DateAndPlaceOfBirth1 {
965 pub fn validate(&self) -> Result<(), ValidationError> {
966 if let Some(ref val) = self.prvc_of_birth {
967 if val.chars().count() < 1 {
968 return Err(ValidationError::new(
969 1001,
970 "prvc_of_birth is shorter than the minimum length of 1".to_string(),
971 ));
972 }
973 if val.chars().count() > 35 {
974 return Err(ValidationError::new(
975 1002,
976 "prvc_of_birth exceeds the maximum length of 35".to_string(),
977 ));
978 }
979 }
980 if self.city_of_birth.chars().count() < 1 {
981 return Err(ValidationError::new(
982 1001,
983 "city_of_birth is shorter than the minimum length of 1".to_string(),
984 ));
985 }
986 if self.city_of_birth.chars().count() > 35 {
987 return Err(ValidationError::new(
988 1002,
989 "city_of_birth exceeds the maximum length of 35".to_string(),
990 ));
991 }
992 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
993 if !pattern.is_match(&self.ctry_of_birth) {
994 return Err(ValidationError::new(
995 1005,
996 "ctry_of_birth does not match the required pattern".to_string(),
997 ));
998 }
999 Ok(())
1000 }
1001}
1002
1003#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1005pub struct DatePeriod2 {
1006 #[serde(rename = "FrDt")]
1007 pub fr_dt: String,
1008 #[serde(rename = "ToDt")]
1009 pub to_dt: String,
1010}
1011
1012impl DatePeriod2 {
1013 pub fn validate(&self) -> Result<(), ValidationError> {
1014 Ok(())
1015 }
1016}
1017
1018#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1020pub struct DirectDebitTransaction101 {
1021 #[serde(rename = "MndtRltdInf", skip_serializing_if = "Option::is_none")]
1022 pub mndt_rltd_inf: Option<MandateRelatedInformation141>,
1023 #[serde(rename = "CdtrSchmeId", skip_serializing_if = "Option::is_none")]
1024 pub cdtr_schme_id: Option<PartyIdentification1353>,
1025 #[serde(rename = "PreNtfctnId", skip_serializing_if = "Option::is_none")]
1026 pub pre_ntfctn_id: Option<String>,
1027 #[serde(rename = "PreNtfctnDt", skip_serializing_if = "Option::is_none")]
1028 pub pre_ntfctn_dt: Option<String>,
1029}
1030
1031impl DirectDebitTransaction101 {
1032 pub fn validate(&self) -> Result<(), ValidationError> {
1033 if let Some(ref val) = self.mndt_rltd_inf {
1034 val.validate()?
1035 }
1036 if let Some(ref val) = self.cdtr_schme_id {
1037 val.validate()?
1038 }
1039 if let Some(ref val) = self.pre_ntfctn_id {
1040 if val.chars().count() < 1 {
1041 return Err(ValidationError::new(
1042 1001,
1043 "pre_ntfctn_id is shorter than the minimum length of 1".to_string(),
1044 ));
1045 }
1046 if val.chars().count() > 35 {
1047 return Err(ValidationError::new(
1048 1002,
1049 "pre_ntfctn_id exceeds the maximum length of 35".to_string(),
1050 ));
1051 }
1052 }
1053 Ok(())
1054 }
1055}
1056
1057#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1059pub struct DirectDebitTransactionInformation231 {
1060 #[serde(rename = "PmtId")]
1061 pub pmt_id: PaymentIdentification6,
1062 #[serde(rename = "PmtTpInf", skip_serializing_if = "Option::is_none")]
1063 pub pmt_tp_inf: Option<PaymentTypeInformation291>,
1064 #[serde(rename = "InstdAmt")]
1065 pub instd_amt: ActiveOrHistoricCurrencyAndAmount,
1066 #[serde(rename = "ChrgBr", skip_serializing_if = "Option::is_none")]
1067 pub chrg_br: Option<ChargeBearerType1Code1>,
1068 #[serde(rename = "DrctDbtTx", skip_serializing_if = "Option::is_none")]
1069 pub drct_dbt_tx: Option<DirectDebitTransaction101>,
1070 #[serde(rename = "UltmtCdtr", skip_serializing_if = "Option::is_none")]
1071 pub ultmt_cdtr: Option<PartyIdentification1351>,
1072 #[serde(rename = "DbtrAgt")]
1073 pub dbtr_agt: BranchAndFinancialInstitutionIdentification62,
1074 #[serde(rename = "DbtrAgtAcct", skip_serializing_if = "Option::is_none")]
1075 pub dbtr_agt_acct: Option<CashAccount38>,
1076 #[serde(rename = "Dbtr")]
1077 pub dbtr: PartyIdentification1354,
1078 #[serde(rename = "DbtrAcct")]
1079 pub dbtr_acct: CashAccount38,
1080 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
1081 pub ultmt_dbtr: Option<PartyIdentification1351>,
1082 #[serde(rename = "InstrForCdtrAgt", skip_serializing_if = "Option::is_none")]
1083 pub instr_for_cdtr_agt: Option<String>,
1084 #[serde(rename = "Purp", skip_serializing_if = "Option::is_none")]
1085 pub purp: Option<Purpose2Choice>,
1086 #[serde(rename = "RgltryRptg", skip_serializing_if = "Option::is_none")]
1087 pub rgltry_rptg: Option<Vec<RegulatoryReporting3>>,
1088 #[serde(rename = "Tax", skip_serializing_if = "Option::is_none")]
1089 pub tax: Option<TaxInformation8>,
1090 #[serde(rename = "RltdRmtInf", skip_serializing_if = "Option::is_none")]
1091 pub rltd_rmt_inf: Option<Vec<RemittanceLocation71>>,
1092 #[serde(rename = "RmtInf", skip_serializing_if = "Option::is_none")]
1093 pub rmt_inf: Option<RemittanceInformation161>,
1094}
1095
1096impl DirectDebitTransactionInformation231 {
1097 pub fn validate(&self) -> Result<(), ValidationError> {
1098 self.pmt_id.validate()?;
1099 if let Some(ref val) = self.pmt_tp_inf {
1100 val.validate()?
1101 }
1102 self.instd_amt.validate()?;
1103 if let Some(ref val) = self.chrg_br {
1104 val.validate()?
1105 }
1106 if let Some(ref val) = self.drct_dbt_tx {
1107 val.validate()?
1108 }
1109 if let Some(ref val) = self.ultmt_cdtr {
1110 val.validate()?
1111 }
1112 self.dbtr_agt.validate()?;
1113 if let Some(ref val) = self.dbtr_agt_acct {
1114 val.validate()?
1115 }
1116 self.dbtr.validate()?;
1117 self.dbtr_acct.validate()?;
1118 if let Some(ref val) = self.ultmt_dbtr {
1119 val.validate()?
1120 }
1121 if let Some(ref val) = self.instr_for_cdtr_agt {
1122 if val.chars().count() < 1 {
1123 return Err(ValidationError::new(
1124 1001,
1125 "instr_for_cdtr_agt is shorter than the minimum length of 1".to_string(),
1126 ));
1127 }
1128 if val.chars().count() > 140 {
1129 return Err(ValidationError::new(
1130 1002,
1131 "instr_for_cdtr_agt exceeds the maximum length of 140".to_string(),
1132 ));
1133 }
1134 }
1135 if let Some(ref val) = self.purp {
1136 val.validate()?
1137 }
1138 if let Some(ref vec) = self.rgltry_rptg {
1139 for item in vec {
1140 item.validate()?
1141 }
1142 }
1143 if let Some(ref val) = self.tax {
1144 val.validate()?
1145 }
1146 if let Some(ref vec) = self.rltd_rmt_inf {
1147 for item in vec {
1148 item.validate()?
1149 }
1150 }
1151 if let Some(ref val) = self.rmt_inf {
1152 val.validate()?
1153 }
1154 Ok(())
1155 }
1156}
1157
1158#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1160pub struct DiscountAmountAndType1 {
1161 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1162 pub tp: Option<DiscountAmountType1Choice>,
1163 #[serde(rename = "Amt")]
1164 pub amt: ActiveOrHistoricCurrencyAndAmount,
1165}
1166
1167impl DiscountAmountAndType1 {
1168 pub fn validate(&self) -> Result<(), ValidationError> {
1169 if let Some(ref val) = self.tp {
1170 val.validate()?
1171 }
1172 self.amt.validate()?;
1173 Ok(())
1174 }
1175}
1176
1177#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1179pub struct DiscountAmountType1Choice {
1180 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1181 pub cd: Option<String>,
1182 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1183 pub prtry: Option<String>,
1184}
1185
1186impl DiscountAmountType1Choice {
1187 pub fn validate(&self) -> Result<(), ValidationError> {
1188 if let Some(ref val) = self.cd {
1189 if val.chars().count() < 1 {
1190 return Err(ValidationError::new(
1191 1001,
1192 "cd is shorter than the minimum length of 1".to_string(),
1193 ));
1194 }
1195 if val.chars().count() > 4 {
1196 return Err(ValidationError::new(
1197 1002,
1198 "cd exceeds the maximum length of 4".to_string(),
1199 ));
1200 }
1201 }
1202 if let Some(ref val) = self.prtry {
1203 if val.chars().count() < 1 {
1204 return Err(ValidationError::new(
1205 1001,
1206 "prtry is shorter than the minimum length of 1".to_string(),
1207 ));
1208 }
1209 if val.chars().count() > 35 {
1210 return Err(ValidationError::new(
1211 1002,
1212 "prtry exceeds the maximum length of 35".to_string(),
1213 ));
1214 }
1215 }
1216 Ok(())
1217 }
1218}
1219
1220#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1222pub struct DocumentAdjustment1 {
1223 #[serde(rename = "Amt")]
1224 pub amt: ActiveOrHistoricCurrencyAndAmount,
1225 #[serde(rename = "CdtDbtInd", skip_serializing_if = "Option::is_none")]
1226 pub cdt_dbt_ind: Option<CreditDebitCode>,
1227 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
1228 pub rsn: Option<String>,
1229 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
1230 pub addtl_inf: Option<String>,
1231}
1232
1233impl DocumentAdjustment1 {
1234 pub fn validate(&self) -> Result<(), ValidationError> {
1235 self.amt.validate()?;
1236 if let Some(ref val) = self.cdt_dbt_ind {
1237 val.validate()?
1238 }
1239 if let Some(ref val) = self.rsn {
1240 if val.chars().count() < 1 {
1241 return Err(ValidationError::new(
1242 1001,
1243 "rsn is shorter than the minimum length of 1".to_string(),
1244 ));
1245 }
1246 if val.chars().count() > 4 {
1247 return Err(ValidationError::new(
1248 1002,
1249 "rsn exceeds the maximum length of 4".to_string(),
1250 ));
1251 }
1252 }
1253 if let Some(ref val) = self.addtl_inf {
1254 if val.chars().count() < 1 {
1255 return Err(ValidationError::new(
1256 1001,
1257 "addtl_inf is shorter than the minimum length of 1".to_string(),
1258 ));
1259 }
1260 if val.chars().count() > 140 {
1261 return Err(ValidationError::new(
1262 1002,
1263 "addtl_inf exceeds the maximum length of 140".to_string(),
1264 ));
1265 }
1266 }
1267 Ok(())
1268 }
1269}
1270
1271#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1273pub struct DocumentLineIdentification1 {
1274 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1275 pub tp: Option<DocumentLineType1>,
1276 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
1277 pub nb: Option<String>,
1278 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
1279 pub rltd_dt: Option<String>,
1280}
1281
1282impl DocumentLineIdentification1 {
1283 pub fn validate(&self) -> Result<(), ValidationError> {
1284 if let Some(ref val) = self.tp {
1285 val.validate()?
1286 }
1287 if let Some(ref val) = self.nb {
1288 if val.chars().count() < 1 {
1289 return Err(ValidationError::new(
1290 1001,
1291 "nb is shorter than the minimum length of 1".to_string(),
1292 ));
1293 }
1294 if val.chars().count() > 35 {
1295 return Err(ValidationError::new(
1296 1002,
1297 "nb exceeds the maximum length of 35".to_string(),
1298 ));
1299 }
1300 }
1301 Ok(())
1302 }
1303}
1304
1305#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1307pub struct DocumentLineInformation1 {
1308 #[serde(rename = "Id")]
1309 pub id: Vec<DocumentLineIdentification1>,
1310 #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
1311 pub desc: Option<String>,
1312 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
1313 pub amt: Option<RemittanceAmount3>,
1314}
1315
1316impl DocumentLineInformation1 {
1317 pub fn validate(&self) -> Result<(), ValidationError> {
1318 for item in &self.id {
1319 item.validate()?
1320 }
1321 if let Some(ref val) = self.desc {
1322 if val.chars().count() < 1 {
1323 return Err(ValidationError::new(
1324 1001,
1325 "desc is shorter than the minimum length of 1".to_string(),
1326 ));
1327 }
1328 if val.chars().count() > 2048 {
1329 return Err(ValidationError::new(
1330 1002,
1331 "desc exceeds the maximum length of 2048".to_string(),
1332 ));
1333 }
1334 }
1335 if let Some(ref val) = self.amt {
1336 val.validate()?
1337 }
1338 Ok(())
1339 }
1340}
1341
1342#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1344pub struct DocumentLineType1 {
1345 #[serde(rename = "CdOrPrtry")]
1346 pub cd_or_prtry: DocumentLineType1Choice,
1347 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1348 pub issr: Option<String>,
1349}
1350
1351impl DocumentLineType1 {
1352 pub fn validate(&self) -> Result<(), ValidationError> {
1353 self.cd_or_prtry.validate()?;
1354 if let Some(ref val) = self.issr {
1355 if val.chars().count() < 1 {
1356 return Err(ValidationError::new(
1357 1001,
1358 "issr is shorter than the minimum length of 1".to_string(),
1359 ));
1360 }
1361 if val.chars().count() > 35 {
1362 return Err(ValidationError::new(
1363 1002,
1364 "issr exceeds the maximum length of 35".to_string(),
1365 ));
1366 }
1367 }
1368 Ok(())
1369 }
1370}
1371
1372#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1374pub struct DocumentLineType1Choice {
1375 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1376 pub cd: Option<String>,
1377 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1378 pub prtry: Option<String>,
1379}
1380
1381impl DocumentLineType1Choice {
1382 pub fn validate(&self) -> Result<(), ValidationError> {
1383 if let Some(ref val) = self.cd {
1384 if val.chars().count() < 1 {
1385 return Err(ValidationError::new(
1386 1001,
1387 "cd is shorter than the minimum length of 1".to_string(),
1388 ));
1389 }
1390 if val.chars().count() > 4 {
1391 return Err(ValidationError::new(
1392 1002,
1393 "cd exceeds the maximum length of 4".to_string(),
1394 ));
1395 }
1396 }
1397 if let Some(ref val) = self.prtry {
1398 if val.chars().count() < 1 {
1399 return Err(ValidationError::new(
1400 1001,
1401 "prtry is shorter than the minimum length of 1".to_string(),
1402 ));
1403 }
1404 if val.chars().count() > 35 {
1405 return Err(ValidationError::new(
1406 1002,
1407 "prtry exceeds the maximum length of 35".to_string(),
1408 ));
1409 }
1410 }
1411 Ok(())
1412 }
1413}
1414
1415#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1417pub enum DocumentType3Code {
1418 #[default]
1419 #[serde(rename = "RADM")]
1420 CodeRADM,
1421 #[serde(rename = "RPIN")]
1422 CodeRPIN,
1423 #[serde(rename = "FXDR")]
1424 CodeFXDR,
1425 #[serde(rename = "DISP")]
1426 CodeDISP,
1427 #[serde(rename = "PUOR")]
1428 CodePUOR,
1429 #[serde(rename = "SCOR")]
1430 CodeSCOR,
1431}
1432
1433impl DocumentType3Code {
1434 pub fn validate(&self) -> Result<(), ValidationError> {
1435 Ok(())
1436 }
1437}
1438
1439#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1441pub enum DocumentType6Code {
1442 #[default]
1443 #[serde(rename = "MSIN")]
1444 CodeMSIN,
1445 #[serde(rename = "CNFA")]
1446 CodeCNFA,
1447 #[serde(rename = "DNFA")]
1448 CodeDNFA,
1449 #[serde(rename = "CINV")]
1450 CodeCINV,
1451 #[serde(rename = "CREN")]
1452 CodeCREN,
1453 #[serde(rename = "DEBN")]
1454 CodeDEBN,
1455 #[serde(rename = "HIRI")]
1456 CodeHIRI,
1457 #[serde(rename = "SBIN")]
1458 CodeSBIN,
1459 #[serde(rename = "CMCN")]
1460 CodeCMCN,
1461 #[serde(rename = "SOAC")]
1462 CodeSOAC,
1463 #[serde(rename = "DISP")]
1464 CodeDISP,
1465 #[serde(rename = "BOLD")]
1466 CodeBOLD,
1467 #[serde(rename = "VCHR")]
1468 CodeVCHR,
1469 #[serde(rename = "AROI")]
1470 CodeAROI,
1471 #[serde(rename = "TSUT")]
1472 CodeTSUT,
1473 #[serde(rename = "PUOR")]
1474 CodePUOR,
1475}
1476
1477impl DocumentType6Code {
1478 pub fn validate(&self) -> Result<(), ValidationError> {
1479 Ok(())
1480 }
1481}
1482
1483#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1485pub struct FinancialIdentificationSchemeName1Choice {
1486 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1487 pub cd: Option<String>,
1488 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1489 pub prtry: Option<String>,
1490}
1491
1492impl FinancialIdentificationSchemeName1Choice {
1493 pub fn validate(&self) -> Result<(), ValidationError> {
1494 if let Some(ref val) = self.cd {
1495 if val.chars().count() < 1 {
1496 return Err(ValidationError::new(
1497 1001,
1498 "cd is shorter than the minimum length of 1".to_string(),
1499 ));
1500 }
1501 if val.chars().count() > 4 {
1502 return Err(ValidationError::new(
1503 1002,
1504 "cd exceeds the maximum length of 4".to_string(),
1505 ));
1506 }
1507 }
1508 if let Some(ref val) = self.prtry {
1509 if val.chars().count() < 1 {
1510 return Err(ValidationError::new(
1511 1001,
1512 "prtry is shorter than the minimum length of 1".to_string(),
1513 ));
1514 }
1515 if val.chars().count() > 35 {
1516 return Err(ValidationError::new(
1517 1002,
1518 "prtry exceeds the maximum length of 35".to_string(),
1519 ));
1520 }
1521 }
1522 Ok(())
1523 }
1524}
1525
1526#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1528pub struct FinancialInstitutionIdentification18 {
1529 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1530 pub bicfi: Option<String>,
1531 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1532 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification2>,
1533 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1534 pub lei: Option<String>,
1535 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1536 pub nm: Option<String>,
1537 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1538 pub pstl_adr: Option<PostalAddress24>,
1539 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1540 pub othr: Option<GenericFinancialIdentification1>,
1541}
1542
1543impl FinancialInstitutionIdentification18 {
1544 pub fn validate(&self) -> Result<(), ValidationError> {
1545 if let Some(ref val) = self.bicfi {
1546 let pattern =
1547 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
1548 if !pattern.is_match(val) {
1549 return Err(ValidationError::new(
1550 1005,
1551 "bicfi does not match the required pattern".to_string(),
1552 ));
1553 }
1554 }
1555 if let Some(ref val) = self.clr_sys_mmb_id {
1556 val.validate()?
1557 }
1558 if let Some(ref val) = self.lei {
1559 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1560 if !pattern.is_match(val) {
1561 return Err(ValidationError::new(
1562 1005,
1563 "lei does not match the required pattern".to_string(),
1564 ));
1565 }
1566 }
1567 if let Some(ref val) = self.nm {
1568 if val.chars().count() < 1 {
1569 return Err(ValidationError::new(
1570 1001,
1571 "nm is shorter than the minimum length of 1".to_string(),
1572 ));
1573 }
1574 if val.chars().count() > 140 {
1575 return Err(ValidationError::new(
1576 1002,
1577 "nm exceeds the maximum length of 140".to_string(),
1578 ));
1579 }
1580 }
1581 if let Some(ref val) = self.pstl_adr {
1582 val.validate()?
1583 }
1584 if let Some(ref val) = self.othr {
1585 val.validate()?
1586 }
1587 Ok(())
1588 }
1589}
1590
1591#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1593pub struct FinancialInstitutionIdentification181 {
1594 #[serde(rename = "BICFI")]
1595 pub bicfi: String,
1596 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1597 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1598 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1599 pub lei: Option<String>,
1600}
1601
1602impl FinancialInstitutionIdentification181 {
1603 pub fn validate(&self) -> Result<(), ValidationError> {
1604 let pattern =
1605 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
1606 if !pattern.is_match(&self.bicfi) {
1607 return Err(ValidationError::new(
1608 1005,
1609 "bicfi does not match the required pattern".to_string(),
1610 ));
1611 }
1612 if let Some(ref val) = self.clr_sys_mmb_id {
1613 val.validate()?
1614 }
1615 if let Some(ref val) = self.lei {
1616 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1617 if !pattern.is_match(val) {
1618 return Err(ValidationError::new(
1619 1005,
1620 "lei does not match the required pattern".to_string(),
1621 ));
1622 }
1623 }
1624 Ok(())
1625 }
1626}
1627
1628#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1630pub struct FinancialInstitutionIdentification182 {
1631 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1632 pub bicfi: Option<String>,
1633 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1634 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
1635 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1636 pub lei: Option<String>,
1637 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1638 pub nm: Option<String>,
1639 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1640 pub pstl_adr: Option<PostalAddress242>,
1641}
1642
1643impl FinancialInstitutionIdentification182 {
1644 pub fn validate(&self) -> Result<(), ValidationError> {
1645 if let Some(ref val) = self.bicfi {
1646 let pattern =
1647 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
1648 if !pattern.is_match(val) {
1649 return Err(ValidationError::new(
1650 1005,
1651 "bicfi does not match the required pattern".to_string(),
1652 ));
1653 }
1654 }
1655 if let Some(ref val) = self.clr_sys_mmb_id {
1656 val.validate()?
1657 }
1658 if let Some(ref val) = self.lei {
1659 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1660 if !pattern.is_match(val) {
1661 return Err(ValidationError::new(
1662 1005,
1663 "lei does not match the required pattern".to_string(),
1664 ));
1665 }
1666 }
1667 if let Some(ref val) = self.nm {
1668 if val.chars().count() < 1 {
1669 return Err(ValidationError::new(
1670 1001,
1671 "nm is shorter than the minimum length of 1".to_string(),
1672 ));
1673 }
1674 if val.chars().count() > 140 {
1675 return Err(ValidationError::new(
1676 1002,
1677 "nm exceeds the maximum length of 140".to_string(),
1678 ));
1679 }
1680 }
1681 if let Some(ref val) = self.pstl_adr {
1682 val.validate()?
1683 }
1684 Ok(())
1685 }
1686}
1687
1688#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1690pub struct FinancialInstitutionIdentification183 {
1691 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1692 pub bicfi: Option<String>,
1693 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1694 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification2>,
1695 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1696 pub lei: Option<String>,
1697 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1698 pub nm: Option<String>,
1699 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1700 pub pstl_adr: Option<PostalAddress242>,
1701}
1702
1703impl FinancialInstitutionIdentification183 {
1704 pub fn validate(&self) -> Result<(), ValidationError> {
1705 if let Some(ref val) = self.bicfi {
1706 let pattern =
1707 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
1708 if !pattern.is_match(val) {
1709 return Err(ValidationError::new(
1710 1005,
1711 "bicfi does not match the required pattern".to_string(),
1712 ));
1713 }
1714 }
1715 if let Some(ref val) = self.clr_sys_mmb_id {
1716 val.validate()?
1717 }
1718 if let Some(ref val) = self.lei {
1719 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1720 if !pattern.is_match(val) {
1721 return Err(ValidationError::new(
1722 1005,
1723 "lei does not match the required pattern".to_string(),
1724 ));
1725 }
1726 }
1727 if let Some(ref val) = self.nm {
1728 if val.chars().count() < 1 {
1729 return Err(ValidationError::new(
1730 1001,
1731 "nm is shorter than the minimum length of 1".to_string(),
1732 ));
1733 }
1734 if val.chars().count() > 140 {
1735 return Err(ValidationError::new(
1736 1002,
1737 "nm exceeds the maximum length of 140".to_string(),
1738 ));
1739 }
1740 }
1741 if let Some(ref val) = self.pstl_adr {
1742 val.validate()?
1743 }
1744 Ok(())
1745 }
1746}
1747
1748#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1750pub struct FinancialInstitutionIdentification184 {
1751 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
1752 pub bicfi: Option<String>,
1753 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
1754 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification2>,
1755 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
1756 pub lei: Option<String>,
1757 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1758 pub nm: Option<String>,
1759 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1760 pub pstl_adr: Option<PostalAddress243>,
1761 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1762 pub othr: Option<GenericFinancialIdentification1>,
1763}
1764
1765impl FinancialInstitutionIdentification184 {
1766 pub fn validate(&self) -> Result<(), ValidationError> {
1767 if let Some(ref val) = self.bicfi {
1768 let pattern =
1769 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
1770 if !pattern.is_match(val) {
1771 return Err(ValidationError::new(
1772 1005,
1773 "bicfi does not match the required pattern".to_string(),
1774 ));
1775 }
1776 }
1777 if let Some(ref val) = self.clr_sys_mmb_id {
1778 val.validate()?
1779 }
1780 if let Some(ref val) = self.lei {
1781 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
1782 if !pattern.is_match(val) {
1783 return Err(ValidationError::new(
1784 1005,
1785 "lei does not match the required pattern".to_string(),
1786 ));
1787 }
1788 }
1789 if let Some(ref val) = self.nm {
1790 if val.chars().count() < 1 {
1791 return Err(ValidationError::new(
1792 1001,
1793 "nm is shorter than the minimum length of 1".to_string(),
1794 ));
1795 }
1796 if val.chars().count() > 140 {
1797 return Err(ValidationError::new(
1798 1002,
1799 "nm exceeds the maximum length of 140".to_string(),
1800 ));
1801 }
1802 }
1803 if let Some(ref val) = self.pstl_adr {
1804 val.validate()?
1805 }
1806 if let Some(ref val) = self.othr {
1807 val.validate()?
1808 }
1809 Ok(())
1810 }
1811}
1812
1813#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1815pub struct Frequency36Choice {
1816 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1817 pub tp: Option<Frequency6Code>,
1818 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
1819 pub prd: Option<FrequencyPeriod1>,
1820 #[serde(rename = "PtInTm", skip_serializing_if = "Option::is_none")]
1821 pub pt_in_tm: Option<FrequencyAndMoment1>,
1822}
1823
1824impl Frequency36Choice {
1825 pub fn validate(&self) -> Result<(), ValidationError> {
1826 if let Some(ref val) = self.tp {
1827 val.validate()?
1828 }
1829 if let Some(ref val) = self.prd {
1830 val.validate()?
1831 }
1832 if let Some(ref val) = self.pt_in_tm {
1833 val.validate()?
1834 }
1835 Ok(())
1836 }
1837}
1838
1839#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1841pub enum Frequency6Code {
1842 #[default]
1843 #[serde(rename = "YEAR")]
1844 CodeYEAR,
1845 #[serde(rename = "MNTH")]
1846 CodeMNTH,
1847 #[serde(rename = "QURT")]
1848 CodeQURT,
1849 #[serde(rename = "MIAN")]
1850 CodeMIAN,
1851 #[serde(rename = "WEEK")]
1852 CodeWEEK,
1853 #[serde(rename = "DAIL")]
1854 CodeDAIL,
1855 #[serde(rename = "ADHO")]
1856 CodeADHO,
1857 #[serde(rename = "INDA")]
1858 CodeINDA,
1859 #[serde(rename = "FRTN")]
1860 CodeFRTN,
1861}
1862
1863impl Frequency6Code {
1864 pub fn validate(&self) -> Result<(), ValidationError> {
1865 Ok(())
1866 }
1867}
1868
1869#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1871pub struct FrequencyAndMoment1 {
1872 #[serde(rename = "Tp")]
1873 pub tp: Frequency6Code,
1874 #[serde(rename = "PtInTm")]
1875 pub pt_in_tm: String,
1876}
1877
1878impl FrequencyAndMoment1 {
1879 pub fn validate(&self) -> Result<(), ValidationError> {
1880 self.tp.validate()?;
1881 let pattern = Regex::new("[0-9]{2}").unwrap();
1882 if !pattern.is_match(&self.pt_in_tm) {
1883 return Err(ValidationError::new(
1884 1005,
1885 "pt_in_tm does not match the required pattern".to_string(),
1886 ));
1887 }
1888 Ok(())
1889 }
1890}
1891
1892#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1894pub struct FrequencyPeriod1 {
1895 #[serde(rename = "Tp")]
1896 pub tp: Frequency6Code,
1897 #[serde(rename = "CntPerPrd")]
1898 pub cnt_per_prd: f64,
1899}
1900
1901impl FrequencyPeriod1 {
1902 pub fn validate(&self) -> Result<(), ValidationError> {
1903 self.tp.validate()?;
1904 Ok(())
1905 }
1906}
1907
1908#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1910pub struct Garnishment31 {
1911 #[serde(rename = "Tp")]
1912 pub tp: GarnishmentType1,
1913 #[serde(rename = "Grnshee", skip_serializing_if = "Option::is_none")]
1914 pub grnshee: Option<PartyIdentification1351>,
1915 #[serde(rename = "GrnshmtAdmstr", skip_serializing_if = "Option::is_none")]
1916 pub grnshmt_admstr: Option<PartyIdentification1351>,
1917 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
1918 pub ref_nb: Option<String>,
1919 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
1920 pub dt: Option<String>,
1921 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
1922 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
1923 #[serde(rename = "FmlyMdclInsrncInd", skip_serializing_if = "Option::is_none")]
1924 pub fmly_mdcl_insrnc_ind: Option<bool>,
1925 #[serde(rename = "MplyeeTermntnInd", skip_serializing_if = "Option::is_none")]
1926 pub mplyee_termntn_ind: Option<bool>,
1927}
1928
1929impl Garnishment31 {
1930 pub fn validate(&self) -> Result<(), ValidationError> {
1931 self.tp.validate()?;
1932 if let Some(ref val) = self.grnshee {
1933 val.validate()?
1934 }
1935 if let Some(ref val) = self.grnshmt_admstr {
1936 val.validate()?
1937 }
1938 if let Some(ref val) = self.ref_nb {
1939 if val.chars().count() < 1 {
1940 return Err(ValidationError::new(
1941 1001,
1942 "ref_nb is shorter than the minimum length of 1".to_string(),
1943 ));
1944 }
1945 if val.chars().count() > 140 {
1946 return Err(ValidationError::new(
1947 1002,
1948 "ref_nb exceeds the maximum length of 140".to_string(),
1949 ));
1950 }
1951 }
1952 if let Some(ref val) = self.rmtd_amt {
1953 val.validate()?
1954 }
1955 Ok(())
1956 }
1957}
1958
1959#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1961pub struct GarnishmentType1 {
1962 #[serde(rename = "CdOrPrtry")]
1963 pub cd_or_prtry: GarnishmentType1Choice,
1964 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
1965 pub issr: Option<String>,
1966}
1967
1968impl GarnishmentType1 {
1969 pub fn validate(&self) -> Result<(), ValidationError> {
1970 self.cd_or_prtry.validate()?;
1971 if let Some(ref val) = self.issr {
1972 if val.chars().count() < 1 {
1973 return Err(ValidationError::new(
1974 1001,
1975 "issr is shorter than the minimum length of 1".to_string(),
1976 ));
1977 }
1978 if val.chars().count() > 35 {
1979 return Err(ValidationError::new(
1980 1002,
1981 "issr exceeds the maximum length of 35".to_string(),
1982 ));
1983 }
1984 }
1985 Ok(())
1986 }
1987}
1988
1989#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1991pub struct GarnishmentType1Choice {
1992 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1993 pub cd: Option<String>,
1994 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1995 pub prtry: Option<String>,
1996}
1997
1998impl GarnishmentType1Choice {
1999 pub fn validate(&self) -> Result<(), ValidationError> {
2000 if let Some(ref val) = self.cd {
2001 if val.chars().count() < 1 {
2002 return Err(ValidationError::new(
2003 1001,
2004 "cd is shorter than the minimum length of 1".to_string(),
2005 ));
2006 }
2007 if val.chars().count() > 4 {
2008 return Err(ValidationError::new(
2009 1002,
2010 "cd exceeds the maximum length of 4".to_string(),
2011 ));
2012 }
2013 }
2014 if let Some(ref val) = self.prtry {
2015 if val.chars().count() < 1 {
2016 return Err(ValidationError::new(
2017 1001,
2018 "prtry is shorter than the minimum length of 1".to_string(),
2019 ));
2020 }
2021 if val.chars().count() > 35 {
2022 return Err(ValidationError::new(
2023 1002,
2024 "prtry exceeds the maximum length of 35".to_string(),
2025 ));
2026 }
2027 }
2028 Ok(())
2029 }
2030}
2031
2032#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2034pub struct GenericAccountIdentification1 {
2035 #[serde(rename = "Id")]
2036 pub id: String,
2037 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2038 pub schme_nm: Option<AccountSchemeName1Choice>,
2039 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2040 pub issr: Option<String>,
2041}
2042
2043impl GenericAccountIdentification1 {
2044 pub fn validate(&self) -> Result<(), ValidationError> {
2045 if self.id.chars().count() < 1 {
2046 return Err(ValidationError::new(
2047 1001,
2048 "id is shorter than the minimum length of 1".to_string(),
2049 ));
2050 }
2051 if self.id.chars().count() > 34 {
2052 return Err(ValidationError::new(
2053 1002,
2054 "id exceeds the maximum length of 34".to_string(),
2055 ));
2056 }
2057 if let Some(ref val) = self.schme_nm {
2058 val.validate()?
2059 }
2060 if let Some(ref val) = self.issr {
2061 if val.chars().count() < 1 {
2062 return Err(ValidationError::new(
2063 1001,
2064 "issr is shorter than the minimum length of 1".to_string(),
2065 ));
2066 }
2067 if val.chars().count() > 35 {
2068 return Err(ValidationError::new(
2069 1002,
2070 "issr exceeds the maximum length of 35".to_string(),
2071 ));
2072 }
2073 }
2074 Ok(())
2075 }
2076}
2077
2078#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2080pub struct GenericFinancialIdentification1 {
2081 #[serde(rename = "Id")]
2082 pub id: String,
2083 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2084 pub schme_nm: Option<FinancialIdentificationSchemeName1Choice>,
2085 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2086 pub issr: Option<String>,
2087}
2088
2089impl GenericFinancialIdentification1 {
2090 pub fn validate(&self) -> Result<(), ValidationError> {
2091 if self.id.chars().count() < 1 {
2092 return Err(ValidationError::new(
2093 1001,
2094 "id is shorter than the minimum length of 1".to_string(),
2095 ));
2096 }
2097 if self.id.chars().count() > 35 {
2098 return Err(ValidationError::new(
2099 1002,
2100 "id exceeds the maximum length of 35".to_string(),
2101 ));
2102 }
2103 if let Some(ref val) = self.schme_nm {
2104 val.validate()?
2105 }
2106 if let Some(ref val) = self.issr {
2107 if val.chars().count() < 1 {
2108 return Err(ValidationError::new(
2109 1001,
2110 "issr is shorter than the minimum length of 1".to_string(),
2111 ));
2112 }
2113 if val.chars().count() > 35 {
2114 return Err(ValidationError::new(
2115 1002,
2116 "issr exceeds the maximum length of 35".to_string(),
2117 ));
2118 }
2119 }
2120 Ok(())
2121 }
2122}
2123
2124#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2126pub struct GenericIdentification30 {
2127 #[serde(rename = "Id")]
2128 pub id: String,
2129 #[serde(rename = "Issr")]
2130 pub issr: String,
2131 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2132 pub schme_nm: Option<String>,
2133}
2134
2135impl GenericIdentification30 {
2136 pub fn validate(&self) -> Result<(), ValidationError> {
2137 let pattern = Regex::new("[a-zA-Z0-9]{4}").unwrap();
2138 if !pattern.is_match(&self.id) {
2139 return Err(ValidationError::new(
2140 1005,
2141 "id does not match the required pattern".to_string(),
2142 ));
2143 }
2144 if self.issr.chars().count() < 1 {
2145 return Err(ValidationError::new(
2146 1001,
2147 "issr is shorter than the minimum length of 1".to_string(),
2148 ));
2149 }
2150 if self.issr.chars().count() > 35 {
2151 return Err(ValidationError::new(
2152 1002,
2153 "issr exceeds the maximum length of 35".to_string(),
2154 ));
2155 }
2156 if let Some(ref val) = self.schme_nm {
2157 if val.chars().count() < 1 {
2158 return Err(ValidationError::new(
2159 1001,
2160 "schme_nm is shorter than the minimum length of 1".to_string(),
2161 ));
2162 }
2163 if val.chars().count() > 35 {
2164 return Err(ValidationError::new(
2165 1002,
2166 "schme_nm exceeds the maximum length of 35".to_string(),
2167 ));
2168 }
2169 }
2170 Ok(())
2171 }
2172}
2173
2174#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2176pub struct GenericOrganisationIdentification1 {
2177 #[serde(rename = "Id")]
2178 pub id: String,
2179 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2180 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice>,
2181 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2182 pub issr: Option<String>,
2183}
2184
2185impl GenericOrganisationIdentification1 {
2186 pub fn validate(&self) -> Result<(), ValidationError> {
2187 if self.id.chars().count() < 1 {
2188 return Err(ValidationError::new(
2189 1001,
2190 "id is shorter than the minimum length of 1".to_string(),
2191 ));
2192 }
2193 if self.id.chars().count() > 35 {
2194 return Err(ValidationError::new(
2195 1002,
2196 "id exceeds the maximum length of 35".to_string(),
2197 ));
2198 }
2199 if let Some(ref val) = self.schme_nm {
2200 val.validate()?
2201 }
2202 if let Some(ref val) = self.issr {
2203 if val.chars().count() < 1 {
2204 return Err(ValidationError::new(
2205 1001,
2206 "issr is shorter than the minimum length of 1".to_string(),
2207 ));
2208 }
2209 if val.chars().count() > 35 {
2210 return Err(ValidationError::new(
2211 1002,
2212 "issr exceeds the maximum length of 35".to_string(),
2213 ));
2214 }
2215 }
2216 Ok(())
2217 }
2218}
2219
2220#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2222pub struct GenericOrganisationIdentification11 {
2223 #[serde(rename = "Id")]
2224 pub id: String,
2225 #[serde(rename = "SchmeNm")]
2226 pub schme_nm: OrganisationIdentificationSchemeName1Choice1,
2227 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2228 pub issr: Option<String>,
2229}
2230
2231impl GenericOrganisationIdentification11 {
2232 pub fn validate(&self) -> Result<(), ValidationError> {
2233 if self.id.chars().count() < 1 {
2234 return Err(ValidationError::new(
2235 1001,
2236 "id is shorter than the minimum length of 1".to_string(),
2237 ));
2238 }
2239 if self.id.chars().count() > 35 {
2240 return Err(ValidationError::new(
2241 1002,
2242 "id exceeds the maximum length of 35".to_string(),
2243 ));
2244 }
2245 self.schme_nm.validate()?;
2246 if let Some(ref val) = self.issr {
2247 if val.chars().count() < 1 {
2248 return Err(ValidationError::new(
2249 1001,
2250 "issr is shorter than the minimum length of 1".to_string(),
2251 ));
2252 }
2253 if val.chars().count() > 35 {
2254 return Err(ValidationError::new(
2255 1002,
2256 "issr exceeds the maximum length of 35".to_string(),
2257 ));
2258 }
2259 }
2260 Ok(())
2261 }
2262}
2263
2264#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2266pub struct GenericPersonIdentification1 {
2267 #[serde(rename = "Id")]
2268 pub id: String,
2269 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
2270 pub schme_nm: Option<PersonIdentificationSchemeName1Choice>,
2271 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2272 pub issr: Option<String>,
2273}
2274
2275impl GenericPersonIdentification1 {
2276 pub fn validate(&self) -> Result<(), ValidationError> {
2277 if self.id.chars().count() < 1 {
2278 return Err(ValidationError::new(
2279 1001,
2280 "id is shorter than the minimum length of 1".to_string(),
2281 ));
2282 }
2283 if self.id.chars().count() > 35 {
2284 return Err(ValidationError::new(
2285 1002,
2286 "id exceeds the maximum length of 35".to_string(),
2287 ));
2288 }
2289 if let Some(ref val) = self.schme_nm {
2290 val.validate()?
2291 }
2292 if let Some(ref val) = self.issr {
2293 if val.chars().count() < 1 {
2294 return Err(ValidationError::new(
2295 1001,
2296 "issr is shorter than the minimum length of 1".to_string(),
2297 ));
2298 }
2299 if val.chars().count() > 35 {
2300 return Err(ValidationError::new(
2301 1002,
2302 "issr exceeds the maximum length of 35".to_string(),
2303 ));
2304 }
2305 }
2306 Ok(())
2307 }
2308}
2309
2310#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2312pub struct GenericPersonIdentification11 {
2313 #[serde(rename = "Id")]
2314 pub id: String,
2315 #[serde(rename = "SchmeNm")]
2316 pub schme_nm: PersonIdentificationSchemeName1Choice1,
2317 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
2318 pub issr: Option<String>,
2319}
2320
2321impl GenericPersonIdentification11 {
2322 pub fn validate(&self) -> Result<(), ValidationError> {
2323 if self.id.chars().count() < 1 {
2324 return Err(ValidationError::new(
2325 1001,
2326 "id is shorter than the minimum length of 1".to_string(),
2327 ));
2328 }
2329 if self.id.chars().count() > 35 {
2330 return Err(ValidationError::new(
2331 1002,
2332 "id exceeds the maximum length of 35".to_string(),
2333 ));
2334 }
2335 self.schme_nm.validate()?;
2336 if let Some(ref val) = self.issr {
2337 if val.chars().count() < 1 {
2338 return Err(ValidationError::new(
2339 1001,
2340 "issr is shorter than the minimum length of 1".to_string(),
2341 ));
2342 }
2343 if val.chars().count() > 35 {
2344 return Err(ValidationError::new(
2345 1002,
2346 "issr exceeds the maximum length of 35".to_string(),
2347 ));
2348 }
2349 }
2350 Ok(())
2351 }
2352}
2353
2354#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2356pub struct GroupHeader831 {
2357 #[serde(rename = "MsgId")]
2358 pub msg_id: String,
2359 #[serde(rename = "CreDtTm")]
2360 pub cre_dt_tm: String,
2361 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
2362 pub authstn: Option<Vec<Authorisation1Choice>>,
2363 #[serde(rename = "NbOfTxs")]
2364 pub nb_of_txs: String,
2365 #[serde(rename = "InitgPty")]
2366 pub initg_pty: PartyIdentification1351,
2367 #[serde(rename = "FwdgAgt")]
2368 pub fwdg_agt: BranchAndFinancialInstitutionIdentification61,
2369}
2370
2371impl GroupHeader831 {
2372 pub fn validate(&self) -> Result<(), ValidationError> {
2373 if self.msg_id.chars().count() < 1 {
2374 return Err(ValidationError::new(
2375 1001,
2376 "msg_id is shorter than the minimum length of 1".to_string(),
2377 ));
2378 }
2379 if self.msg_id.chars().count() > 35 {
2380 return Err(ValidationError::new(
2381 1002,
2382 "msg_id exceeds the maximum length of 35".to_string(),
2383 ));
2384 }
2385 if let Some(ref vec) = self.authstn {
2386 for item in vec {
2387 item.validate()?
2388 }
2389 }
2390 let pattern = Regex::new("[0-9]{1,15}").unwrap();
2391 if !pattern.is_match(&self.nb_of_txs) {
2392 return Err(ValidationError::new(
2393 1005,
2394 "nb_of_txs does not match the required pattern".to_string(),
2395 ));
2396 }
2397 self.initg_pty.validate()?;
2398 self.fwdg_agt.validate()?;
2399 Ok(())
2400 }
2401}
2402
2403#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2405pub struct LocalInstrument2Choice {
2406 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2407 pub cd: Option<String>,
2408 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2409 pub prtry: Option<String>,
2410}
2411
2412impl LocalInstrument2Choice {
2413 pub fn validate(&self) -> Result<(), ValidationError> {
2414 if let Some(ref val) = self.cd {
2415 if val.chars().count() < 1 {
2416 return Err(ValidationError::new(
2417 1001,
2418 "cd is shorter than the minimum length of 1".to_string(),
2419 ));
2420 }
2421 if val.chars().count() > 35 {
2422 return Err(ValidationError::new(
2423 1002,
2424 "cd exceeds the maximum length of 35".to_string(),
2425 ));
2426 }
2427 }
2428 if let Some(ref val) = self.prtry {
2429 if val.chars().count() < 1 {
2430 return Err(ValidationError::new(
2431 1001,
2432 "prtry is shorter than the minimum length of 1".to_string(),
2433 ));
2434 }
2435 if val.chars().count() > 35 {
2436 return Err(ValidationError::new(
2437 1002,
2438 "prtry exceeds the maximum length of 35".to_string(),
2439 ));
2440 }
2441 }
2442 Ok(())
2443 }
2444}
2445
2446#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2448pub struct MandateRelatedInformation141 {
2449 #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
2450 pub mndt_id: Option<String>,
2451 #[serde(rename = "DtOfSgntr", skip_serializing_if = "Option::is_none")]
2452 pub dt_of_sgntr: Option<String>,
2453 #[serde(rename = "AmdmntInd", skip_serializing_if = "Option::is_none")]
2454 pub amdmnt_ind: Option<bool>,
2455 #[serde(rename = "AmdmntInfDtls", skip_serializing_if = "Option::is_none")]
2456 pub amdmnt_inf_dtls: Option<AmendmentInformationDetails131>,
2457 #[serde(rename = "ElctrncSgntr", skip_serializing_if = "Option::is_none")]
2458 pub elctrnc_sgntr: Option<String>,
2459 #[serde(rename = "FrstColltnDt", skip_serializing_if = "Option::is_none")]
2460 pub frst_colltn_dt: Option<String>,
2461 #[serde(rename = "FnlColltnDt", skip_serializing_if = "Option::is_none")]
2462 pub fnl_colltn_dt: Option<String>,
2463 #[serde(rename = "Frqcy", skip_serializing_if = "Option::is_none")]
2464 pub frqcy: Option<Frequency36Choice>,
2465 #[serde(rename = "Rsn", skip_serializing_if = "Option::is_none")]
2466 pub rsn: Option<MandateSetupReason1Choice>,
2467 #[serde(rename = "TrckgDays", skip_serializing_if = "Option::is_none")]
2468 pub trckg_days: Option<String>,
2469}
2470
2471impl MandateRelatedInformation141 {
2472 pub fn validate(&self) -> Result<(), ValidationError> {
2473 if let Some(ref val) = self.mndt_id {
2474 if val.chars().count() < 1 {
2475 return Err(ValidationError::new(
2476 1001,
2477 "mndt_id is shorter than the minimum length of 1".to_string(),
2478 ));
2479 }
2480 if val.chars().count() > 35 {
2481 return Err(ValidationError::new(
2482 1002,
2483 "mndt_id exceeds the maximum length of 35".to_string(),
2484 ));
2485 }
2486 }
2487 if let Some(ref val) = self.amdmnt_inf_dtls {
2488 val.validate()?
2489 }
2490 if let Some(ref val) = self.elctrnc_sgntr {
2491 if val.chars().count() < 1 {
2492 return Err(ValidationError::new(
2493 1001,
2494 "elctrnc_sgntr is shorter than the minimum length of 1".to_string(),
2495 ));
2496 }
2497 if val.chars().count() > 1025 {
2498 return Err(ValidationError::new(
2499 1002,
2500 "elctrnc_sgntr exceeds the maximum length of 1025".to_string(),
2501 ));
2502 }
2503 }
2504 if let Some(ref val) = self.frqcy {
2505 val.validate()?
2506 }
2507 if let Some(ref val) = self.rsn {
2508 val.validate()?
2509 }
2510 if let Some(ref val) = self.trckg_days {
2511 let pattern = Regex::new("[0-9]{2}").unwrap();
2512 if !pattern.is_match(val) {
2513 return Err(ValidationError::new(
2514 1005,
2515 "trckg_days does not match the required pattern".to_string(),
2516 ));
2517 }
2518 }
2519 Ok(())
2520 }
2521}
2522
2523#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2525pub struct MandateSetupReason1Choice {
2526 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2527 pub cd: Option<String>,
2528 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2529 pub prtry: Option<String>,
2530}
2531
2532impl MandateSetupReason1Choice {
2533 pub fn validate(&self) -> Result<(), ValidationError> {
2534 if let Some(ref val) = self.cd {
2535 if val.chars().count() < 1 {
2536 return Err(ValidationError::new(
2537 1001,
2538 "cd is shorter than the minimum length of 1".to_string(),
2539 ));
2540 }
2541 if val.chars().count() > 4 {
2542 return Err(ValidationError::new(
2543 1002,
2544 "cd exceeds the maximum length of 4".to_string(),
2545 ));
2546 }
2547 }
2548 if let Some(ref val) = self.prtry {
2549 if val.chars().count() < 1 {
2550 return Err(ValidationError::new(
2551 1001,
2552 "prtry is shorter than the minimum length of 1".to_string(),
2553 ));
2554 }
2555 if val.chars().count() > 70 {
2556 return Err(ValidationError::new(
2557 1002,
2558 "prtry exceeds the maximum length of 70".to_string(),
2559 ));
2560 }
2561 }
2562 Ok(())
2563 }
2564}
2565
2566#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2568pub struct NameAndAddress161 {
2569 #[serde(rename = "Nm")]
2570 pub nm: String,
2571 #[serde(rename = "Adr")]
2572 pub adr: PostalAddress244,
2573}
2574
2575impl NameAndAddress161 {
2576 pub fn validate(&self) -> Result<(), ValidationError> {
2577 if self.nm.chars().count() < 1 {
2578 return Err(ValidationError::new(
2579 1001,
2580 "nm is shorter than the minimum length of 1".to_string(),
2581 ));
2582 }
2583 if self.nm.chars().count() > 140 {
2584 return Err(ValidationError::new(
2585 1002,
2586 "nm exceeds the maximum length of 140".to_string(),
2587 ));
2588 }
2589 self.adr.validate()?;
2590 Ok(())
2591 }
2592}
2593
2594#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2596pub enum NamePrefix2Code {
2597 #[default]
2598 #[serde(rename = "DOCT")]
2599 CodeDOCT,
2600 #[serde(rename = "MADM")]
2601 CodeMADM,
2602 #[serde(rename = "MISS")]
2603 CodeMISS,
2604 #[serde(rename = "MIST")]
2605 CodeMIST,
2606 #[serde(rename = "MIKS")]
2607 CodeMIKS,
2608}
2609
2610impl NamePrefix2Code {
2611 pub fn validate(&self) -> Result<(), ValidationError> {
2612 Ok(())
2613 }
2614}
2615
2616#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2618pub struct OrganisationIdentification29 {
2619 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2620 pub any_bic: Option<String>,
2621 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2622 pub lei: Option<String>,
2623 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2624 pub othr: Option<Vec<GenericOrganisationIdentification1>>,
2625}
2626
2627impl OrganisationIdentification29 {
2628 pub fn validate(&self) -> Result<(), ValidationError> {
2629 if let Some(ref val) = self.any_bic {
2630 let pattern =
2631 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
2632 if !pattern.is_match(val) {
2633 return Err(ValidationError::new(
2634 1005,
2635 "any_bic does not match the required pattern".to_string(),
2636 ));
2637 }
2638 }
2639 if let Some(ref val) = self.lei {
2640 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
2641 if !pattern.is_match(val) {
2642 return Err(ValidationError::new(
2643 1005,
2644 "lei does not match the required pattern".to_string(),
2645 ));
2646 }
2647 }
2648 if let Some(ref vec) = self.othr {
2649 for item in vec {
2650 item.validate()?
2651 }
2652 }
2653 Ok(())
2654 }
2655}
2656
2657#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2659pub struct OrganisationIdentification291 {
2660 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2661 pub any_bic: Option<String>,
2662 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2663 pub lei: Option<String>,
2664 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2665 pub othr: Option<Vec<GenericOrganisationIdentification1>>,
2666}
2667
2668impl OrganisationIdentification291 {
2669 pub fn validate(&self) -> Result<(), ValidationError> {
2670 if let Some(ref val) = self.any_bic {
2671 let pattern =
2672 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
2673 if !pattern.is_match(val) {
2674 return Err(ValidationError::new(
2675 1005,
2676 "any_bic does not match the required pattern".to_string(),
2677 ));
2678 }
2679 }
2680 if let Some(ref val) = self.lei {
2681 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
2682 if !pattern.is_match(val) {
2683 return Err(ValidationError::new(
2684 1005,
2685 "lei does not match the required pattern".to_string(),
2686 ));
2687 }
2688 }
2689 if let Some(ref vec) = self.othr {
2690 for item in vec {
2691 item.validate()?
2692 }
2693 }
2694 Ok(())
2695 }
2696}
2697
2698#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2700pub struct OrganisationIdentification292 {
2701 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
2702 pub any_bic: Option<String>,
2703 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
2704 pub lei: Option<String>,
2705 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
2706 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
2707}
2708
2709impl OrganisationIdentification292 {
2710 pub fn validate(&self) -> Result<(), ValidationError> {
2711 if let Some(ref val) = self.any_bic {
2712 let pattern =
2713 Regex::new("[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}").unwrap();
2714 if !pattern.is_match(val) {
2715 return Err(ValidationError::new(
2716 1005,
2717 "any_bic does not match the required pattern".to_string(),
2718 ));
2719 }
2720 }
2721 if let Some(ref val) = self.lei {
2722 let pattern = Regex::new("[A-Z0-9]{18,18}[0-9]{2,2}").unwrap();
2723 if !pattern.is_match(val) {
2724 return Err(ValidationError::new(
2725 1005,
2726 "lei does not match the required pattern".to_string(),
2727 ));
2728 }
2729 }
2730 if let Some(ref vec) = self.othr {
2731 for item in vec {
2732 item.validate()?
2733 }
2734 }
2735 Ok(())
2736 }
2737}
2738
2739#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2741pub struct OrganisationIdentificationSchemeName1Choice {
2742 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2743 pub cd: Option<String>,
2744 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
2745 pub prtry: Option<String>,
2746}
2747
2748impl OrganisationIdentificationSchemeName1Choice {
2749 pub fn validate(&self) -> Result<(), ValidationError> {
2750 if let Some(ref val) = self.cd {
2751 if val.chars().count() < 1 {
2752 return Err(ValidationError::new(
2753 1001,
2754 "cd is shorter than the minimum length of 1".to_string(),
2755 ));
2756 }
2757 if val.chars().count() > 4 {
2758 return Err(ValidationError::new(
2759 1002,
2760 "cd exceeds the maximum length of 4".to_string(),
2761 ));
2762 }
2763 }
2764 if let Some(ref val) = self.prtry {
2765 if val.chars().count() < 1 {
2766 return Err(ValidationError::new(
2767 1001,
2768 "prtry is shorter than the minimum length of 1".to_string(),
2769 ));
2770 }
2771 if val.chars().count() > 35 {
2772 return Err(ValidationError::new(
2773 1002,
2774 "prtry exceeds the maximum length of 35".to_string(),
2775 ));
2776 }
2777 }
2778 Ok(())
2779 }
2780}
2781
2782#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2784pub struct OrganisationIdentificationSchemeName1Choice1 {
2785 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
2786 pub cd: Option<String>,
2787}
2788
2789impl OrganisationIdentificationSchemeName1Choice1 {
2790 pub fn validate(&self) -> Result<(), ValidationError> {
2791 if let Some(ref val) = self.cd {
2792 if val.chars().count() < 1 {
2793 return Err(ValidationError::new(
2794 1001,
2795 "cd is shorter than the minimum length of 1".to_string(),
2796 ));
2797 }
2798 if val.chars().count() > 4 {
2799 return Err(ValidationError::new(
2800 1002,
2801 "cd exceeds the maximum length of 4".to_string(),
2802 ));
2803 }
2804 }
2805 Ok(())
2806 }
2807}
2808
2809#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2811pub struct OtherContact1 {
2812 #[serde(rename = "ChanlTp")]
2813 pub chanl_tp: String,
2814 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2815 pub id: Option<String>,
2816}
2817
2818impl OtherContact1 {
2819 pub fn validate(&self) -> Result<(), ValidationError> {
2820 if self.chanl_tp.chars().count() < 1 {
2821 return Err(ValidationError::new(
2822 1001,
2823 "chanl_tp is shorter than the minimum length of 1".to_string(),
2824 ));
2825 }
2826 if self.chanl_tp.chars().count() > 4 {
2827 return Err(ValidationError::new(
2828 1002,
2829 "chanl_tp exceeds the maximum length of 4".to_string(),
2830 ));
2831 }
2832 if let Some(ref val) = self.id {
2833 if val.chars().count() < 1 {
2834 return Err(ValidationError::new(
2835 1001,
2836 "id is shorter than the minimum length of 1".to_string(),
2837 ));
2838 }
2839 if val.chars().count() > 128 {
2840 return Err(ValidationError::new(
2841 1002,
2842 "id exceeds the maximum length of 128".to_string(),
2843 ));
2844 }
2845 }
2846 Ok(())
2847 }
2848}
2849
2850#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2852pub struct Party38Choice {
2853 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
2854 pub org_id: Option<OrganisationIdentification29>,
2855 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
2856 pub prvt_id: Option<PersonIdentification13>,
2857}
2858
2859impl Party38Choice {
2860 pub fn validate(&self) -> Result<(), ValidationError> {
2861 if let Some(ref val) = self.org_id {
2862 val.validate()?
2863 }
2864 if let Some(ref val) = self.prvt_id {
2865 val.validate()?
2866 }
2867 Ok(())
2868 }
2869}
2870
2871#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2873pub struct Party38Choice1 {
2874 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
2875 pub org_id: Option<OrganisationIdentification291>,
2876 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
2877 pub prvt_id: Option<PersonIdentification131>,
2878}
2879
2880impl Party38Choice1 {
2881 pub fn validate(&self) -> Result<(), ValidationError> {
2882 if let Some(ref val) = self.org_id {
2883 val.validate()?
2884 }
2885 if let Some(ref val) = self.prvt_id {
2886 val.validate()?
2887 }
2888 Ok(())
2889 }
2890}
2891
2892#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2894pub struct Party38Choice2 {
2895 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
2896 pub org_id: Option<OrganisationIdentification292>,
2897 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
2898 pub prvt_id: Option<PersonIdentification132>,
2899}
2900
2901impl Party38Choice2 {
2902 pub fn validate(&self) -> Result<(), ValidationError> {
2903 if let Some(ref val) = self.org_id {
2904 val.validate()?
2905 }
2906 if let Some(ref val) = self.prvt_id {
2907 val.validate()?
2908 }
2909 Ok(())
2910 }
2911}
2912
2913#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2915pub struct PartyIdentification135 {
2916 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2917 pub nm: Option<String>,
2918 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2919 pub pstl_adr: Option<PostalAddress24>,
2920 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2921 pub id: Option<Party38Choice>,
2922 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2923 pub ctry_of_res: Option<String>,
2924 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
2925 pub ctct_dtls: Option<Contact4>,
2926}
2927
2928impl PartyIdentification135 {
2929 pub fn validate(&self) -> Result<(), ValidationError> {
2930 if let Some(ref val) = self.nm {
2931 if val.chars().count() < 1 {
2932 return Err(ValidationError::new(
2933 1001,
2934 "nm is shorter than the minimum length of 1".to_string(),
2935 ));
2936 }
2937 if val.chars().count() > 140 {
2938 return Err(ValidationError::new(
2939 1002,
2940 "nm exceeds the maximum length of 140".to_string(),
2941 ));
2942 }
2943 }
2944 if let Some(ref val) = self.pstl_adr {
2945 val.validate()?
2946 }
2947 if let Some(ref val) = self.id {
2948 val.validate()?
2949 }
2950 if let Some(ref val) = self.ctry_of_res {
2951 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
2952 if !pattern.is_match(val) {
2953 return Err(ValidationError::new(
2954 1005,
2955 "ctry_of_res does not match the required pattern".to_string(),
2956 ));
2957 }
2958 }
2959 if let Some(ref val) = self.ctct_dtls {
2960 val.validate()?
2961 }
2962 Ok(())
2963 }
2964}
2965
2966#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
2968pub struct PartyIdentification1351 {
2969 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
2970 pub nm: Option<String>,
2971 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
2972 pub pstl_adr: Option<PostalAddress241>,
2973 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
2974 pub id: Option<Party38Choice1>,
2975 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
2976 pub ctry_of_res: Option<String>,
2977}
2978
2979impl PartyIdentification1351 {
2980 pub fn validate(&self) -> Result<(), ValidationError> {
2981 if let Some(ref val) = self.nm {
2982 if val.chars().count() < 1 {
2983 return Err(ValidationError::new(
2984 1001,
2985 "nm is shorter than the minimum length of 1".to_string(),
2986 ));
2987 }
2988 if val.chars().count() > 140 {
2989 return Err(ValidationError::new(
2990 1002,
2991 "nm exceeds the maximum length of 140".to_string(),
2992 ));
2993 }
2994 }
2995 if let Some(ref val) = self.pstl_adr {
2996 val.validate()?
2997 }
2998 if let Some(ref val) = self.id {
2999 val.validate()?
3000 }
3001 if let Some(ref val) = self.ctry_of_res {
3002 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
3003 if !pattern.is_match(val) {
3004 return Err(ValidationError::new(
3005 1005,
3006 "ctry_of_res does not match the required pattern".to_string(),
3007 ));
3008 }
3009 }
3010 Ok(())
3011 }
3012}
3013
3014#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3016pub struct PartyIdentification1352 {
3017 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3018 pub nm: Option<String>,
3019 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3020 pub pstl_adr: Option<PostalAddress242>,
3021 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3022 pub id: Option<Party38Choice1>,
3023 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3024 pub ctry_of_res: Option<String>,
3025}
3026
3027impl PartyIdentification1352 {
3028 pub fn validate(&self) -> Result<(), ValidationError> {
3029 if let Some(ref val) = self.nm {
3030 if val.chars().count() < 1 {
3031 return Err(ValidationError::new(
3032 1001,
3033 "nm is shorter than the minimum length of 1".to_string(),
3034 ));
3035 }
3036 if val.chars().count() > 140 {
3037 return Err(ValidationError::new(
3038 1002,
3039 "nm exceeds the maximum length of 140".to_string(),
3040 ));
3041 }
3042 }
3043 if let Some(ref val) = self.pstl_adr {
3044 val.validate()?
3045 }
3046 if let Some(ref val) = self.id {
3047 val.validate()?
3048 }
3049 if let Some(ref val) = self.ctry_of_res {
3050 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
3051 if !pattern.is_match(val) {
3052 return Err(ValidationError::new(
3053 1005,
3054 "ctry_of_res does not match the required pattern".to_string(),
3055 ));
3056 }
3057 }
3058 Ok(())
3059 }
3060}
3061
3062#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3064pub struct PartyIdentification1353 {
3065 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
3066 pub nm: Option<String>,
3067 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3068 pub pstl_adr: Option<PostalAddress242>,
3069 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3070 pub id: Option<Party38Choice>,
3071 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3072 pub ctry_of_res: Option<String>,
3073 #[serde(rename = "CtctDtls", skip_serializing_if = "Option::is_none")]
3074 pub ctct_dtls: Option<Contact4>,
3075}
3076
3077impl PartyIdentification1353 {
3078 pub fn validate(&self) -> Result<(), ValidationError> {
3079 if let Some(ref val) = self.nm {
3080 if val.chars().count() < 1 {
3081 return Err(ValidationError::new(
3082 1001,
3083 "nm is shorter than the minimum length of 1".to_string(),
3084 ));
3085 }
3086 if val.chars().count() > 140 {
3087 return Err(ValidationError::new(
3088 1002,
3089 "nm exceeds the maximum length of 140".to_string(),
3090 ));
3091 }
3092 }
3093 if let Some(ref val) = self.pstl_adr {
3094 val.validate()?
3095 }
3096 if let Some(ref val) = self.id {
3097 val.validate()?
3098 }
3099 if let Some(ref val) = self.ctry_of_res {
3100 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
3101 if !pattern.is_match(val) {
3102 return Err(ValidationError::new(
3103 1005,
3104 "ctry_of_res does not match the required pattern".to_string(),
3105 ));
3106 }
3107 }
3108 if let Some(ref val) = self.ctct_dtls {
3109 val.validate()?
3110 }
3111 Ok(())
3112 }
3113}
3114
3115#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3117pub struct PartyIdentification1354 {
3118 #[serde(rename = "Nm")]
3119 pub nm: String,
3120 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
3121 pub pstl_adr: Option<PostalAddress242>,
3122 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
3123 pub id: Option<Party38Choice2>,
3124 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
3125 pub ctry_of_res: Option<String>,
3126}
3127
3128impl PartyIdentification1354 {
3129 pub fn validate(&self) -> Result<(), ValidationError> {
3130 if self.nm.chars().count() < 1 {
3131 return Err(ValidationError::new(
3132 1001,
3133 "nm is shorter than the minimum length of 1".to_string(),
3134 ));
3135 }
3136 if self.nm.chars().count() > 140 {
3137 return Err(ValidationError::new(
3138 1002,
3139 "nm exceeds the maximum length of 140".to_string(),
3140 ));
3141 }
3142 if let Some(ref val) = self.pstl_adr {
3143 val.validate()?
3144 }
3145 if let Some(ref val) = self.id {
3146 val.validate()?
3147 }
3148 if let Some(ref val) = self.ctry_of_res {
3149 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
3150 if !pattern.is_match(val) {
3151 return Err(ValidationError::new(
3152 1005,
3153 "ctry_of_res does not match the required pattern".to_string(),
3154 ));
3155 }
3156 }
3157 Ok(())
3158 }
3159}
3160
3161#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3163pub struct PaymentIdentification6 {
3164 #[serde(rename = "InstrId", skip_serializing_if = "Option::is_none")]
3165 pub instr_id: Option<String>,
3166 #[serde(rename = "EndToEndId")]
3167 pub end_to_end_id: String,
3168 #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
3169 pub uetr: Option<String>,
3170}
3171
3172impl PaymentIdentification6 {
3173 pub fn validate(&self) -> Result<(), ValidationError> {
3174 if let Some(ref val) = self.instr_id {
3175 if val.chars().count() < 1 {
3176 return Err(ValidationError::new(
3177 1001,
3178 "instr_id is shorter than the minimum length of 1".to_string(),
3179 ));
3180 }
3181 if val.chars().count() > 35 {
3182 return Err(ValidationError::new(
3183 1002,
3184 "instr_id exceeds the maximum length of 35".to_string(),
3185 ));
3186 }
3187 }
3188 if self.end_to_end_id.chars().count() < 1 {
3189 return Err(ValidationError::new(
3190 1001,
3191 "end_to_end_id is shorter than the minimum length of 1".to_string(),
3192 ));
3193 }
3194 if self.end_to_end_id.chars().count() > 35 {
3195 return Err(ValidationError::new(
3196 1002,
3197 "end_to_end_id exceeds the maximum length of 35".to_string(),
3198 ));
3199 }
3200 if let Some(ref val) = self.uetr {
3201 let pattern =
3202 Regex::new("[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}")
3203 .unwrap();
3204 if !pattern.is_match(val) {
3205 return Err(ValidationError::new(
3206 1005,
3207 "uetr does not match the required pattern".to_string(),
3208 ));
3209 }
3210 }
3211 Ok(())
3212 }
3213}
3214
3215#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3217pub struct PaymentInstruction291 {
3218 #[serde(rename = "PmtInfId")]
3219 pub pmt_inf_id: String,
3220 #[serde(rename = "PmtMtd")]
3221 pub pmt_mtd: PaymentMethod2Code,
3222 #[serde(rename = "BtchBookg", skip_serializing_if = "Option::is_none")]
3223 pub btch_bookg: Option<bool>,
3224 #[serde(rename = "ReqdColltnDt")]
3225 pub reqd_colltn_dt: String,
3226 #[serde(rename = "Cdtr")]
3227 pub cdtr: PartyIdentification1352,
3228 #[serde(rename = "CdtrAcct")]
3229 pub cdtr_acct: CashAccount38,
3230 #[serde(rename = "CdtrAgt")]
3231 pub cdtr_agt: BranchAndFinancialInstitutionIdentification62,
3232 #[serde(rename = "CdtrAgtAcct", skip_serializing_if = "Option::is_none")]
3233 pub cdtr_agt_acct: Option<CashAccount38>,
3234 #[serde(rename = "ChrgsAcct", skip_serializing_if = "Option::is_none")]
3235 pub chrgs_acct: Option<CashAccount38>,
3236 #[serde(rename = "ChrgsAcctAgt", skip_serializing_if = "Option::is_none")]
3237 pub chrgs_acct_agt: Option<BranchAndFinancialInstitutionIdentification63>,
3238 #[serde(rename = "DrctDbtTxInf")]
3239 pub drct_dbt_tx_inf: Vec<DirectDebitTransactionInformation231>,
3240}
3241
3242impl PaymentInstruction291 {
3243 pub fn validate(&self) -> Result<(), ValidationError> {
3244 if self.pmt_inf_id.chars().count() < 1 {
3245 return Err(ValidationError::new(
3246 1001,
3247 "pmt_inf_id is shorter than the minimum length of 1".to_string(),
3248 ));
3249 }
3250 if self.pmt_inf_id.chars().count() > 35 {
3251 return Err(ValidationError::new(
3252 1002,
3253 "pmt_inf_id exceeds the maximum length of 35".to_string(),
3254 ));
3255 }
3256 self.pmt_mtd.validate()?;
3257 self.cdtr.validate()?;
3258 self.cdtr_acct.validate()?;
3259 self.cdtr_agt.validate()?;
3260 if let Some(ref val) = self.cdtr_agt_acct {
3261 val.validate()?
3262 }
3263 if let Some(ref val) = self.chrgs_acct {
3264 val.validate()?
3265 }
3266 if let Some(ref val) = self.chrgs_acct_agt {
3267 val.validate()?
3268 }
3269 for item in &self.drct_dbt_tx_inf {
3270 item.validate()?
3271 }
3272 Ok(())
3273 }
3274}
3275
3276#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3278pub enum PaymentMethod2Code {
3279 #[default]
3280 #[serde(rename = "DD")]
3281 CodeDD,
3282}
3283
3284impl PaymentMethod2Code {
3285 pub fn validate(&self) -> Result<(), ValidationError> {
3286 Ok(())
3287 }
3288}
3289
3290#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3293pub struct PaymentTypeInformation291 {
3294 #[serde(rename = "InstrPrty", skip_serializing_if = "Option::is_none")]
3295 pub instr_prty: Option<Priority2Code>,
3296 #[serde(rename = "SvcLvl", skip_serializing_if = "Option::is_none")]
3297 pub svc_lvl: Option<Vec<ServiceLevel8Choice>>,
3298 #[serde(rename = "LclInstrm", skip_serializing_if = "Option::is_none")]
3299 pub lcl_instrm: Option<LocalInstrument2Choice>,
3300 #[serde(rename = "SeqTp", skip_serializing_if = "Option::is_none")]
3301 pub seq_tp: Option<SequenceType3Code>,
3302 #[serde(rename = "CtgyPurp", skip_serializing_if = "Option::is_none")]
3303 pub ctgy_purp: Option<CategoryPurpose1Choice>,
3304}
3305
3306impl PaymentTypeInformation291 {
3307 pub fn validate(&self) -> Result<(), ValidationError> {
3308 if let Some(ref val) = self.instr_prty {
3309 val.validate()?
3310 }
3311 if let Some(ref vec) = self.svc_lvl {
3312 for item in vec {
3313 item.validate()?
3314 }
3315 }
3316 if let Some(ref val) = self.lcl_instrm {
3317 val.validate()?
3318 }
3319 if let Some(ref val) = self.seq_tp {
3320 val.validate()?
3321 }
3322 if let Some(ref val) = self.ctgy_purp {
3323 val.validate()?
3324 }
3325 Ok(())
3326 }
3327}
3328
3329#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3331pub struct PersonIdentification13 {
3332 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3333 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
3334 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3335 pub othr: Option<Vec<GenericPersonIdentification1>>,
3336}
3337
3338impl PersonIdentification13 {
3339 pub fn validate(&self) -> Result<(), ValidationError> {
3340 if let Some(ref val) = self.dt_and_plc_of_birth {
3341 val.validate()?
3342 }
3343 if let Some(ref vec) = self.othr {
3344 for item in vec {
3345 item.validate()?
3346 }
3347 }
3348 Ok(())
3349 }
3350}
3351
3352#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3354pub struct PersonIdentification131 {
3355 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3356 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
3357 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3358 pub othr: Option<Vec<GenericPersonIdentification1>>,
3359}
3360
3361impl PersonIdentification131 {
3362 pub fn validate(&self) -> Result<(), ValidationError> {
3363 if let Some(ref val) = self.dt_and_plc_of_birth {
3364 val.validate()?
3365 }
3366 if let Some(ref vec) = self.othr {
3367 for item in vec {
3368 item.validate()?
3369 }
3370 }
3371 Ok(())
3372 }
3373}
3374
3375#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3377pub struct PersonIdentification132 {
3378 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
3379 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
3380 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
3381 pub othr: Option<Vec<GenericPersonIdentification11>>,
3382}
3383
3384impl PersonIdentification132 {
3385 pub fn validate(&self) -> Result<(), ValidationError> {
3386 if let Some(ref val) = self.dt_and_plc_of_birth {
3387 val.validate()?
3388 }
3389 if let Some(ref vec) = self.othr {
3390 for item in vec {
3391 item.validate()?
3392 }
3393 }
3394 Ok(())
3395 }
3396}
3397
3398#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3400pub struct PersonIdentificationSchemeName1Choice {
3401 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3402 pub cd: Option<String>,
3403 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
3404 pub prtry: Option<String>,
3405}
3406
3407impl PersonIdentificationSchemeName1Choice {
3408 pub fn validate(&self) -> Result<(), ValidationError> {
3409 if let Some(ref val) = self.cd {
3410 if val.chars().count() < 1 {
3411 return Err(ValidationError::new(
3412 1001,
3413 "cd is shorter than the minimum length of 1".to_string(),
3414 ));
3415 }
3416 if val.chars().count() > 4 {
3417 return Err(ValidationError::new(
3418 1002,
3419 "cd exceeds the maximum length of 4".to_string(),
3420 ));
3421 }
3422 }
3423 if let Some(ref val) = self.prtry {
3424 if val.chars().count() < 1 {
3425 return Err(ValidationError::new(
3426 1001,
3427 "prtry is shorter than the minimum length of 1".to_string(),
3428 ));
3429 }
3430 if val.chars().count() > 35 {
3431 return Err(ValidationError::new(
3432 1002,
3433 "prtry exceeds the maximum length of 35".to_string(),
3434 ));
3435 }
3436 }
3437 Ok(())
3438 }
3439}
3440
3441#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3443pub struct PersonIdentificationSchemeName1Choice1 {
3444 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
3445 pub cd: Option<String>,
3446}
3447
3448impl PersonIdentificationSchemeName1Choice1 {
3449 pub fn validate(&self) -> Result<(), ValidationError> {
3450 if let Some(ref val) = self.cd {
3451 if val.chars().count() < 1 {
3452 return Err(ValidationError::new(
3453 1001,
3454 "cd is shorter than the minimum length of 1".to_string(),
3455 ));
3456 }
3457 if val.chars().count() > 4 {
3458 return Err(ValidationError::new(
3459 1002,
3460 "cd exceeds the maximum length of 4".to_string(),
3461 ));
3462 }
3463 }
3464 Ok(())
3465 }
3466}
3467
3468#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3470pub struct PostalAddress24 {
3471 #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
3472 pub adr_tp: Option<AddressType3Choice>,
3473 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
3474 pub dept: Option<String>,
3475 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
3476 pub sub_dept: Option<String>,
3477 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
3478 pub strt_nm: Option<String>,
3479 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
3480 pub bldg_nb: Option<String>,
3481 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
3482 pub bldg_nm: Option<String>,
3483 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
3484 pub flr: Option<String>,
3485 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
3486 pub pst_bx: Option<String>,
3487 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
3488 pub room: Option<String>,
3489 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
3490 pub pst_cd: Option<String>,
3491 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
3492 pub twn_nm: Option<String>,
3493 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
3494 pub twn_lctn_nm: Option<String>,
3495 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
3496 pub dstrct_nm: Option<String>,
3497 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
3498 pub ctry_sub_dvsn: Option<String>,
3499 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
3500 pub ctry: Option<String>,
3501 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
3502 pub adr_line: Option<Vec<String>>,
3503}
3504
3505impl PostalAddress24 {
3506 pub fn validate(&self) -> Result<(), ValidationError> {
3507 if let Some(ref val) = self.adr_tp {
3508 val.validate()?
3509 }
3510 if let Some(ref val) = self.dept {
3511 if val.chars().count() < 1 {
3512 return Err(ValidationError::new(
3513 1001,
3514 "dept is shorter than the minimum length of 1".to_string(),
3515 ));
3516 }
3517 if val.chars().count() > 70 {
3518 return Err(ValidationError::new(
3519 1002,
3520 "dept exceeds the maximum length of 70".to_string(),
3521 ));
3522 }
3523 }
3524 if let Some(ref val) = self.sub_dept {
3525 if val.chars().count() < 1 {
3526 return Err(ValidationError::new(
3527 1001,
3528 "sub_dept is shorter than the minimum length of 1".to_string(),
3529 ));
3530 }
3531 if val.chars().count() > 70 {
3532 return Err(ValidationError::new(
3533 1002,
3534 "sub_dept exceeds the maximum length of 70".to_string(),
3535 ));
3536 }
3537 }
3538 if let Some(ref val) = self.strt_nm {
3539 if val.chars().count() < 1 {
3540 return Err(ValidationError::new(
3541 1001,
3542 "strt_nm is shorter than the minimum length of 1".to_string(),
3543 ));
3544 }
3545 if val.chars().count() > 70 {
3546 return Err(ValidationError::new(
3547 1002,
3548 "strt_nm exceeds the maximum length of 70".to_string(),
3549 ));
3550 }
3551 }
3552 if let Some(ref val) = self.bldg_nb {
3553 if val.chars().count() < 1 {
3554 return Err(ValidationError::new(
3555 1001,
3556 "bldg_nb is shorter than the minimum length of 1".to_string(),
3557 ));
3558 }
3559 if val.chars().count() > 16 {
3560 return Err(ValidationError::new(
3561 1002,
3562 "bldg_nb exceeds the maximum length of 16".to_string(),
3563 ));
3564 }
3565 }
3566 if let Some(ref val) = self.bldg_nm {
3567 if val.chars().count() < 1 {
3568 return Err(ValidationError::new(
3569 1001,
3570 "bldg_nm is shorter than the minimum length of 1".to_string(),
3571 ));
3572 }
3573 if val.chars().count() > 35 {
3574 return Err(ValidationError::new(
3575 1002,
3576 "bldg_nm exceeds the maximum length of 35".to_string(),
3577 ));
3578 }
3579 }
3580 if let Some(ref val) = self.flr {
3581 if val.chars().count() < 1 {
3582 return Err(ValidationError::new(
3583 1001,
3584 "flr is shorter than the minimum length of 1".to_string(),
3585 ));
3586 }
3587 if val.chars().count() > 70 {
3588 return Err(ValidationError::new(
3589 1002,
3590 "flr exceeds the maximum length of 70".to_string(),
3591 ));
3592 }
3593 }
3594 if let Some(ref val) = self.pst_bx {
3595 if val.chars().count() < 1 {
3596 return Err(ValidationError::new(
3597 1001,
3598 "pst_bx is shorter than the minimum length of 1".to_string(),
3599 ));
3600 }
3601 if val.chars().count() > 16 {
3602 return Err(ValidationError::new(
3603 1002,
3604 "pst_bx exceeds the maximum length of 16".to_string(),
3605 ));
3606 }
3607 }
3608 if let Some(ref val) = self.room {
3609 if val.chars().count() < 1 {
3610 return Err(ValidationError::new(
3611 1001,
3612 "room is shorter than the minimum length of 1".to_string(),
3613 ));
3614 }
3615 if val.chars().count() > 70 {
3616 return Err(ValidationError::new(
3617 1002,
3618 "room exceeds the maximum length of 70".to_string(),
3619 ));
3620 }
3621 }
3622 if let Some(ref val) = self.pst_cd {
3623 if val.chars().count() < 1 {
3624 return Err(ValidationError::new(
3625 1001,
3626 "pst_cd is shorter than the minimum length of 1".to_string(),
3627 ));
3628 }
3629 if val.chars().count() > 16 {
3630 return Err(ValidationError::new(
3631 1002,
3632 "pst_cd exceeds the maximum length of 16".to_string(),
3633 ));
3634 }
3635 }
3636 if let Some(ref val) = self.twn_nm {
3637 if val.chars().count() < 1 {
3638 return Err(ValidationError::new(
3639 1001,
3640 "twn_nm is shorter than the minimum length of 1".to_string(),
3641 ));
3642 }
3643 if val.chars().count() > 35 {
3644 return Err(ValidationError::new(
3645 1002,
3646 "twn_nm exceeds the maximum length of 35".to_string(),
3647 ));
3648 }
3649 }
3650 if let Some(ref val) = self.twn_lctn_nm {
3651 if val.chars().count() < 1 {
3652 return Err(ValidationError::new(
3653 1001,
3654 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
3655 ));
3656 }
3657 if val.chars().count() > 35 {
3658 return Err(ValidationError::new(
3659 1002,
3660 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
3661 ));
3662 }
3663 }
3664 if let Some(ref val) = self.dstrct_nm {
3665 if val.chars().count() < 1 {
3666 return Err(ValidationError::new(
3667 1001,
3668 "dstrct_nm is shorter than the minimum length of 1".to_string(),
3669 ));
3670 }
3671 if val.chars().count() > 35 {
3672 return Err(ValidationError::new(
3673 1002,
3674 "dstrct_nm exceeds the maximum length of 35".to_string(),
3675 ));
3676 }
3677 }
3678 if let Some(ref val) = self.ctry_sub_dvsn {
3679 if val.chars().count() < 1 {
3680 return Err(ValidationError::new(
3681 1001,
3682 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
3683 ));
3684 }
3685 if val.chars().count() > 35 {
3686 return Err(ValidationError::new(
3687 1002,
3688 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
3689 ));
3690 }
3691 }
3692 if let Some(ref val) = self.ctry {
3693 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
3694 if !pattern.is_match(val) {
3695 return Err(ValidationError::new(
3696 1005,
3697 "ctry does not match the required pattern".to_string(),
3698 ));
3699 }
3700 }
3701 if let Some(ref vec) = self.adr_line {
3702 for item in vec {
3703 if item.chars().count() < 1 {
3704 return Err(ValidationError::new(
3705 1001,
3706 "adr_line is shorter than the minimum length of 1".to_string(),
3707 ));
3708 }
3709 if item.chars().count() > 70 {
3710 return Err(ValidationError::new(
3711 1002,
3712 "adr_line exceeds the maximum length of 70".to_string(),
3713 ));
3714 }
3715 }
3716 }
3717 Ok(())
3718 }
3719}
3720
3721#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3723pub struct PostalAddress241 {
3724 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
3725 pub dept: Option<String>,
3726 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
3727 pub sub_dept: Option<String>,
3728 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
3729 pub strt_nm: Option<String>,
3730 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
3731 pub bldg_nb: Option<String>,
3732 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
3733 pub bldg_nm: Option<String>,
3734 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
3735 pub flr: Option<String>,
3736 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
3737 pub pst_bx: Option<String>,
3738 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
3739 pub room: Option<String>,
3740 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
3741 pub pst_cd: Option<String>,
3742 #[serde(rename = "TwnNm")]
3743 pub twn_nm: String,
3744 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
3745 pub twn_lctn_nm: Option<String>,
3746 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
3747 pub dstrct_nm: Option<String>,
3748 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
3749 pub ctry_sub_dvsn: Option<String>,
3750 #[serde(rename = "Ctry")]
3751 pub ctry: String,
3752 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
3753 pub adr_line: Option<Vec<String>>,
3754}
3755
3756impl PostalAddress241 {
3757 pub fn validate(&self) -> Result<(), ValidationError> {
3758 if let Some(ref val) = self.dept {
3759 if val.chars().count() < 1 {
3760 return Err(ValidationError::new(
3761 1001,
3762 "dept is shorter than the minimum length of 1".to_string(),
3763 ));
3764 }
3765 if val.chars().count() > 70 {
3766 return Err(ValidationError::new(
3767 1002,
3768 "dept exceeds the maximum length of 70".to_string(),
3769 ));
3770 }
3771 }
3772 if let Some(ref val) = self.sub_dept {
3773 if val.chars().count() < 1 {
3774 return Err(ValidationError::new(
3775 1001,
3776 "sub_dept is shorter than the minimum length of 1".to_string(),
3777 ));
3778 }
3779 if val.chars().count() > 70 {
3780 return Err(ValidationError::new(
3781 1002,
3782 "sub_dept exceeds the maximum length of 70".to_string(),
3783 ));
3784 }
3785 }
3786 if let Some(ref val) = self.strt_nm {
3787 if val.chars().count() < 1 {
3788 return Err(ValidationError::new(
3789 1001,
3790 "strt_nm is shorter than the minimum length of 1".to_string(),
3791 ));
3792 }
3793 if val.chars().count() > 70 {
3794 return Err(ValidationError::new(
3795 1002,
3796 "strt_nm exceeds the maximum length of 70".to_string(),
3797 ));
3798 }
3799 }
3800 if let Some(ref val) = self.bldg_nb {
3801 if val.chars().count() < 1 {
3802 return Err(ValidationError::new(
3803 1001,
3804 "bldg_nb is shorter than the minimum length of 1".to_string(),
3805 ));
3806 }
3807 if val.chars().count() > 16 {
3808 return Err(ValidationError::new(
3809 1002,
3810 "bldg_nb exceeds the maximum length of 16".to_string(),
3811 ));
3812 }
3813 }
3814 if let Some(ref val) = self.bldg_nm {
3815 if val.chars().count() < 1 {
3816 return Err(ValidationError::new(
3817 1001,
3818 "bldg_nm is shorter than the minimum length of 1".to_string(),
3819 ));
3820 }
3821 if val.chars().count() > 35 {
3822 return Err(ValidationError::new(
3823 1002,
3824 "bldg_nm exceeds the maximum length of 35".to_string(),
3825 ));
3826 }
3827 }
3828 if let Some(ref val) = self.flr {
3829 if val.chars().count() < 1 {
3830 return Err(ValidationError::new(
3831 1001,
3832 "flr is shorter than the minimum length of 1".to_string(),
3833 ));
3834 }
3835 if val.chars().count() > 70 {
3836 return Err(ValidationError::new(
3837 1002,
3838 "flr exceeds the maximum length of 70".to_string(),
3839 ));
3840 }
3841 }
3842 if let Some(ref val) = self.pst_bx {
3843 if val.chars().count() < 1 {
3844 return Err(ValidationError::new(
3845 1001,
3846 "pst_bx is shorter than the minimum length of 1".to_string(),
3847 ));
3848 }
3849 if val.chars().count() > 16 {
3850 return Err(ValidationError::new(
3851 1002,
3852 "pst_bx exceeds the maximum length of 16".to_string(),
3853 ));
3854 }
3855 }
3856 if let Some(ref val) = self.room {
3857 if val.chars().count() < 1 {
3858 return Err(ValidationError::new(
3859 1001,
3860 "room is shorter than the minimum length of 1".to_string(),
3861 ));
3862 }
3863 if val.chars().count() > 70 {
3864 return Err(ValidationError::new(
3865 1002,
3866 "room exceeds the maximum length of 70".to_string(),
3867 ));
3868 }
3869 }
3870 if let Some(ref val) = self.pst_cd {
3871 if val.chars().count() < 1 {
3872 return Err(ValidationError::new(
3873 1001,
3874 "pst_cd is shorter than the minimum length of 1".to_string(),
3875 ));
3876 }
3877 if val.chars().count() > 16 {
3878 return Err(ValidationError::new(
3879 1002,
3880 "pst_cd exceeds the maximum length of 16".to_string(),
3881 ));
3882 }
3883 }
3884 if self.twn_nm.chars().count() < 1 {
3885 return Err(ValidationError::new(
3886 1001,
3887 "twn_nm is shorter than the minimum length of 1".to_string(),
3888 ));
3889 }
3890 if self.twn_nm.chars().count() > 35 {
3891 return Err(ValidationError::new(
3892 1002,
3893 "twn_nm exceeds the maximum length of 35".to_string(),
3894 ));
3895 }
3896 if let Some(ref val) = self.twn_lctn_nm {
3897 if val.chars().count() < 1 {
3898 return Err(ValidationError::new(
3899 1001,
3900 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
3901 ));
3902 }
3903 if val.chars().count() > 35 {
3904 return Err(ValidationError::new(
3905 1002,
3906 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
3907 ));
3908 }
3909 }
3910 if let Some(ref val) = self.dstrct_nm {
3911 if val.chars().count() < 1 {
3912 return Err(ValidationError::new(
3913 1001,
3914 "dstrct_nm is shorter than the minimum length of 1".to_string(),
3915 ));
3916 }
3917 if val.chars().count() > 35 {
3918 return Err(ValidationError::new(
3919 1002,
3920 "dstrct_nm exceeds the maximum length of 35".to_string(),
3921 ));
3922 }
3923 }
3924 if let Some(ref val) = self.ctry_sub_dvsn {
3925 if val.chars().count() < 1 {
3926 return Err(ValidationError::new(
3927 1001,
3928 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
3929 ));
3930 }
3931 if val.chars().count() > 35 {
3932 return Err(ValidationError::new(
3933 1002,
3934 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
3935 ));
3936 }
3937 }
3938 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
3939 if !pattern.is_match(&self.ctry) {
3940 return Err(ValidationError::new(
3941 1005,
3942 "ctry does not match the required pattern".to_string(),
3943 ));
3944 }
3945 if let Some(ref vec) = self.adr_line {
3946 for item in vec {
3947 if item.chars().count() < 1 {
3948 return Err(ValidationError::new(
3949 1001,
3950 "adr_line is shorter than the minimum length of 1".to_string(),
3951 ));
3952 }
3953 if item.chars().count() > 70 {
3954 return Err(ValidationError::new(
3955 1002,
3956 "adr_line exceeds the maximum length of 70".to_string(),
3957 ));
3958 }
3959 }
3960 }
3961 Ok(())
3962 }
3963}
3964
3965#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
3967pub struct PostalAddress242 {
3968 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
3969 pub dept: Option<String>,
3970 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
3971 pub sub_dept: Option<String>,
3972 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
3973 pub strt_nm: Option<String>,
3974 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
3975 pub bldg_nb: Option<String>,
3976 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
3977 pub bldg_nm: Option<String>,
3978 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
3979 pub flr: Option<String>,
3980 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
3981 pub pst_bx: Option<String>,
3982 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
3983 pub room: Option<String>,
3984 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
3985 pub pst_cd: Option<String>,
3986 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
3987 pub twn_nm: Option<String>,
3988 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
3989 pub twn_lctn_nm: Option<String>,
3990 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
3991 pub dstrct_nm: Option<String>,
3992 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
3993 pub ctry_sub_dvsn: Option<String>,
3994 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
3995 pub ctry: Option<String>,
3996 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
3997 pub adr_line: Option<Vec<String>>,
3998}
3999
4000impl PostalAddress242 {
4001 pub fn validate(&self) -> Result<(), ValidationError> {
4002 if let Some(ref val) = self.dept {
4003 if val.chars().count() < 1 {
4004 return Err(ValidationError::new(
4005 1001,
4006 "dept is shorter than the minimum length of 1".to_string(),
4007 ));
4008 }
4009 if val.chars().count() > 70 {
4010 return Err(ValidationError::new(
4011 1002,
4012 "dept exceeds the maximum length of 70".to_string(),
4013 ));
4014 }
4015 }
4016 if let Some(ref val) = self.sub_dept {
4017 if val.chars().count() < 1 {
4018 return Err(ValidationError::new(
4019 1001,
4020 "sub_dept is shorter than the minimum length of 1".to_string(),
4021 ));
4022 }
4023 if val.chars().count() > 70 {
4024 return Err(ValidationError::new(
4025 1002,
4026 "sub_dept exceeds the maximum length of 70".to_string(),
4027 ));
4028 }
4029 }
4030 if let Some(ref val) = self.strt_nm {
4031 if val.chars().count() < 1 {
4032 return Err(ValidationError::new(
4033 1001,
4034 "strt_nm is shorter than the minimum length of 1".to_string(),
4035 ));
4036 }
4037 if val.chars().count() > 70 {
4038 return Err(ValidationError::new(
4039 1002,
4040 "strt_nm exceeds the maximum length of 70".to_string(),
4041 ));
4042 }
4043 }
4044 if let Some(ref val) = self.bldg_nb {
4045 if val.chars().count() < 1 {
4046 return Err(ValidationError::new(
4047 1001,
4048 "bldg_nb is shorter than the minimum length of 1".to_string(),
4049 ));
4050 }
4051 if val.chars().count() > 16 {
4052 return Err(ValidationError::new(
4053 1002,
4054 "bldg_nb exceeds the maximum length of 16".to_string(),
4055 ));
4056 }
4057 }
4058 if let Some(ref val) = self.bldg_nm {
4059 if val.chars().count() < 1 {
4060 return Err(ValidationError::new(
4061 1001,
4062 "bldg_nm is shorter than the minimum length of 1".to_string(),
4063 ));
4064 }
4065 if val.chars().count() > 35 {
4066 return Err(ValidationError::new(
4067 1002,
4068 "bldg_nm exceeds the maximum length of 35".to_string(),
4069 ));
4070 }
4071 }
4072 if let Some(ref val) = self.flr {
4073 if val.chars().count() < 1 {
4074 return Err(ValidationError::new(
4075 1001,
4076 "flr is shorter than the minimum length of 1".to_string(),
4077 ));
4078 }
4079 if val.chars().count() > 70 {
4080 return Err(ValidationError::new(
4081 1002,
4082 "flr exceeds the maximum length of 70".to_string(),
4083 ));
4084 }
4085 }
4086 if let Some(ref val) = self.pst_bx {
4087 if val.chars().count() < 1 {
4088 return Err(ValidationError::new(
4089 1001,
4090 "pst_bx is shorter than the minimum length of 1".to_string(),
4091 ));
4092 }
4093 if val.chars().count() > 16 {
4094 return Err(ValidationError::new(
4095 1002,
4096 "pst_bx exceeds the maximum length of 16".to_string(),
4097 ));
4098 }
4099 }
4100 if let Some(ref val) = self.room {
4101 if val.chars().count() < 1 {
4102 return Err(ValidationError::new(
4103 1001,
4104 "room is shorter than the minimum length of 1".to_string(),
4105 ));
4106 }
4107 if val.chars().count() > 70 {
4108 return Err(ValidationError::new(
4109 1002,
4110 "room exceeds the maximum length of 70".to_string(),
4111 ));
4112 }
4113 }
4114 if let Some(ref val) = self.pst_cd {
4115 if val.chars().count() < 1 {
4116 return Err(ValidationError::new(
4117 1001,
4118 "pst_cd is shorter than the minimum length of 1".to_string(),
4119 ));
4120 }
4121 if val.chars().count() > 16 {
4122 return Err(ValidationError::new(
4123 1002,
4124 "pst_cd exceeds the maximum length of 16".to_string(),
4125 ));
4126 }
4127 }
4128 if let Some(ref val) = self.twn_nm {
4129 if val.chars().count() < 1 {
4130 return Err(ValidationError::new(
4131 1001,
4132 "twn_nm is shorter than the minimum length of 1".to_string(),
4133 ));
4134 }
4135 if val.chars().count() > 35 {
4136 return Err(ValidationError::new(
4137 1002,
4138 "twn_nm exceeds the maximum length of 35".to_string(),
4139 ));
4140 }
4141 }
4142 if let Some(ref val) = self.twn_lctn_nm {
4143 if val.chars().count() < 1 {
4144 return Err(ValidationError::new(
4145 1001,
4146 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
4147 ));
4148 }
4149 if val.chars().count() > 35 {
4150 return Err(ValidationError::new(
4151 1002,
4152 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
4153 ));
4154 }
4155 }
4156 if let Some(ref val) = self.dstrct_nm {
4157 if val.chars().count() < 1 {
4158 return Err(ValidationError::new(
4159 1001,
4160 "dstrct_nm is shorter than the minimum length of 1".to_string(),
4161 ));
4162 }
4163 if val.chars().count() > 35 {
4164 return Err(ValidationError::new(
4165 1002,
4166 "dstrct_nm exceeds the maximum length of 35".to_string(),
4167 ));
4168 }
4169 }
4170 if let Some(ref val) = self.ctry_sub_dvsn {
4171 if val.chars().count() < 1 {
4172 return Err(ValidationError::new(
4173 1001,
4174 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
4175 ));
4176 }
4177 if val.chars().count() > 35 {
4178 return Err(ValidationError::new(
4179 1002,
4180 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
4181 ));
4182 }
4183 }
4184 if let Some(ref val) = self.ctry {
4185 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4186 if !pattern.is_match(val) {
4187 return Err(ValidationError::new(
4188 1005,
4189 "ctry does not match the required pattern".to_string(),
4190 ));
4191 }
4192 }
4193 if let Some(ref vec) = self.adr_line {
4194 for item in vec {
4195 if item.chars().count() < 1 {
4196 return Err(ValidationError::new(
4197 1001,
4198 "adr_line is shorter than the minimum length of 1".to_string(),
4199 ));
4200 }
4201 if item.chars().count() > 70 {
4202 return Err(ValidationError::new(
4203 1002,
4204 "adr_line exceeds the maximum length of 70".to_string(),
4205 ));
4206 }
4207 }
4208 }
4209 Ok(())
4210 }
4211}
4212
4213#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4215pub struct PostalAddress243 {
4216 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
4217 pub dept: Option<String>,
4218 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
4219 pub sub_dept: Option<String>,
4220 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
4221 pub strt_nm: Option<String>,
4222 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
4223 pub bldg_nb: Option<String>,
4224 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
4225 pub bldg_nm: Option<String>,
4226 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
4227 pub flr: Option<String>,
4228 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
4229 pub pst_bx: Option<String>,
4230 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
4231 pub room: Option<String>,
4232 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
4233 pub pst_cd: Option<String>,
4234 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
4235 pub twn_nm: Option<String>,
4236 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
4237 pub twn_lctn_nm: Option<String>,
4238 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
4239 pub dstrct_nm: Option<String>,
4240 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
4241 pub ctry_sub_dvsn: Option<String>,
4242 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
4243 pub ctry: Option<String>,
4244 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
4245 pub adr_line: Option<Vec<String>>,
4246}
4247
4248impl PostalAddress243 {
4249 pub fn validate(&self) -> Result<(), ValidationError> {
4250 if let Some(ref val) = self.dept {
4251 if val.chars().count() < 1 {
4252 return Err(ValidationError::new(
4253 1001,
4254 "dept is shorter than the minimum length of 1".to_string(),
4255 ));
4256 }
4257 if val.chars().count() > 70 {
4258 return Err(ValidationError::new(
4259 1002,
4260 "dept exceeds the maximum length of 70".to_string(),
4261 ));
4262 }
4263 }
4264 if let Some(ref val) = self.sub_dept {
4265 if val.chars().count() < 1 {
4266 return Err(ValidationError::new(
4267 1001,
4268 "sub_dept is shorter than the minimum length of 1".to_string(),
4269 ));
4270 }
4271 if val.chars().count() > 70 {
4272 return Err(ValidationError::new(
4273 1002,
4274 "sub_dept exceeds the maximum length of 70".to_string(),
4275 ));
4276 }
4277 }
4278 if let Some(ref val) = self.strt_nm {
4279 if val.chars().count() < 1 {
4280 return Err(ValidationError::new(
4281 1001,
4282 "strt_nm is shorter than the minimum length of 1".to_string(),
4283 ));
4284 }
4285 if val.chars().count() > 70 {
4286 return Err(ValidationError::new(
4287 1002,
4288 "strt_nm exceeds the maximum length of 70".to_string(),
4289 ));
4290 }
4291 }
4292 if let Some(ref val) = self.bldg_nb {
4293 if val.chars().count() < 1 {
4294 return Err(ValidationError::new(
4295 1001,
4296 "bldg_nb is shorter than the minimum length of 1".to_string(),
4297 ));
4298 }
4299 if val.chars().count() > 16 {
4300 return Err(ValidationError::new(
4301 1002,
4302 "bldg_nb exceeds the maximum length of 16".to_string(),
4303 ));
4304 }
4305 }
4306 if let Some(ref val) = self.bldg_nm {
4307 if val.chars().count() < 1 {
4308 return Err(ValidationError::new(
4309 1001,
4310 "bldg_nm is shorter than the minimum length of 1".to_string(),
4311 ));
4312 }
4313 if val.chars().count() > 35 {
4314 return Err(ValidationError::new(
4315 1002,
4316 "bldg_nm exceeds the maximum length of 35".to_string(),
4317 ));
4318 }
4319 }
4320 if let Some(ref val) = self.flr {
4321 if val.chars().count() < 1 {
4322 return Err(ValidationError::new(
4323 1001,
4324 "flr is shorter than the minimum length of 1".to_string(),
4325 ));
4326 }
4327 if val.chars().count() > 70 {
4328 return Err(ValidationError::new(
4329 1002,
4330 "flr exceeds the maximum length of 70".to_string(),
4331 ));
4332 }
4333 }
4334 if let Some(ref val) = self.pst_bx {
4335 if val.chars().count() < 1 {
4336 return Err(ValidationError::new(
4337 1001,
4338 "pst_bx is shorter than the minimum length of 1".to_string(),
4339 ));
4340 }
4341 if val.chars().count() > 16 {
4342 return Err(ValidationError::new(
4343 1002,
4344 "pst_bx exceeds the maximum length of 16".to_string(),
4345 ));
4346 }
4347 }
4348 if let Some(ref val) = self.room {
4349 if val.chars().count() < 1 {
4350 return Err(ValidationError::new(
4351 1001,
4352 "room is shorter than the minimum length of 1".to_string(),
4353 ));
4354 }
4355 if val.chars().count() > 70 {
4356 return Err(ValidationError::new(
4357 1002,
4358 "room exceeds the maximum length of 70".to_string(),
4359 ));
4360 }
4361 }
4362 if let Some(ref val) = self.pst_cd {
4363 if val.chars().count() < 1 {
4364 return Err(ValidationError::new(
4365 1001,
4366 "pst_cd is shorter than the minimum length of 1".to_string(),
4367 ));
4368 }
4369 if val.chars().count() > 16 {
4370 return Err(ValidationError::new(
4371 1002,
4372 "pst_cd exceeds the maximum length of 16".to_string(),
4373 ));
4374 }
4375 }
4376 if let Some(ref val) = self.twn_nm {
4377 if val.chars().count() < 1 {
4378 return Err(ValidationError::new(
4379 1001,
4380 "twn_nm is shorter than the minimum length of 1".to_string(),
4381 ));
4382 }
4383 if val.chars().count() > 35 {
4384 return Err(ValidationError::new(
4385 1002,
4386 "twn_nm exceeds the maximum length of 35".to_string(),
4387 ));
4388 }
4389 }
4390 if let Some(ref val) = self.twn_lctn_nm {
4391 if val.chars().count() < 1 {
4392 return Err(ValidationError::new(
4393 1001,
4394 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
4395 ));
4396 }
4397 if val.chars().count() > 35 {
4398 return Err(ValidationError::new(
4399 1002,
4400 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
4401 ));
4402 }
4403 }
4404 if let Some(ref val) = self.dstrct_nm {
4405 if val.chars().count() < 1 {
4406 return Err(ValidationError::new(
4407 1001,
4408 "dstrct_nm is shorter than the minimum length of 1".to_string(),
4409 ));
4410 }
4411 if val.chars().count() > 35 {
4412 return Err(ValidationError::new(
4413 1002,
4414 "dstrct_nm exceeds the maximum length of 35".to_string(),
4415 ));
4416 }
4417 }
4418 if let Some(ref val) = self.ctry_sub_dvsn {
4419 if val.chars().count() < 1 {
4420 return Err(ValidationError::new(
4421 1001,
4422 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
4423 ));
4424 }
4425 if val.chars().count() > 35 {
4426 return Err(ValidationError::new(
4427 1002,
4428 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
4429 ));
4430 }
4431 }
4432 if let Some(ref val) = self.ctry {
4433 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4434 if !pattern.is_match(val) {
4435 return Err(ValidationError::new(
4436 1005,
4437 "ctry does not match the required pattern".to_string(),
4438 ));
4439 }
4440 }
4441 if let Some(ref vec) = self.adr_line {
4442 for item in vec {
4443 if item.chars().count() < 1 {
4444 return Err(ValidationError::new(
4445 1001,
4446 "adr_line is shorter than the minimum length of 1".to_string(),
4447 ));
4448 }
4449 if item.chars().count() > 35 {
4450 return Err(ValidationError::new(
4451 1002,
4452 "adr_line exceeds the maximum length of 35".to_string(),
4453 ));
4454 }
4455 }
4456 }
4457 Ok(())
4458 }
4459}
4460
4461#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4463pub struct PostalAddress244 {
4464 #[serde(rename = "AdrTp", skip_serializing_if = "Option::is_none")]
4465 pub adr_tp: Option<AddressType3Choice>,
4466 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
4467 pub dept: Option<String>,
4468 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
4469 pub sub_dept: Option<String>,
4470 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
4471 pub strt_nm: Option<String>,
4472 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
4473 pub bldg_nb: Option<String>,
4474 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
4475 pub bldg_nm: Option<String>,
4476 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
4477 pub flr: Option<String>,
4478 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
4479 pub pst_bx: Option<String>,
4480 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
4481 pub room: Option<String>,
4482 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
4483 pub pst_cd: Option<String>,
4484 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
4485 pub twn_nm: Option<String>,
4486 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
4487 pub twn_lctn_nm: Option<String>,
4488 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
4489 pub dstrct_nm: Option<String>,
4490 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
4491 pub ctry_sub_dvsn: Option<String>,
4492 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
4493 pub ctry: Option<String>,
4494 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
4495 pub adr_line: Option<Vec<String>>,
4496}
4497
4498impl PostalAddress244 {
4499 pub fn validate(&self) -> Result<(), ValidationError> {
4500 if let Some(ref val) = self.adr_tp {
4501 val.validate()?
4502 }
4503 if let Some(ref val) = self.dept {
4504 if val.chars().count() < 1 {
4505 return Err(ValidationError::new(
4506 1001,
4507 "dept is shorter than the minimum length of 1".to_string(),
4508 ));
4509 }
4510 if val.chars().count() > 70 {
4511 return Err(ValidationError::new(
4512 1002,
4513 "dept exceeds the maximum length of 70".to_string(),
4514 ));
4515 }
4516 }
4517 if let Some(ref val) = self.sub_dept {
4518 if val.chars().count() < 1 {
4519 return Err(ValidationError::new(
4520 1001,
4521 "sub_dept is shorter than the minimum length of 1".to_string(),
4522 ));
4523 }
4524 if val.chars().count() > 70 {
4525 return Err(ValidationError::new(
4526 1002,
4527 "sub_dept exceeds the maximum length of 70".to_string(),
4528 ));
4529 }
4530 }
4531 if let Some(ref val) = self.strt_nm {
4532 if val.chars().count() < 1 {
4533 return Err(ValidationError::new(
4534 1001,
4535 "strt_nm is shorter than the minimum length of 1".to_string(),
4536 ));
4537 }
4538 if val.chars().count() > 70 {
4539 return Err(ValidationError::new(
4540 1002,
4541 "strt_nm exceeds the maximum length of 70".to_string(),
4542 ));
4543 }
4544 }
4545 if let Some(ref val) = self.bldg_nb {
4546 if val.chars().count() < 1 {
4547 return Err(ValidationError::new(
4548 1001,
4549 "bldg_nb is shorter than the minimum length of 1".to_string(),
4550 ));
4551 }
4552 if val.chars().count() > 16 {
4553 return Err(ValidationError::new(
4554 1002,
4555 "bldg_nb exceeds the maximum length of 16".to_string(),
4556 ));
4557 }
4558 }
4559 if let Some(ref val) = self.bldg_nm {
4560 if val.chars().count() < 1 {
4561 return Err(ValidationError::new(
4562 1001,
4563 "bldg_nm is shorter than the minimum length of 1".to_string(),
4564 ));
4565 }
4566 if val.chars().count() > 35 {
4567 return Err(ValidationError::new(
4568 1002,
4569 "bldg_nm exceeds the maximum length of 35".to_string(),
4570 ));
4571 }
4572 }
4573 if let Some(ref val) = self.flr {
4574 if val.chars().count() < 1 {
4575 return Err(ValidationError::new(
4576 1001,
4577 "flr is shorter than the minimum length of 1".to_string(),
4578 ));
4579 }
4580 if val.chars().count() > 70 {
4581 return Err(ValidationError::new(
4582 1002,
4583 "flr exceeds the maximum length of 70".to_string(),
4584 ));
4585 }
4586 }
4587 if let Some(ref val) = self.pst_bx {
4588 if val.chars().count() < 1 {
4589 return Err(ValidationError::new(
4590 1001,
4591 "pst_bx is shorter than the minimum length of 1".to_string(),
4592 ));
4593 }
4594 if val.chars().count() > 16 {
4595 return Err(ValidationError::new(
4596 1002,
4597 "pst_bx exceeds the maximum length of 16".to_string(),
4598 ));
4599 }
4600 }
4601 if let Some(ref val) = self.room {
4602 if val.chars().count() < 1 {
4603 return Err(ValidationError::new(
4604 1001,
4605 "room is shorter than the minimum length of 1".to_string(),
4606 ));
4607 }
4608 if val.chars().count() > 70 {
4609 return Err(ValidationError::new(
4610 1002,
4611 "room exceeds the maximum length of 70".to_string(),
4612 ));
4613 }
4614 }
4615 if let Some(ref val) = self.pst_cd {
4616 if val.chars().count() < 1 {
4617 return Err(ValidationError::new(
4618 1001,
4619 "pst_cd is shorter than the minimum length of 1".to_string(),
4620 ));
4621 }
4622 if val.chars().count() > 16 {
4623 return Err(ValidationError::new(
4624 1002,
4625 "pst_cd exceeds the maximum length of 16".to_string(),
4626 ));
4627 }
4628 }
4629 if let Some(ref val) = self.twn_nm {
4630 if val.chars().count() < 1 {
4631 return Err(ValidationError::new(
4632 1001,
4633 "twn_nm is shorter than the minimum length of 1".to_string(),
4634 ));
4635 }
4636 if val.chars().count() > 35 {
4637 return Err(ValidationError::new(
4638 1002,
4639 "twn_nm exceeds the maximum length of 35".to_string(),
4640 ));
4641 }
4642 }
4643 if let Some(ref val) = self.twn_lctn_nm {
4644 if val.chars().count() < 1 {
4645 return Err(ValidationError::new(
4646 1001,
4647 "twn_lctn_nm is shorter than the minimum length of 1".to_string(),
4648 ));
4649 }
4650 if val.chars().count() > 35 {
4651 return Err(ValidationError::new(
4652 1002,
4653 "twn_lctn_nm exceeds the maximum length of 35".to_string(),
4654 ));
4655 }
4656 }
4657 if let Some(ref val) = self.dstrct_nm {
4658 if val.chars().count() < 1 {
4659 return Err(ValidationError::new(
4660 1001,
4661 "dstrct_nm is shorter than the minimum length of 1".to_string(),
4662 ));
4663 }
4664 if val.chars().count() > 35 {
4665 return Err(ValidationError::new(
4666 1002,
4667 "dstrct_nm exceeds the maximum length of 35".to_string(),
4668 ));
4669 }
4670 }
4671 if let Some(ref val) = self.ctry_sub_dvsn {
4672 if val.chars().count() < 1 {
4673 return Err(ValidationError::new(
4674 1001,
4675 "ctry_sub_dvsn is shorter than the minimum length of 1".to_string(),
4676 ));
4677 }
4678 if val.chars().count() > 35 {
4679 return Err(ValidationError::new(
4680 1002,
4681 "ctry_sub_dvsn exceeds the maximum length of 35".to_string(),
4682 ));
4683 }
4684 }
4685 if let Some(ref val) = self.ctry {
4686 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4687 if !pattern.is_match(val) {
4688 return Err(ValidationError::new(
4689 1005,
4690 "ctry does not match the required pattern".to_string(),
4691 ));
4692 }
4693 }
4694 if let Some(ref vec) = self.adr_line {
4695 for item in vec {
4696 if item.chars().count() < 1 {
4697 return Err(ValidationError::new(
4698 1001,
4699 "adr_line is shorter than the minimum length of 1".to_string(),
4700 ));
4701 }
4702 if item.chars().count() > 70 {
4703 return Err(ValidationError::new(
4704 1002,
4705 "adr_line exceeds the maximum length of 70".to_string(),
4706 ));
4707 }
4708 }
4709 }
4710 Ok(())
4711 }
4712}
4713
4714#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4716pub enum PreferredContactMethod1Code {
4717 #[default]
4718 #[serde(rename = "LETT")]
4719 CodeLETT,
4720 #[serde(rename = "MAIL")]
4721 CodeMAIL,
4722 #[serde(rename = "PHON")]
4723 CodePHON,
4724 #[serde(rename = "FAXX")]
4725 CodeFAXX,
4726 #[serde(rename = "CELL")]
4727 CodeCELL,
4728}
4729
4730impl PreferredContactMethod1Code {
4731 pub fn validate(&self) -> Result<(), ValidationError> {
4732 Ok(())
4733 }
4734}
4735
4736#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4738pub enum Priority2Code {
4739 #[default]
4740 #[serde(rename = "HIGH")]
4741 CodeHIGH,
4742 #[serde(rename = "NORM")]
4743 CodeNORM,
4744}
4745
4746impl Priority2Code {
4747 pub fn validate(&self) -> Result<(), ValidationError> {
4748 Ok(())
4749 }
4750}
4751
4752#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4754pub struct ProxyAccountIdentification1 {
4755 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4756 pub tp: Option<ProxyAccountType1Choice>,
4757 #[serde(rename = "Id")]
4758 pub id: String,
4759}
4760
4761impl ProxyAccountIdentification1 {
4762 pub fn validate(&self) -> Result<(), ValidationError> {
4763 if let Some(ref val) = self.tp {
4764 val.validate()?
4765 }
4766 if self.id.chars().count() < 1 {
4767 return Err(ValidationError::new(
4768 1001,
4769 "id is shorter than the minimum length of 1".to_string(),
4770 ));
4771 }
4772 if self.id.chars().count() > 2048 {
4773 return Err(ValidationError::new(
4774 1002,
4775 "id exceeds the maximum length of 2048".to_string(),
4776 ));
4777 }
4778 Ok(())
4779 }
4780}
4781
4782#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4784pub struct ProxyAccountType1Choice {
4785 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4786 pub cd: Option<String>,
4787 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4788 pub prtry: Option<String>,
4789}
4790
4791impl ProxyAccountType1Choice {
4792 pub fn validate(&self) -> Result<(), ValidationError> {
4793 if let Some(ref val) = self.cd {
4794 if val.chars().count() < 1 {
4795 return Err(ValidationError::new(
4796 1001,
4797 "cd is shorter than the minimum length of 1".to_string(),
4798 ));
4799 }
4800 if val.chars().count() > 4 {
4801 return Err(ValidationError::new(
4802 1002,
4803 "cd exceeds the maximum length of 4".to_string(),
4804 ));
4805 }
4806 }
4807 if let Some(ref val) = self.prtry {
4808 if val.chars().count() < 1 {
4809 return Err(ValidationError::new(
4810 1001,
4811 "prtry is shorter than the minimum length of 1".to_string(),
4812 ));
4813 }
4814 if val.chars().count() > 35 {
4815 return Err(ValidationError::new(
4816 1002,
4817 "prtry exceeds the maximum length of 35".to_string(),
4818 ));
4819 }
4820 }
4821 Ok(())
4822 }
4823}
4824
4825#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4827pub struct Purpose2Choice {
4828 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4829 pub cd: Option<String>,
4830 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4831 pub prtry: Option<String>,
4832}
4833
4834impl Purpose2Choice {
4835 pub fn validate(&self) -> Result<(), ValidationError> {
4836 if let Some(ref val) = self.cd {
4837 if val.chars().count() < 1 {
4838 return Err(ValidationError::new(
4839 1001,
4840 "cd is shorter than the minimum length of 1".to_string(),
4841 ));
4842 }
4843 if val.chars().count() > 4 {
4844 return Err(ValidationError::new(
4845 1002,
4846 "cd exceeds the maximum length of 4".to_string(),
4847 ));
4848 }
4849 }
4850 if let Some(ref val) = self.prtry {
4851 if val.chars().count() < 1 {
4852 return Err(ValidationError::new(
4853 1001,
4854 "prtry is shorter than the minimum length of 1".to_string(),
4855 ));
4856 }
4857 if val.chars().count() > 35 {
4858 return Err(ValidationError::new(
4859 1002,
4860 "prtry exceeds the maximum length of 35".to_string(),
4861 ));
4862 }
4863 }
4864 Ok(())
4865 }
4866}
4867
4868#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4870pub struct ReferredDocumentInformation7 {
4871 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
4872 pub tp: Option<ReferredDocumentType4>,
4873 #[serde(rename = "Nb", skip_serializing_if = "Option::is_none")]
4874 pub nb: Option<String>,
4875 #[serde(rename = "RltdDt", skip_serializing_if = "Option::is_none")]
4876 pub rltd_dt: Option<String>,
4877 #[serde(rename = "LineDtls", skip_serializing_if = "Option::is_none")]
4878 pub line_dtls: Option<Vec<DocumentLineInformation1>>,
4879}
4880
4881impl ReferredDocumentInformation7 {
4882 pub fn validate(&self) -> Result<(), ValidationError> {
4883 if let Some(ref val) = self.tp {
4884 val.validate()?
4885 }
4886 if let Some(ref val) = self.nb {
4887 if val.chars().count() < 1 {
4888 return Err(ValidationError::new(
4889 1001,
4890 "nb is shorter than the minimum length of 1".to_string(),
4891 ));
4892 }
4893 if val.chars().count() > 35 {
4894 return Err(ValidationError::new(
4895 1002,
4896 "nb exceeds the maximum length of 35".to_string(),
4897 ));
4898 }
4899 }
4900 if let Some(ref vec) = self.line_dtls {
4901 for item in vec {
4902 item.validate()?
4903 }
4904 }
4905 Ok(())
4906 }
4907}
4908
4909#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4911pub struct ReferredDocumentType3Choice {
4912 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
4913 pub cd: Option<DocumentType6Code>,
4914 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
4915 pub prtry: Option<String>,
4916}
4917
4918impl ReferredDocumentType3Choice {
4919 pub fn validate(&self) -> Result<(), ValidationError> {
4920 if let Some(ref val) = self.cd {
4921 val.validate()?
4922 }
4923 if let Some(ref val) = self.prtry {
4924 if val.chars().count() < 1 {
4925 return Err(ValidationError::new(
4926 1001,
4927 "prtry is shorter than the minimum length of 1".to_string(),
4928 ));
4929 }
4930 if val.chars().count() > 35 {
4931 return Err(ValidationError::new(
4932 1002,
4933 "prtry exceeds the maximum length of 35".to_string(),
4934 ));
4935 }
4936 }
4937 Ok(())
4938 }
4939}
4940
4941#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4943pub struct ReferredDocumentType4 {
4944 #[serde(rename = "CdOrPrtry")]
4945 pub cd_or_prtry: ReferredDocumentType3Choice,
4946 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
4947 pub issr: Option<String>,
4948}
4949
4950impl ReferredDocumentType4 {
4951 pub fn validate(&self) -> Result<(), ValidationError> {
4952 self.cd_or_prtry.validate()?;
4953 if let Some(ref val) = self.issr {
4954 if val.chars().count() < 1 {
4955 return Err(ValidationError::new(
4956 1001,
4957 "issr is shorter than the minimum length of 1".to_string(),
4958 ));
4959 }
4960 if val.chars().count() > 35 {
4961 return Err(ValidationError::new(
4962 1002,
4963 "issr exceeds the maximum length of 35".to_string(),
4964 ));
4965 }
4966 }
4967 Ok(())
4968 }
4969}
4970
4971#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
4973pub struct RegulatoryAuthority2 {
4974 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
4975 pub nm: Option<String>,
4976 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
4977 pub ctry: Option<String>,
4978}
4979
4980impl RegulatoryAuthority2 {
4981 pub fn validate(&self) -> Result<(), ValidationError> {
4982 if let Some(ref val) = self.nm {
4983 if val.chars().count() < 1 {
4984 return Err(ValidationError::new(
4985 1001,
4986 "nm is shorter than the minimum length of 1".to_string(),
4987 ));
4988 }
4989 if val.chars().count() > 140 {
4990 return Err(ValidationError::new(
4991 1002,
4992 "nm exceeds the maximum length of 140".to_string(),
4993 ));
4994 }
4995 }
4996 if let Some(ref val) = self.ctry {
4997 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
4998 if !pattern.is_match(val) {
4999 return Err(ValidationError::new(
5000 1005,
5001 "ctry does not match the required pattern".to_string(),
5002 ));
5003 }
5004 }
5005 Ok(())
5006 }
5007}
5008
5009#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5011pub struct RegulatoryReporting3 {
5012 #[serde(rename = "DbtCdtRptgInd", skip_serializing_if = "Option::is_none")]
5013 pub dbt_cdt_rptg_ind: Option<RegulatoryReportingType1Code>,
5014 #[serde(rename = "Authrty", skip_serializing_if = "Option::is_none")]
5015 pub authrty: Option<RegulatoryAuthority2>,
5016 #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
5017 pub dtls: Option<Vec<StructuredRegulatoryReporting3>>,
5018}
5019
5020impl RegulatoryReporting3 {
5021 pub fn validate(&self) -> Result<(), ValidationError> {
5022 if let Some(ref val) = self.dbt_cdt_rptg_ind {
5023 val.validate()?
5024 }
5025 if let Some(ref val) = self.authrty {
5026 val.validate()?
5027 }
5028 if let Some(ref vec) = self.dtls {
5029 for item in vec {
5030 item.validate()?
5031 }
5032 }
5033 Ok(())
5034 }
5035}
5036
5037#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5039pub enum RegulatoryReportingType1Code {
5040 #[default]
5041 #[serde(rename = "CRED")]
5042 CodeCRED,
5043 #[serde(rename = "DEBT")]
5044 CodeDEBT,
5045 #[serde(rename = "BOTH")]
5046 CodeBOTH,
5047}
5048
5049impl RegulatoryReportingType1Code {
5050 pub fn validate(&self) -> Result<(), ValidationError> {
5051 Ok(())
5052 }
5053}
5054
5055#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5057pub struct RemittanceAmount2 {
5058 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
5059 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5060 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
5061 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
5062 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
5063 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5064 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
5065 pub tax_amt: Option<Vec<TaxAmountAndType1>>,
5066 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
5067 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment1>>,
5068 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
5069 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5070}
5071
5072impl RemittanceAmount2 {
5073 pub fn validate(&self) -> Result<(), ValidationError> {
5074 if let Some(ref val) = self.due_pybl_amt {
5075 val.validate()?
5076 }
5077 if let Some(ref vec) = self.dscnt_apld_amt {
5078 for item in vec {
5079 item.validate()?
5080 }
5081 }
5082 if let Some(ref val) = self.cdt_note_amt {
5083 val.validate()?
5084 }
5085 if let Some(ref vec) = self.tax_amt {
5086 for item in vec {
5087 item.validate()?
5088 }
5089 }
5090 if let Some(ref vec) = self.adjstmnt_amt_and_rsn {
5091 for item in vec {
5092 item.validate()?
5093 }
5094 }
5095 if let Some(ref val) = self.rmtd_amt {
5096 val.validate()?
5097 }
5098 Ok(())
5099 }
5100}
5101
5102#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5104pub struct RemittanceAmount3 {
5105 #[serde(rename = "DuePyblAmt", skip_serializing_if = "Option::is_none")]
5106 pub due_pybl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5107 #[serde(rename = "DscntApldAmt", skip_serializing_if = "Option::is_none")]
5108 pub dscnt_apld_amt: Option<Vec<DiscountAmountAndType1>>,
5109 #[serde(rename = "CdtNoteAmt", skip_serializing_if = "Option::is_none")]
5110 pub cdt_note_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5111 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
5112 pub tax_amt: Option<Vec<TaxAmountAndType1>>,
5113 #[serde(rename = "AdjstmntAmtAndRsn", skip_serializing_if = "Option::is_none")]
5114 pub adjstmnt_amt_and_rsn: Option<Vec<DocumentAdjustment1>>,
5115 #[serde(rename = "RmtdAmt", skip_serializing_if = "Option::is_none")]
5116 pub rmtd_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5117}
5118
5119impl RemittanceAmount3 {
5120 pub fn validate(&self) -> Result<(), ValidationError> {
5121 if let Some(ref val) = self.due_pybl_amt {
5122 val.validate()?
5123 }
5124 if let Some(ref vec) = self.dscnt_apld_amt {
5125 for item in vec {
5126 item.validate()?
5127 }
5128 }
5129 if let Some(ref val) = self.cdt_note_amt {
5130 val.validate()?
5131 }
5132 if let Some(ref vec) = self.tax_amt {
5133 for item in vec {
5134 item.validate()?
5135 }
5136 }
5137 if let Some(ref vec) = self.adjstmnt_amt_and_rsn {
5138 for item in vec {
5139 item.validate()?
5140 }
5141 }
5142 if let Some(ref val) = self.rmtd_amt {
5143 val.validate()?
5144 }
5145 Ok(())
5146 }
5147}
5148
5149#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5151pub struct RemittanceInformation161 {
5152 #[serde(rename = "Ustrd", skip_serializing_if = "Option::is_none")]
5153 pub ustrd: Option<String>,
5154 #[serde(rename = "Strd", skip_serializing_if = "Option::is_none")]
5155 pub strd: Option<Vec<StructuredRemittanceInformation161>>,
5156}
5157
5158impl RemittanceInformation161 {
5159 pub fn validate(&self) -> Result<(), ValidationError> {
5160 if let Some(ref val) = self.ustrd {
5161 if val.chars().count() < 1 {
5162 return Err(ValidationError::new(
5163 1001,
5164 "ustrd is shorter than the minimum length of 1".to_string(),
5165 ));
5166 }
5167 if val.chars().count() > 140 {
5168 return Err(ValidationError::new(
5169 1002,
5170 "ustrd exceeds the maximum length of 140".to_string(),
5171 ));
5172 }
5173 }
5174 if let Some(ref vec) = self.strd {
5175 for item in vec {
5176 item.validate()?
5177 }
5178 }
5179 Ok(())
5180 }
5181}
5182
5183#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5185pub struct RemittanceLocation71 {
5186 #[serde(rename = "RmtId", skip_serializing_if = "Option::is_none")]
5187 pub rmt_id: Option<String>,
5188 #[serde(rename = "RmtLctnDtls", skip_serializing_if = "Option::is_none")]
5189 pub rmt_lctn_dtls: Option<Vec<RemittanceLocationData11>>,
5190}
5191
5192impl RemittanceLocation71 {
5193 pub fn validate(&self) -> Result<(), ValidationError> {
5194 if let Some(ref val) = self.rmt_id {
5195 if val.chars().count() < 1 {
5196 return Err(ValidationError::new(
5197 1001,
5198 "rmt_id is shorter than the minimum length of 1".to_string(),
5199 ));
5200 }
5201 if val.chars().count() > 35 {
5202 return Err(ValidationError::new(
5203 1002,
5204 "rmt_id exceeds the maximum length of 35".to_string(),
5205 ));
5206 }
5207 }
5208 if let Some(ref vec) = self.rmt_lctn_dtls {
5209 for item in vec {
5210 item.validate()?
5211 }
5212 }
5213 Ok(())
5214 }
5215}
5216
5217#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5219pub struct RemittanceLocationData11 {
5220 #[serde(rename = "Mtd")]
5221 pub mtd: RemittanceLocationMethod2Code,
5222 #[serde(rename = "ElctrncAdr", skip_serializing_if = "Option::is_none")]
5223 pub elctrnc_adr: Option<String>,
5224 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
5225 pub pstl_adr: Option<NameAndAddress161>,
5226}
5227
5228impl RemittanceLocationData11 {
5229 pub fn validate(&self) -> Result<(), ValidationError> {
5230 self.mtd.validate()?;
5231 if let Some(ref val) = self.elctrnc_adr {
5232 if val.chars().count() < 1 {
5233 return Err(ValidationError::new(
5234 1001,
5235 "elctrnc_adr is shorter than the minimum length of 1".to_string(),
5236 ));
5237 }
5238 if val.chars().count() > 2048 {
5239 return Err(ValidationError::new(
5240 1002,
5241 "elctrnc_adr exceeds the maximum length of 2048".to_string(),
5242 ));
5243 }
5244 }
5245 if let Some(ref val) = self.pstl_adr {
5246 val.validate()?
5247 }
5248 Ok(())
5249 }
5250}
5251
5252#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5254pub enum RemittanceLocationMethod2Code {
5255 #[default]
5256 #[serde(rename = "FAXI")]
5257 CodeFAXI,
5258 #[serde(rename = "EDIC")]
5259 CodeEDIC,
5260 #[serde(rename = "URID")]
5261 CodeURID,
5262 #[serde(rename = "EMAL")]
5263 CodeEMAL,
5264 #[serde(rename = "POST")]
5265 CodePOST,
5266 #[serde(rename = "SMSM")]
5267 CodeSMSM,
5268}
5269
5270impl RemittanceLocationMethod2Code {
5271 pub fn validate(&self) -> Result<(), ValidationError> {
5272 Ok(())
5273 }
5274}
5275
5276#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5278pub enum SequenceType3Code {
5279 #[default]
5280 #[serde(rename = "FRST")]
5281 CodeFRST,
5282 #[serde(rename = "RCUR")]
5283 CodeRCUR,
5284 #[serde(rename = "FNAL")]
5285 CodeFNAL,
5286 #[serde(rename = "OOFF")]
5287 CodeOOFF,
5288 #[serde(rename = "RPRE")]
5289 CodeRPRE,
5290}
5291
5292impl SequenceType3Code {
5293 pub fn validate(&self) -> Result<(), ValidationError> {
5294 Ok(())
5295 }
5296}
5297
5298#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5300pub struct ServiceLevel8Choice {
5301 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5302 pub cd: Option<String>,
5303 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5304 pub prtry: Option<String>,
5305}
5306
5307impl ServiceLevel8Choice {
5308 pub fn validate(&self) -> Result<(), ValidationError> {
5309 if let Some(ref val) = self.cd {
5310 if val.chars().count() < 1 {
5311 return Err(ValidationError::new(
5312 1001,
5313 "cd is shorter than the minimum length of 1".to_string(),
5314 ));
5315 }
5316 if val.chars().count() > 4 {
5317 return Err(ValidationError::new(
5318 1002,
5319 "cd exceeds the maximum length of 4".to_string(),
5320 ));
5321 }
5322 }
5323 if let Some(ref val) = self.prtry {
5324 if val.chars().count() < 1 {
5325 return Err(ValidationError::new(
5326 1001,
5327 "prtry is shorter than the minimum length of 1".to_string(),
5328 ));
5329 }
5330 if val.chars().count() > 35 {
5331 return Err(ValidationError::new(
5332 1002,
5333 "prtry exceeds the maximum length of 35".to_string(),
5334 ));
5335 }
5336 }
5337 Ok(())
5338 }
5339}
5340
5341#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5343pub struct StructuredRegulatoryReporting3 {
5344 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5345 pub tp: Option<String>,
5346 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
5347 pub dt: Option<String>,
5348 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
5349 pub ctry: Option<String>,
5350 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5351 pub cd: Option<String>,
5352 #[serde(rename = "Amt", skip_serializing_if = "Option::is_none")]
5353 pub amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5354 #[serde(rename = "Inf", skip_serializing_if = "Option::is_none")]
5355 pub inf: Option<Vec<String>>,
5356}
5357
5358impl StructuredRegulatoryReporting3 {
5359 pub fn validate(&self) -> Result<(), ValidationError> {
5360 if let Some(ref val) = self.tp {
5361 if val.chars().count() < 1 {
5362 return Err(ValidationError::new(
5363 1001,
5364 "tp is shorter than the minimum length of 1".to_string(),
5365 ));
5366 }
5367 if val.chars().count() > 35 {
5368 return Err(ValidationError::new(
5369 1002,
5370 "tp exceeds the maximum length of 35".to_string(),
5371 ));
5372 }
5373 }
5374 if let Some(ref val) = self.ctry {
5375 let pattern = Regex::new("[A-Z]{2,2}").unwrap();
5376 if !pattern.is_match(val) {
5377 return Err(ValidationError::new(
5378 1005,
5379 "ctry does not match the required pattern".to_string(),
5380 ));
5381 }
5382 }
5383 if let Some(ref val) = self.cd {
5384 if val.chars().count() < 1 {
5385 return Err(ValidationError::new(
5386 1001,
5387 "cd is shorter than the minimum length of 1".to_string(),
5388 ));
5389 }
5390 if val.chars().count() > 10 {
5391 return Err(ValidationError::new(
5392 1002,
5393 "cd exceeds the maximum length of 10".to_string(),
5394 ));
5395 }
5396 }
5397 if let Some(ref val) = self.amt {
5398 val.validate()?
5399 }
5400 if let Some(ref vec) = self.inf {
5401 for item in vec {
5402 if item.chars().count() < 1 {
5403 return Err(ValidationError::new(
5404 1001,
5405 "inf is shorter than the minimum length of 1".to_string(),
5406 ));
5407 }
5408 if item.chars().count() > 35 {
5409 return Err(ValidationError::new(
5410 1002,
5411 "inf exceeds the maximum length of 35".to_string(),
5412 ));
5413 }
5414 }
5415 }
5416 Ok(())
5417 }
5418}
5419
5420#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5422pub struct StructuredRemittanceInformation161 {
5423 #[serde(rename = "RfrdDocInf", skip_serializing_if = "Option::is_none")]
5424 pub rfrd_doc_inf: Option<Vec<ReferredDocumentInformation7>>,
5425 #[serde(rename = "RfrdDocAmt", skip_serializing_if = "Option::is_none")]
5426 pub rfrd_doc_amt: Option<RemittanceAmount2>,
5427 #[serde(rename = "CdtrRefInf", skip_serializing_if = "Option::is_none")]
5428 pub cdtr_ref_inf: Option<CreditorReferenceInformation2>,
5429 #[serde(rename = "Invcr", skip_serializing_if = "Option::is_none")]
5430 pub invcr: Option<PartyIdentification1351>,
5431 #[serde(rename = "Invcee", skip_serializing_if = "Option::is_none")]
5432 pub invcee: Option<PartyIdentification1351>,
5433 #[serde(rename = "TaxRmt", skip_serializing_if = "Option::is_none")]
5434 pub tax_rmt: Option<TaxInformation7>,
5435 #[serde(rename = "GrnshmtRmt", skip_serializing_if = "Option::is_none")]
5436 pub grnshmt_rmt: Option<Garnishment31>,
5437 #[serde(rename = "AddtlRmtInf", skip_serializing_if = "Option::is_none")]
5438 pub addtl_rmt_inf: Option<Vec<String>>,
5439}
5440
5441impl StructuredRemittanceInformation161 {
5442 pub fn validate(&self) -> Result<(), ValidationError> {
5443 if let Some(ref vec) = self.rfrd_doc_inf {
5444 for item in vec {
5445 item.validate()?
5446 }
5447 }
5448 if let Some(ref val) = self.rfrd_doc_amt {
5449 val.validate()?
5450 }
5451 if let Some(ref val) = self.cdtr_ref_inf {
5452 val.validate()?
5453 }
5454 if let Some(ref val) = self.invcr {
5455 val.validate()?
5456 }
5457 if let Some(ref val) = self.invcee {
5458 val.validate()?
5459 }
5460 if let Some(ref val) = self.tax_rmt {
5461 val.validate()?
5462 }
5463 if let Some(ref val) = self.grnshmt_rmt {
5464 val.validate()?
5465 }
5466 if let Some(ref vec) = self.addtl_rmt_inf {
5467 for item in vec {
5468 if item.chars().count() < 1 {
5469 return Err(ValidationError::new(
5470 1001,
5471 "addtl_rmt_inf is shorter than the minimum length of 1".to_string(),
5472 ));
5473 }
5474 if item.chars().count() > 140 {
5475 return Err(ValidationError::new(
5476 1002,
5477 "addtl_rmt_inf exceeds the maximum length of 140".to_string(),
5478 ));
5479 }
5480 }
5481 }
5482 Ok(())
5483 }
5484}
5485
5486#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5488pub struct TaxAmount2 {
5489 #[serde(rename = "Rate", skip_serializing_if = "Option::is_none")]
5490 pub rate: Option<f64>,
5491 #[serde(rename = "TaxblBaseAmt", skip_serializing_if = "Option::is_none")]
5492 pub taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5493 #[serde(rename = "TtlAmt", skip_serializing_if = "Option::is_none")]
5494 pub ttl_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5495 #[serde(rename = "Dtls", skip_serializing_if = "Option::is_none")]
5496 pub dtls: Option<Vec<TaxRecordDetails2>>,
5497}
5498
5499impl TaxAmount2 {
5500 pub fn validate(&self) -> Result<(), ValidationError> {
5501 if let Some(ref val) = self.taxbl_base_amt {
5502 val.validate()?
5503 }
5504 if let Some(ref val) = self.ttl_amt {
5505 val.validate()?
5506 }
5507 if let Some(ref vec) = self.dtls {
5508 for item in vec {
5509 item.validate()?
5510 }
5511 }
5512 Ok(())
5513 }
5514}
5515
5516#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5518pub struct TaxAmountAndType1 {
5519 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5520 pub tp: Option<TaxAmountType1Choice>,
5521 #[serde(rename = "Amt")]
5522 pub amt: ActiveOrHistoricCurrencyAndAmount,
5523}
5524
5525impl TaxAmountAndType1 {
5526 pub fn validate(&self) -> Result<(), ValidationError> {
5527 if let Some(ref val) = self.tp {
5528 val.validate()?
5529 }
5530 self.amt.validate()?;
5531 Ok(())
5532 }
5533}
5534
5535#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5537pub struct TaxAmountType1Choice {
5538 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
5539 pub cd: Option<String>,
5540 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
5541 pub prtry: Option<String>,
5542}
5543
5544impl TaxAmountType1Choice {
5545 pub fn validate(&self) -> Result<(), ValidationError> {
5546 if let Some(ref val) = self.cd {
5547 if val.chars().count() < 1 {
5548 return Err(ValidationError::new(
5549 1001,
5550 "cd is shorter than the minimum length of 1".to_string(),
5551 ));
5552 }
5553 if val.chars().count() > 4 {
5554 return Err(ValidationError::new(
5555 1002,
5556 "cd exceeds the maximum length of 4".to_string(),
5557 ));
5558 }
5559 }
5560 if let Some(ref val) = self.prtry {
5561 if val.chars().count() < 1 {
5562 return Err(ValidationError::new(
5563 1001,
5564 "prtry is shorter than the minimum length of 1".to_string(),
5565 ));
5566 }
5567 if val.chars().count() > 35 {
5568 return Err(ValidationError::new(
5569 1002,
5570 "prtry exceeds the maximum length of 35".to_string(),
5571 ));
5572 }
5573 }
5574 Ok(())
5575 }
5576}
5577
5578#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5580pub struct TaxAuthorisation1 {
5581 #[serde(rename = "Titl", skip_serializing_if = "Option::is_none")]
5582 pub titl: Option<String>,
5583 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
5584 pub nm: Option<String>,
5585}
5586
5587impl TaxAuthorisation1 {
5588 pub fn validate(&self) -> Result<(), ValidationError> {
5589 if let Some(ref val) = self.titl {
5590 if val.chars().count() < 1 {
5591 return Err(ValidationError::new(
5592 1001,
5593 "titl is shorter than the minimum length of 1".to_string(),
5594 ));
5595 }
5596 if val.chars().count() > 35 {
5597 return Err(ValidationError::new(
5598 1002,
5599 "titl exceeds the maximum length of 35".to_string(),
5600 ));
5601 }
5602 }
5603 if let Some(ref val) = self.nm {
5604 if val.chars().count() < 1 {
5605 return Err(ValidationError::new(
5606 1001,
5607 "nm is shorter than the minimum length of 1".to_string(),
5608 ));
5609 }
5610 if val.chars().count() > 140 {
5611 return Err(ValidationError::new(
5612 1002,
5613 "nm exceeds the maximum length of 140".to_string(),
5614 ));
5615 }
5616 }
5617 Ok(())
5618 }
5619}
5620
5621#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5623pub struct TaxInformation7 {
5624 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
5625 pub cdtr: Option<TaxParty1>,
5626 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
5627 pub dbtr: Option<TaxParty2>,
5628 #[serde(rename = "UltmtDbtr", skip_serializing_if = "Option::is_none")]
5629 pub ultmt_dbtr: Option<TaxParty2>,
5630 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
5631 pub admstn_zone: Option<String>,
5632 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
5633 pub ref_nb: Option<String>,
5634 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
5635 pub mtd: Option<String>,
5636 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
5637 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5638 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
5639 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5640 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
5641 pub dt: Option<String>,
5642 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
5643 pub seq_nb: Option<f64>,
5644 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
5645 pub rcrd: Option<Vec<TaxRecord2>>,
5646}
5647
5648impl TaxInformation7 {
5649 pub fn validate(&self) -> Result<(), ValidationError> {
5650 if let Some(ref val) = self.cdtr {
5651 val.validate()?
5652 }
5653 if let Some(ref val) = self.dbtr {
5654 val.validate()?
5655 }
5656 if let Some(ref val) = self.ultmt_dbtr {
5657 val.validate()?
5658 }
5659 if let Some(ref val) = self.admstn_zone {
5660 if val.chars().count() < 1 {
5661 return Err(ValidationError::new(
5662 1001,
5663 "admstn_zone is shorter than the minimum length of 1".to_string(),
5664 ));
5665 }
5666 if val.chars().count() > 35 {
5667 return Err(ValidationError::new(
5668 1002,
5669 "admstn_zone exceeds the maximum length of 35".to_string(),
5670 ));
5671 }
5672 }
5673 if let Some(ref val) = self.ref_nb {
5674 if val.chars().count() < 1 {
5675 return Err(ValidationError::new(
5676 1001,
5677 "ref_nb is shorter than the minimum length of 1".to_string(),
5678 ));
5679 }
5680 if val.chars().count() > 140 {
5681 return Err(ValidationError::new(
5682 1002,
5683 "ref_nb exceeds the maximum length of 140".to_string(),
5684 ));
5685 }
5686 }
5687 if let Some(ref val) = self.mtd {
5688 if val.chars().count() < 1 {
5689 return Err(ValidationError::new(
5690 1001,
5691 "mtd is shorter than the minimum length of 1".to_string(),
5692 ));
5693 }
5694 if val.chars().count() > 35 {
5695 return Err(ValidationError::new(
5696 1002,
5697 "mtd exceeds the maximum length of 35".to_string(),
5698 ));
5699 }
5700 }
5701 if let Some(ref val) = self.ttl_taxbl_base_amt {
5702 val.validate()?
5703 }
5704 if let Some(ref val) = self.ttl_tax_amt {
5705 val.validate()?
5706 }
5707 if let Some(ref vec) = self.rcrd {
5708 for item in vec {
5709 item.validate()?
5710 }
5711 }
5712 Ok(())
5713 }
5714}
5715
5716#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5718pub struct TaxInformation8 {
5719 #[serde(rename = "Cdtr", skip_serializing_if = "Option::is_none")]
5720 pub cdtr: Option<TaxParty1>,
5721 #[serde(rename = "Dbtr", skip_serializing_if = "Option::is_none")]
5722 pub dbtr: Option<TaxParty2>,
5723 #[serde(rename = "AdmstnZone", skip_serializing_if = "Option::is_none")]
5724 pub admstn_zone: Option<String>,
5725 #[serde(rename = "RefNb", skip_serializing_if = "Option::is_none")]
5726 pub ref_nb: Option<String>,
5727 #[serde(rename = "Mtd", skip_serializing_if = "Option::is_none")]
5728 pub mtd: Option<String>,
5729 #[serde(rename = "TtlTaxblBaseAmt", skip_serializing_if = "Option::is_none")]
5730 pub ttl_taxbl_base_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5731 #[serde(rename = "TtlTaxAmt", skip_serializing_if = "Option::is_none")]
5732 pub ttl_tax_amt: Option<ActiveOrHistoricCurrencyAndAmount>,
5733 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
5734 pub dt: Option<String>,
5735 #[serde(rename = "SeqNb", skip_serializing_if = "Option::is_none")]
5736 pub seq_nb: Option<f64>,
5737 #[serde(rename = "Rcrd", skip_serializing_if = "Option::is_none")]
5738 pub rcrd: Option<Vec<TaxRecord2>>,
5739}
5740
5741impl TaxInformation8 {
5742 pub fn validate(&self) -> Result<(), ValidationError> {
5743 if let Some(ref val) = self.cdtr {
5744 val.validate()?
5745 }
5746 if let Some(ref val) = self.dbtr {
5747 val.validate()?
5748 }
5749 if let Some(ref val) = self.admstn_zone {
5750 if val.chars().count() < 1 {
5751 return Err(ValidationError::new(
5752 1001,
5753 "admstn_zone is shorter than the minimum length of 1".to_string(),
5754 ));
5755 }
5756 if val.chars().count() > 35 {
5757 return Err(ValidationError::new(
5758 1002,
5759 "admstn_zone exceeds the maximum length of 35".to_string(),
5760 ));
5761 }
5762 }
5763 if let Some(ref val) = self.ref_nb {
5764 if val.chars().count() < 1 {
5765 return Err(ValidationError::new(
5766 1001,
5767 "ref_nb is shorter than the minimum length of 1".to_string(),
5768 ));
5769 }
5770 if val.chars().count() > 140 {
5771 return Err(ValidationError::new(
5772 1002,
5773 "ref_nb exceeds the maximum length of 140".to_string(),
5774 ));
5775 }
5776 }
5777 if let Some(ref val) = self.mtd {
5778 if val.chars().count() < 1 {
5779 return Err(ValidationError::new(
5780 1001,
5781 "mtd is shorter than the minimum length of 1".to_string(),
5782 ));
5783 }
5784 if val.chars().count() > 35 {
5785 return Err(ValidationError::new(
5786 1002,
5787 "mtd exceeds the maximum length of 35".to_string(),
5788 ));
5789 }
5790 }
5791 if let Some(ref val) = self.ttl_taxbl_base_amt {
5792 val.validate()?
5793 }
5794 if let Some(ref val) = self.ttl_tax_amt {
5795 val.validate()?
5796 }
5797 if let Some(ref vec) = self.rcrd {
5798 for item in vec {
5799 item.validate()?
5800 }
5801 }
5802 Ok(())
5803 }
5804}
5805
5806#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5808pub struct TaxParty1 {
5809 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
5810 pub tax_id: Option<String>,
5811 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
5812 pub regn_id: Option<String>,
5813 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
5814 pub tax_tp: Option<String>,
5815}
5816
5817impl TaxParty1 {
5818 pub fn validate(&self) -> Result<(), ValidationError> {
5819 if let Some(ref val) = self.tax_id {
5820 if val.chars().count() < 1 {
5821 return Err(ValidationError::new(
5822 1001,
5823 "tax_id is shorter than the minimum length of 1".to_string(),
5824 ));
5825 }
5826 if val.chars().count() > 35 {
5827 return Err(ValidationError::new(
5828 1002,
5829 "tax_id exceeds the maximum length of 35".to_string(),
5830 ));
5831 }
5832 }
5833 if let Some(ref val) = self.regn_id {
5834 if val.chars().count() < 1 {
5835 return Err(ValidationError::new(
5836 1001,
5837 "regn_id is shorter than the minimum length of 1".to_string(),
5838 ));
5839 }
5840 if val.chars().count() > 35 {
5841 return Err(ValidationError::new(
5842 1002,
5843 "regn_id exceeds the maximum length of 35".to_string(),
5844 ));
5845 }
5846 }
5847 if let Some(ref val) = self.tax_tp {
5848 if val.chars().count() < 1 {
5849 return Err(ValidationError::new(
5850 1001,
5851 "tax_tp is shorter than the minimum length of 1".to_string(),
5852 ));
5853 }
5854 if val.chars().count() > 35 {
5855 return Err(ValidationError::new(
5856 1002,
5857 "tax_tp exceeds the maximum length of 35".to_string(),
5858 ));
5859 }
5860 }
5861 Ok(())
5862 }
5863}
5864
5865#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5867pub struct TaxParty2 {
5868 #[serde(rename = "TaxId", skip_serializing_if = "Option::is_none")]
5869 pub tax_id: Option<String>,
5870 #[serde(rename = "RegnId", skip_serializing_if = "Option::is_none")]
5871 pub regn_id: Option<String>,
5872 #[serde(rename = "TaxTp", skip_serializing_if = "Option::is_none")]
5873 pub tax_tp: Option<String>,
5874 #[serde(rename = "Authstn", skip_serializing_if = "Option::is_none")]
5875 pub authstn: Option<TaxAuthorisation1>,
5876}
5877
5878impl TaxParty2 {
5879 pub fn validate(&self) -> Result<(), ValidationError> {
5880 if let Some(ref val) = self.tax_id {
5881 if val.chars().count() < 1 {
5882 return Err(ValidationError::new(
5883 1001,
5884 "tax_id is shorter than the minimum length of 1".to_string(),
5885 ));
5886 }
5887 if val.chars().count() > 35 {
5888 return Err(ValidationError::new(
5889 1002,
5890 "tax_id exceeds the maximum length of 35".to_string(),
5891 ));
5892 }
5893 }
5894 if let Some(ref val) = self.regn_id {
5895 if val.chars().count() < 1 {
5896 return Err(ValidationError::new(
5897 1001,
5898 "regn_id is shorter than the minimum length of 1".to_string(),
5899 ));
5900 }
5901 if val.chars().count() > 35 {
5902 return Err(ValidationError::new(
5903 1002,
5904 "regn_id exceeds the maximum length of 35".to_string(),
5905 ));
5906 }
5907 }
5908 if let Some(ref val) = self.tax_tp {
5909 if val.chars().count() < 1 {
5910 return Err(ValidationError::new(
5911 1001,
5912 "tax_tp is shorter than the minimum length of 1".to_string(),
5913 ));
5914 }
5915 if val.chars().count() > 35 {
5916 return Err(ValidationError::new(
5917 1002,
5918 "tax_tp exceeds the maximum length of 35".to_string(),
5919 ));
5920 }
5921 }
5922 if let Some(ref val) = self.authstn {
5923 val.validate()?
5924 }
5925 Ok(())
5926 }
5927}
5928
5929#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5931pub struct TaxPeriod2 {
5932 #[serde(rename = "Yr", skip_serializing_if = "Option::is_none")]
5933 pub yr: Option<String>,
5934 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5935 pub tp: Option<TaxRecordPeriod1Code>,
5936 #[serde(rename = "FrToDt", skip_serializing_if = "Option::is_none")]
5937 pub fr_to_dt: Option<DatePeriod2>,
5938}
5939
5940impl TaxPeriod2 {
5941 pub fn validate(&self) -> Result<(), ValidationError> {
5942 if let Some(ref val) = self.tp {
5943 val.validate()?
5944 }
5945 if let Some(ref val) = self.fr_to_dt {
5946 val.validate()?
5947 }
5948 Ok(())
5949 }
5950}
5951
5952#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
5954pub struct TaxRecord2 {
5955 #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
5956 pub tp: Option<String>,
5957 #[serde(rename = "Ctgy", skip_serializing_if = "Option::is_none")]
5958 pub ctgy: Option<String>,
5959 #[serde(rename = "CtgyDtls", skip_serializing_if = "Option::is_none")]
5960 pub ctgy_dtls: Option<String>,
5961 #[serde(rename = "DbtrSts", skip_serializing_if = "Option::is_none")]
5962 pub dbtr_sts: Option<String>,
5963 #[serde(rename = "CertId", skip_serializing_if = "Option::is_none")]
5964 pub cert_id: Option<String>,
5965 #[serde(rename = "FrmsCd", skip_serializing_if = "Option::is_none")]
5966 pub frms_cd: Option<String>,
5967 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
5968 pub prd: Option<TaxPeriod2>,
5969 #[serde(rename = "TaxAmt", skip_serializing_if = "Option::is_none")]
5970 pub tax_amt: Option<TaxAmount2>,
5971 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
5972 pub addtl_inf: Option<String>,
5973}
5974
5975impl TaxRecord2 {
5976 pub fn validate(&self) -> Result<(), ValidationError> {
5977 if let Some(ref val) = self.tp {
5978 if val.chars().count() < 1 {
5979 return Err(ValidationError::new(
5980 1001,
5981 "tp is shorter than the minimum length of 1".to_string(),
5982 ));
5983 }
5984 if val.chars().count() > 35 {
5985 return Err(ValidationError::new(
5986 1002,
5987 "tp exceeds the maximum length of 35".to_string(),
5988 ));
5989 }
5990 }
5991 if let Some(ref val) = self.ctgy {
5992 if val.chars().count() < 1 {
5993 return Err(ValidationError::new(
5994 1001,
5995 "ctgy is shorter than the minimum length of 1".to_string(),
5996 ));
5997 }
5998 if val.chars().count() > 35 {
5999 return Err(ValidationError::new(
6000 1002,
6001 "ctgy exceeds the maximum length of 35".to_string(),
6002 ));
6003 }
6004 }
6005 if let Some(ref val) = self.ctgy_dtls {
6006 if val.chars().count() < 1 {
6007 return Err(ValidationError::new(
6008 1001,
6009 "ctgy_dtls is shorter than the minimum length of 1".to_string(),
6010 ));
6011 }
6012 if val.chars().count() > 35 {
6013 return Err(ValidationError::new(
6014 1002,
6015 "ctgy_dtls exceeds the maximum length of 35".to_string(),
6016 ));
6017 }
6018 }
6019 if let Some(ref val) = self.dbtr_sts {
6020 if val.chars().count() < 1 {
6021 return Err(ValidationError::new(
6022 1001,
6023 "dbtr_sts is shorter than the minimum length of 1".to_string(),
6024 ));
6025 }
6026 if val.chars().count() > 35 {
6027 return Err(ValidationError::new(
6028 1002,
6029 "dbtr_sts exceeds the maximum length of 35".to_string(),
6030 ));
6031 }
6032 }
6033 if let Some(ref val) = self.cert_id {
6034 if val.chars().count() < 1 {
6035 return Err(ValidationError::new(
6036 1001,
6037 "cert_id is shorter than the minimum length of 1".to_string(),
6038 ));
6039 }
6040 if val.chars().count() > 35 {
6041 return Err(ValidationError::new(
6042 1002,
6043 "cert_id exceeds the maximum length of 35".to_string(),
6044 ));
6045 }
6046 }
6047 if let Some(ref val) = self.frms_cd {
6048 if val.chars().count() < 1 {
6049 return Err(ValidationError::new(
6050 1001,
6051 "frms_cd is shorter than the minimum length of 1".to_string(),
6052 ));
6053 }
6054 if val.chars().count() > 35 {
6055 return Err(ValidationError::new(
6056 1002,
6057 "frms_cd exceeds the maximum length of 35".to_string(),
6058 ));
6059 }
6060 }
6061 if let Some(ref val) = self.prd {
6062 val.validate()?
6063 }
6064 if let Some(ref val) = self.tax_amt {
6065 val.validate()?
6066 }
6067 if let Some(ref val) = self.addtl_inf {
6068 if val.chars().count() < 1 {
6069 return Err(ValidationError::new(
6070 1001,
6071 "addtl_inf is shorter than the minimum length of 1".to_string(),
6072 ));
6073 }
6074 if val.chars().count() > 140 {
6075 return Err(ValidationError::new(
6076 1002,
6077 "addtl_inf exceeds the maximum length of 140".to_string(),
6078 ));
6079 }
6080 }
6081 Ok(())
6082 }
6083}
6084
6085#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6087pub struct TaxRecordDetails2 {
6088 #[serde(rename = "Prd", skip_serializing_if = "Option::is_none")]
6089 pub prd: Option<TaxPeriod2>,
6090 #[serde(rename = "Amt")]
6091 pub amt: ActiveOrHistoricCurrencyAndAmount,
6092}
6093
6094impl TaxRecordDetails2 {
6095 pub fn validate(&self) -> Result<(), ValidationError> {
6096 if let Some(ref val) = self.prd {
6097 val.validate()?
6098 }
6099 self.amt.validate()?;
6100 Ok(())
6101 }
6102}
6103
6104#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6106pub enum TaxRecordPeriod1Code {
6107 #[default]
6108 #[serde(rename = "MM01")]
6109 CodeMM01,
6110 #[serde(rename = "MM02")]
6111 CodeMM02,
6112 #[serde(rename = "MM03")]
6113 CodeMM03,
6114 #[serde(rename = "MM04")]
6115 CodeMM04,
6116 #[serde(rename = "MM05")]
6117 CodeMM05,
6118 #[serde(rename = "MM06")]
6119 CodeMM06,
6120 #[serde(rename = "MM07")]
6121 CodeMM07,
6122 #[serde(rename = "MM08")]
6123 CodeMM08,
6124 #[serde(rename = "MM09")]
6125 CodeMM09,
6126 #[serde(rename = "MM10")]
6127 CodeMM10,
6128 #[serde(rename = "MM11")]
6129 CodeMM11,
6130 #[serde(rename = "MM12")]
6131 CodeMM12,
6132 #[serde(rename = "QTR1")]
6133 CodeQTR1,
6134 #[serde(rename = "QTR2")]
6135 CodeQTR2,
6136 #[serde(rename = "QTR3")]
6137 CodeQTR3,
6138 #[serde(rename = "QTR4")]
6139 CodeQTR4,
6140 #[serde(rename = "HLF1")]
6141 CodeHLF1,
6142 #[serde(rename = "HLF2")]
6143 CodeHLF2,
6144}
6145
6146impl TaxRecordPeriod1Code {
6147 pub fn validate(&self) -> Result<(), ValidationError> {
6148 Ok(())
6149 }
6150}