use crate::parse_result::{ErrorCollector, ParserConfig};
use crate::validation::{Validate, helpers};
use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct AccountIdentification4Choice1 {
#[serde(rename = "IBAN", skip_serializing_if = "Option::is_none")]
pub iban: Option<String>,
#[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
pub othr: Option<GenericAccountIdentification11>,
}
impl Validate for AccountIdentification4Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.iban {
helpers::validate_pattern(
val,
"IBAN",
"[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}",
&helpers::child_path(path, "IBAN"),
config,
collector,
);
}
if let Some(ref val) = self.othr
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Othr"), config, collector);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct AccountSchemeName1Choice1 {
#[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
pub cd: Option<String>,
#[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
pub prtry: Option<String>,
}
impl Validate for AccountSchemeName1Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.cd {
helpers::validate_length(
val,
"Cd",
Some(1),
Some(4),
&helpers::child_path(path, "Cd"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_length(
val,
"Prtry",
Some(1),
Some(35),
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_pattern(
val,
"Prtry",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct BranchAndFinancialInstitutionIdentification61 {
#[serde(rename = "FinInstnId")]
pub fin_instn_id: FinancialInstitutionIdentification181,
}
impl Validate for BranchAndFinancialInstitutionIdentification61 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
self.fin_instn_id
.validate(&helpers::child_path(path, "FinInstnId"), config, collector);
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct CBPRAmount {
#[serde(rename = "@Ccy")]
pub ccy: String,
#[serde(rename = "$value")]
pub value: f64,
}
impl Validate for CBPRAmount {
fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub enum CBPRChequeCancellationOrStopStatusCode {
#[default]
#[serde(rename = "RJCR")]
CodeRJCR,
#[serde(rename = "ACCR")]
CodeACCR,
}
impl Validate for CBPRChequeCancellationOrStopStatusCode {
fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct CashAccount401 {
#[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
pub id: Option<AccountIdentification4Choice1>,
#[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
pub tp: Option<CashAccountType2Choice1>,
#[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
pub ccy: Option<String>,
#[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
pub nm: Option<String>,
#[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
pub prxy: Option<ProxyAccountIdentification11>,
}
impl Validate for CashAccount401 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.id
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Id"), config, collector);
}
if let Some(ref val) = self.tp
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Tp"), config, collector);
}
if let Some(ref val) = self.ccy {
helpers::validate_pattern(
val,
"Ccy",
"[A-Z]{3,3}",
&helpers::child_path(path, "Ccy"),
config,
collector,
);
}
if let Some(ref val) = self.nm {
helpers::validate_length(
val,
"Nm",
Some(1),
Some(70),
&helpers::child_path(path, "Nm"),
config,
collector,
);
}
if let Some(ref val) = self.nm {
helpers::validate_pattern(
val,
"Nm",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Nm"),
config,
collector,
);
}
if let Some(ref val) = self.prxy
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Prxy"), config, collector);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct CashAccountType2Choice1 {
#[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
pub cd: Option<String>,
#[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
pub prtry: Option<String>,
}
impl Validate for CashAccountType2Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.cd {
helpers::validate_length(
val,
"Cd",
Some(1),
Some(4),
&helpers::child_path(path, "Cd"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_length(
val,
"Prtry",
Some(1),
Some(35),
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_pattern(
val,
"Prtry",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct Cheque141 {
#[serde(rename = "InstrId", skip_serializing_if = "Option::is_none")]
pub instr_id: Option<String>,
#[serde(rename = "OrgnlInstrId")]
pub orgnl_instr_id: String,
#[serde(rename = "ChqNb")]
pub chq_nb: String,
#[serde(rename = "IsseDt")]
pub isse_dt: String,
#[serde(rename = "StlDt", skip_serializing_if = "Option::is_none")]
pub stl_dt: Option<String>,
#[serde(rename = "Amt")]
pub amt: CBPRAmount,
#[serde(rename = "FctvDt", skip_serializing_if = "Option::is_none")]
pub fctv_dt: Option<DateAndDateTime2Choice1>,
#[serde(rename = "DrwrAgt", skip_serializing_if = "Option::is_none")]
pub drwr_agt: Option<BranchAndFinancialInstitutionIdentification61>,
#[serde(rename = "DrwrAgtAcct", skip_serializing_if = "Option::is_none")]
pub drwr_agt_acct: Option<CashAccount401>,
#[serde(rename = "Pyee", skip_serializing_if = "Option::is_none")]
pub pyee: Option<PartyIdentification1351>,
#[serde(rename = "ChqCxlOrStopSts")]
pub chq_cxl_or_stop_sts: ChequeCancellationStatus11,
}
impl Validate for Cheque141 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.instr_id {
helpers::validate_length(
val,
"InstrId",
Some(1),
Some(35),
&helpers::child_path(path, "InstrId"),
config,
collector,
);
}
if let Some(ref val) = self.instr_id {
helpers::validate_pattern(
val,
"InstrId",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "InstrId"),
config,
collector,
);
}
helpers::validate_length(
&self.orgnl_instr_id,
"OrgnlInstrId",
Some(1),
Some(35),
&helpers::child_path(path, "OrgnlInstrId"),
config,
collector,
);
helpers::validate_pattern(
&self.orgnl_instr_id,
"OrgnlInstrId",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "OrgnlInstrId"),
config,
collector,
);
helpers::validate_length(
&self.chq_nb,
"ChqNb",
Some(1),
Some(16),
&helpers::child_path(path, "ChqNb"),
config,
collector,
);
helpers::validate_pattern(
&self.chq_nb,
"ChqNb",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "ChqNb"),
config,
collector,
);
self.amt
.validate(&helpers::child_path(path, "Amt"), config, collector);
if let Some(ref val) = self.fctv_dt
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "FctvDt"), config, collector);
}
if let Some(ref val) = self.drwr_agt
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "DrwrAgt"), config, collector);
}
if let Some(ref val) = self.drwr_agt_acct
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "DrwrAgtAcct"), config, collector);
}
if let Some(ref val) = self.pyee
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Pyee"), config, collector);
}
self.chq_cxl_or_stop_sts.validate(
&helpers::child_path(path, "ChqCxlOrStopSts"),
config,
collector,
);
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct ChequeCancellationOrStopReportV01 {
#[serde(rename = "GrpHdr")]
pub grp_hdr: GroupHeader1031,
#[serde(rename = "Chq")]
pub chq: Cheque141,
}
impl Validate for ChequeCancellationOrStopReportV01 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
self.grp_hdr
.validate(&helpers::child_path(path, "GrpHdr"), config, collector);
self.chq
.validate(&helpers::child_path(path, "Chq"), config, collector);
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct ChequeCancellationStatus1Choice1 {
#[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
pub cd: Option<CBPRChequeCancellationOrStopStatusCode>,
}
impl Validate for ChequeCancellationStatus1Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.cd
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Cd"), config, collector);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct ChequeCancellationStatus11 {
#[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
pub orgtr: Option<ChequePartyRole1Code>,
#[serde(rename = "Sts")]
pub sts: ChequeCancellationStatus1Choice1,
#[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
pub addtl_inf: Option<String>,
}
impl Validate for ChequeCancellationStatus11 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.orgtr
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
}
self.sts
.validate(&helpers::child_path(path, "Sts"), config, collector);
if let Some(ref val) = self.addtl_inf {
helpers::validate_length(
val,
"AddtlInf",
Some(1),
Some(140),
&helpers::child_path(path, "AddtlInf"),
config,
collector,
);
}
if let Some(ref val) = self.addtl_inf {
helpers::validate_pattern(
val,
"AddtlInf",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "AddtlInf"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub enum ChequePartyRole1Code {
#[default]
#[serde(rename = "DWEA")]
CodeDWEA,
#[serde(rename = "DWRA")]
CodeDWRA,
#[serde(rename = "PAYE")]
CodePAYE,
#[serde(rename = "PAYR")]
CodePAYR,
}
impl Validate for ChequePartyRole1Code {
fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct ClearingSystemIdentification2Choice1 {
#[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
pub cd: Option<String>,
}
impl Validate for ClearingSystemIdentification2Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.cd {
helpers::validate_length(
val,
"Cd",
Some(1),
Some(5),
&helpers::child_path(path, "Cd"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct ClearingSystemMemberIdentification21 {
#[serde(rename = "ClrSysId")]
pub clr_sys_id: ClearingSystemIdentification2Choice1,
#[serde(rename = "MmbId")]
pub mmb_id: String,
}
impl Validate for ClearingSystemMemberIdentification21 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
self.clr_sys_id
.validate(&helpers::child_path(path, "ClrSysId"), config, collector);
helpers::validate_length(
&self.mmb_id,
"MmbId",
Some(1),
Some(28),
&helpers::child_path(path, "MmbId"),
config,
collector,
);
helpers::validate_pattern(
&self.mmb_id,
"MmbId",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "MmbId"),
config,
collector,
);
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct DateAndDateTime2Choice1 {
#[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
pub dt: Option<String>,
}
impl Validate for DateAndDateTime2Choice1 {
fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct DateAndPlaceOfBirth11 {
#[serde(rename = "BirthDt")]
pub birth_dt: String,
#[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
pub prvc_of_birth: Option<String>,
#[serde(rename = "CityOfBirth")]
pub city_of_birth: String,
#[serde(rename = "CtryOfBirth")]
pub ctry_of_birth: String,
}
impl Validate for DateAndPlaceOfBirth11 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.prvc_of_birth {
helpers::validate_length(
val,
"PrvcOfBirth",
Some(1),
Some(35),
&helpers::child_path(path, "PrvcOfBirth"),
config,
collector,
);
}
if let Some(ref val) = self.prvc_of_birth {
helpers::validate_pattern(
val,
"PrvcOfBirth",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "PrvcOfBirth"),
config,
collector,
);
}
helpers::validate_length(
&self.city_of_birth,
"CityOfBirth",
Some(1),
Some(35),
&helpers::child_path(path, "CityOfBirth"),
config,
collector,
);
helpers::validate_pattern(
&self.city_of_birth,
"CityOfBirth",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "CityOfBirth"),
config,
collector,
);
helpers::validate_pattern(
&self.ctry_of_birth,
"CtryOfBirth",
"[A-Z]{2,2}",
&helpers::child_path(path, "CtryOfBirth"),
config,
collector,
);
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct FinancialInstitutionIdentification181 {
#[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
pub bicfi: Option<String>,
#[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
#[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
pub lei: Option<String>,
#[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
pub nm: Option<String>,
#[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
pub pstl_adr: Option<PostalAddress241>,
}
impl Validate for FinancialInstitutionIdentification181 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.bicfi {
helpers::validate_pattern(
val,
"BICFI",
"[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
&helpers::child_path(path, "BICFI"),
config,
collector,
);
}
if let Some(ref val) = self.clr_sys_mmb_id
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
}
if let Some(ref val) = self.lei {
helpers::validate_pattern(
val,
"LEI",
"[A-Z0-9]{18,18}[0-9]{2,2}",
&helpers::child_path(path, "LEI"),
config,
collector,
);
}
if let Some(ref val) = self.nm {
helpers::validate_length(
val,
"Nm",
Some(1),
Some(140),
&helpers::child_path(path, "Nm"),
config,
collector,
);
}
if let Some(ref val) = self.nm {
helpers::validate_pattern(
val,
"Nm",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "Nm"),
config,
collector,
);
}
if let Some(ref val) = self.pstl_adr
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct GenericAccountIdentification11 {
#[serde(rename = "Id")]
pub id: String,
#[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
pub schme_nm: Option<AccountSchemeName1Choice1>,
#[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
pub issr: Option<String>,
}
impl Validate for GenericAccountIdentification11 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
helpers::validate_length(
&self.id,
"Id",
Some(1),
Some(34),
&helpers::child_path(path, "Id"),
config,
collector,
);
helpers::validate_pattern(
&self.id,
"Id",
"([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
&helpers::child_path(path, "Id"),
config,
collector,
);
if let Some(ref val) = self.schme_nm
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
}
if let Some(ref val) = self.issr {
helpers::validate_length(
val,
"Issr",
Some(1),
Some(35),
&helpers::child_path(path, "Issr"),
config,
collector,
);
}
if let Some(ref val) = self.issr {
helpers::validate_pattern(
val,
"Issr",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Issr"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct GenericOrganisationIdentification11 {
#[serde(rename = "Id")]
pub id: String,
#[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
#[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
pub issr: Option<String>,
}
impl Validate for GenericOrganisationIdentification11 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
helpers::validate_length(
&self.id,
"Id",
Some(1),
Some(35),
&helpers::child_path(path, "Id"),
config,
collector,
);
helpers::validate_pattern(
&self.id,
"Id",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Id"),
config,
collector,
);
if let Some(ref val) = self.schme_nm
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
}
if let Some(ref val) = self.issr {
helpers::validate_length(
val,
"Issr",
Some(1),
Some(35),
&helpers::child_path(path, "Issr"),
config,
collector,
);
}
if let Some(ref val) = self.issr {
helpers::validate_pattern(
val,
"Issr",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Issr"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct GenericPersonIdentification11 {
#[serde(rename = "Id")]
pub id: String,
#[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
#[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
pub issr: Option<String>,
}
impl Validate for GenericPersonIdentification11 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
helpers::validate_length(
&self.id,
"Id",
Some(1),
Some(35),
&helpers::child_path(path, "Id"),
config,
collector,
);
helpers::validate_pattern(
&self.id,
"Id",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Id"),
config,
collector,
);
if let Some(ref val) = self.schme_nm
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
}
if let Some(ref val) = self.issr {
helpers::validate_length(
val,
"Issr",
Some(1),
Some(35),
&helpers::child_path(path, "Issr"),
config,
collector,
);
}
if let Some(ref val) = self.issr {
helpers::validate_pattern(
val,
"Issr",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Issr"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct GroupHeader1031 {
#[serde(rename = "MsgId")]
pub msg_id: String,
#[serde(rename = "CreDtTm")]
pub cre_dt_tm: String,
#[serde(rename = "NbOfChqs")]
pub nb_of_chqs: String,
#[serde(rename = "CtrlSum", skip_serializing_if = "Option::is_none")]
pub ctrl_sum: Option<f64>,
}
impl Validate for GroupHeader1031 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
helpers::validate_length(
&self.msg_id,
"MsgId",
Some(1),
Some(16),
&helpers::child_path(path, "MsgId"),
config,
collector,
);
helpers::validate_pattern(
&self.msg_id,
"MsgId",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "MsgId"),
config,
collector,
);
helpers::validate_pattern(
&self.cre_dt_tm,
"CreDtTm",
".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
&helpers::child_path(path, "CreDtTm"),
config,
collector,
);
helpers::validate_pattern(
&self.nb_of_chqs,
"NbOfChqs",
"[0-9]{1,15}",
&helpers::child_path(path, "NbOfChqs"),
config,
collector,
);
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct OrganisationIdentification291 {
#[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
pub any_bic: Option<String>,
#[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
pub lei: Option<String>,
#[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
pub othr: Option<Vec<GenericOrganisationIdentification11>>,
}
impl Validate for OrganisationIdentification291 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.any_bic {
helpers::validate_pattern(
val,
"AnyBIC",
"[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
&helpers::child_path(path, "AnyBIC"),
config,
collector,
);
}
if let Some(ref val) = self.lei {
helpers::validate_pattern(
val,
"LEI",
"[A-Z0-9]{18,18}[0-9]{2,2}",
&helpers::child_path(path, "LEI"),
config,
collector,
);
}
if let Some(ref vec) = self.othr
&& config.validate_optional_fields
{
for item in vec {
item.validate(&helpers::child_path(path, "Othr"), config, collector);
}
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct OrganisationIdentificationSchemeName1Choice1 {
#[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
pub cd: Option<String>,
#[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
pub prtry: Option<String>,
}
impl Validate for OrganisationIdentificationSchemeName1Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.cd {
helpers::validate_length(
val,
"Cd",
Some(1),
Some(4),
&helpers::child_path(path, "Cd"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_length(
val,
"Prtry",
Some(1),
Some(35),
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_pattern(
val,
"Prtry",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct Party38Choice1 {
#[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
pub org_id: Option<OrganisationIdentification291>,
#[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
pub prvt_id: Option<PersonIdentification131>,
}
impl Validate for Party38Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.org_id
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "OrgId"), config, collector);
}
if let Some(ref val) = self.prvt_id
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct PartyIdentification1351 {
#[serde(rename = "Nm")]
pub nm: String,
#[serde(rename = "PstlAdr")]
pub pstl_adr: PostalAddress241,
#[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
pub id: Option<Party38Choice1>,
#[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
pub ctry_of_res: Option<String>,
}
impl Validate for PartyIdentification1351 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
helpers::validate_length(
&self.nm,
"Nm",
Some(1),
Some(140),
&helpers::child_path(path, "Nm"),
config,
collector,
);
helpers::validate_pattern(
&self.nm,
"Nm",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "Nm"),
config,
collector,
);
self.pstl_adr
.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
if let Some(ref val) = self.id
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Id"), config, collector);
}
if let Some(ref val) = self.ctry_of_res {
helpers::validate_pattern(
val,
"CtryOfRes",
"[A-Z]{2,2}",
&helpers::child_path(path, "CtryOfRes"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct PersonIdentification131 {
#[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
#[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
pub othr: Option<Vec<GenericPersonIdentification11>>,
}
impl Validate for PersonIdentification131 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.dt_and_plc_of_birth
&& config.validate_optional_fields
{
val.validate(
&helpers::child_path(path, "DtAndPlcOfBirth"),
config,
collector,
);
}
if let Some(ref vec) = self.othr
&& config.validate_optional_fields
{
for item in vec {
item.validate(&helpers::child_path(path, "Othr"), config, collector);
}
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct PersonIdentificationSchemeName1Choice1 {
#[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
pub cd: Option<String>,
#[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
pub prtry: Option<String>,
}
impl Validate for PersonIdentificationSchemeName1Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.cd {
helpers::validate_length(
val,
"Cd",
Some(1),
Some(4),
&helpers::child_path(path, "Cd"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_length(
val,
"Prtry",
Some(1),
Some(35),
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_pattern(
val,
"Prtry",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct PostalAddress241 {
#[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
pub dept: Option<String>,
#[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
pub sub_dept: Option<String>,
#[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
pub strt_nm: Option<String>,
#[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
pub bldg_nb: Option<String>,
#[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
pub bldg_nm: Option<String>,
#[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
pub flr: Option<String>,
#[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
pub pst_bx: Option<String>,
#[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
pub room: Option<String>,
#[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
pub pst_cd: Option<String>,
#[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
pub twn_nm: Option<String>,
#[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
pub twn_lctn_nm: Option<String>,
#[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
pub dstrct_nm: Option<String>,
#[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
pub ctry_sub_dvsn: Option<String>,
#[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
pub ctry: Option<String>,
#[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
pub adr_line: Option<Vec<String>>,
}
impl Validate for PostalAddress241 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.dept {
helpers::validate_length(
val,
"Dept",
Some(1),
Some(70),
&helpers::child_path(path, "Dept"),
config,
collector,
);
}
if let Some(ref val) = self.dept {
helpers::validate_pattern(
val,
"Dept",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "Dept"),
config,
collector,
);
}
if let Some(ref val) = self.sub_dept {
helpers::validate_length(
val,
"SubDept",
Some(1),
Some(70),
&helpers::child_path(path, "SubDept"),
config,
collector,
);
}
if let Some(ref val) = self.sub_dept {
helpers::validate_pattern(
val,
"SubDept",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "SubDept"),
config,
collector,
);
}
if let Some(ref val) = self.strt_nm {
helpers::validate_length(
val,
"StrtNm",
Some(1),
Some(70),
&helpers::child_path(path, "StrtNm"),
config,
collector,
);
}
if let Some(ref val) = self.strt_nm {
helpers::validate_pattern(
val,
"StrtNm",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "StrtNm"),
config,
collector,
);
}
if let Some(ref val) = self.bldg_nb {
helpers::validate_length(
val,
"BldgNb",
Some(1),
Some(16),
&helpers::child_path(path, "BldgNb"),
config,
collector,
);
}
if let Some(ref val) = self.bldg_nb {
helpers::validate_pattern(
val,
"BldgNb",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "BldgNb"),
config,
collector,
);
}
if let Some(ref val) = self.bldg_nm {
helpers::validate_length(
val,
"BldgNm",
Some(1),
Some(35),
&helpers::child_path(path, "BldgNm"),
config,
collector,
);
}
if let Some(ref val) = self.bldg_nm {
helpers::validate_pattern(
val,
"BldgNm",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "BldgNm"),
config,
collector,
);
}
if let Some(ref val) = self.flr {
helpers::validate_length(
val,
"Flr",
Some(1),
Some(70),
&helpers::child_path(path, "Flr"),
config,
collector,
);
}
if let Some(ref val) = self.flr {
helpers::validate_pattern(
val,
"Flr",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "Flr"),
config,
collector,
);
}
if let Some(ref val) = self.pst_bx {
helpers::validate_length(
val,
"PstBx",
Some(1),
Some(16),
&helpers::child_path(path, "PstBx"),
config,
collector,
);
}
if let Some(ref val) = self.pst_bx {
helpers::validate_pattern(
val,
"PstBx",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "PstBx"),
config,
collector,
);
}
if let Some(ref val) = self.room {
helpers::validate_length(
val,
"Room",
Some(1),
Some(70),
&helpers::child_path(path, "Room"),
config,
collector,
);
}
if let Some(ref val) = self.room {
helpers::validate_pattern(
val,
"Room",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "Room"),
config,
collector,
);
}
if let Some(ref val) = self.pst_cd {
helpers::validate_length(
val,
"PstCd",
Some(1),
Some(16),
&helpers::child_path(path, "PstCd"),
config,
collector,
);
}
if let Some(ref val) = self.pst_cd {
helpers::validate_pattern(
val,
"PstCd",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "PstCd"),
config,
collector,
);
}
if let Some(ref val) = self.twn_nm {
helpers::validate_length(
val,
"TwnNm",
Some(1),
Some(35),
&helpers::child_path(path, "TwnNm"),
config,
collector,
);
}
if let Some(ref val) = self.twn_nm {
helpers::validate_pattern(
val,
"TwnNm",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "TwnNm"),
config,
collector,
);
}
if let Some(ref val) = self.twn_lctn_nm {
helpers::validate_length(
val,
"TwnLctnNm",
Some(1),
Some(35),
&helpers::child_path(path, "TwnLctnNm"),
config,
collector,
);
}
if let Some(ref val) = self.twn_lctn_nm {
helpers::validate_pattern(
val,
"TwnLctnNm",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "TwnLctnNm"),
config,
collector,
);
}
if let Some(ref val) = self.dstrct_nm {
helpers::validate_length(
val,
"DstrctNm",
Some(1),
Some(35),
&helpers::child_path(path, "DstrctNm"),
config,
collector,
);
}
if let Some(ref val) = self.dstrct_nm {
helpers::validate_pattern(
val,
"DstrctNm",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "DstrctNm"),
config,
collector,
);
}
if let Some(ref val) = self.ctry_sub_dvsn {
helpers::validate_length(
val,
"CtrySubDvsn",
Some(1),
Some(35),
&helpers::child_path(path, "CtrySubDvsn"),
config,
collector,
);
}
if let Some(ref val) = self.ctry_sub_dvsn {
helpers::validate_pattern(
val,
"CtrySubDvsn",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "CtrySubDvsn"),
config,
collector,
);
}
if let Some(ref val) = self.ctry {
helpers::validate_pattern(
val,
"Ctry",
"[A-Z]{2,2}",
&helpers::child_path(path, "Ctry"),
config,
collector,
);
}
if let Some(ref vec) = self.adr_line {
for item in vec {
helpers::validate_length(
item,
"AdrLine",
Some(1),
Some(70),
&helpers::child_path(path, "AdrLine"),
config,
collector,
);
}
}
if let Some(ref vec) = self.adr_line {
for item in vec {
helpers::validate_pattern(
item,
"AdrLine",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "AdrLine"),
config,
collector,
);
}
}
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct ProxyAccountIdentification11 {
#[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
pub tp: Option<ProxyAccountType1Choice1>,
#[serde(rename = "Id")]
pub id: String,
}
impl Validate for ProxyAccountIdentification11 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.tp
&& config.validate_optional_fields
{
val.validate(&helpers::child_path(path, "Tp"), config, collector);
}
helpers::validate_length(
&self.id,
"Id",
Some(1),
Some(320),
&helpers::child_path(path, "Id"),
config,
collector,
);
helpers::validate_pattern(
&self.id,
"Id",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
&helpers::child_path(path, "Id"),
config,
collector,
);
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct ProxyAccountType1Choice1 {
#[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
pub cd: Option<String>,
#[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
pub prtry: Option<String>,
}
impl Validate for ProxyAccountType1Choice1 {
fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
if let Some(ref val) = self.cd {
helpers::validate_length(
val,
"Cd",
Some(1),
Some(4),
&helpers::child_path(path, "Cd"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_length(
val,
"Prtry",
Some(1),
Some(35),
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
if let Some(ref val) = self.prtry {
helpers::validate_pattern(
val,
"Prtry",
"[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
&helpers::child_path(path, "Prtry"),
config,
collector,
);
}
}
}