// Auto-generated by automapper-generator. Do not edit.

#![allow(unused_imports)]

use serde::{Deserialize, Serialize};
use super::entities::*;

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Pid29001MessageStammdaten {
    pub marktteilnehmer: Option<MarktteilnehmerWrapped>,
    pub nachricht: Option<Nachricht>,
}

/// PID 29001: Ablehnung REMADV
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Pid29001TransaktionStammdaten {
    /// Required (Muss). Fields: ebdReferenz, pruefschrittCode
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub abweichung: Option<Vec<Abweichung>>,
    /// Required (Muss). Fields: dokumentennummer, dokumenttyp, faelligerBetrag
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub dokument: Option<Vec<Dokument>>,
}

impl Pid29001TransaktionStammdaten {
    /// Required entity fields for PID 29001 (Ablehnung REMADV).
    ///
    /// Each entry is `(entity_field, required_bo4e_fields)`.
    pub fn required_fields() -> &'static [(&'static str, &'static [&'static str])] {
        &[
            ("abweichung", &["ebdReferenz", "pruefschrittCode"]),
            ("dokument", &["dokumentennummer", "dokumenttyp", "faelligerBetrag"]),
        ]
    }
}

pub type Pid29001Interchange = crate::model::Interchange<
    Pid29001MessageStammdaten,
    Pid29001TransaktionStammdaten,
>;

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Pid29002MessageStammdaten {
    pub marktteilnehmer: Option<MarktteilnehmerWrapped>,
    pub nachricht: Option<Nachricht>,
}

/// PID 29002: Ablehnung IFTSTA
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Pid29002TransaktionStammdaten {
    /// Required (Muss). Fields: ebdReferenz, pruefschrittCode
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub abweichung: Option<Vec<Abweichung>>,
    /// Required (Muss). Fields: dokumentennummer, dokumenttyp
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub dokument: Option<Vec<Dokument>>,
}

impl Pid29002TransaktionStammdaten {
    /// Required entity fields for PID 29002 (Ablehnung IFTSTA).
    ///
    /// Each entry is `(entity_field, required_bo4e_fields)`.
    pub fn required_fields() -> &'static [(&'static str, &'static [&'static str])] {
        &[
            ("abweichung", &["ebdReferenz", "pruefschrittCode"]),
            ("dokument", &["dokumentennummer", "dokumenttyp"]),
        ]
    }
}

pub type Pid29002Interchange = crate::model::Interchange<
    Pid29002MessageStammdaten,
    Pid29002TransaktionStammdaten,
>;

