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

#![allow(dead_code, unused_imports, non_camel_case_types)]

use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;

/// marktrolle for PID 55203
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Marktrolle {
    /// Dokumenten-/Nachrichtenaussteller bzw. -absender
    #[serde(rename = "MS")]
    DokumentenNachrichtenausstellerAbsender,
    /// Nachrichtenempfänger
    #[serde(rename = "MR")]
    Nachrichtenempfaenger,
}

/// rollencodetyp for PID 55203
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Rollencodetyp {
    /// GS1
    #[serde(rename = "9")]
    Gs1,
    /// DE, BDEW (Bundesverband der Energie- und Wasserwirtschaft e.V.)
    #[serde(rename = "293")]
    DeBdewBundesverbandEnergieWasserwirtschaftEV,
}

/// ideQualifier for PID 55203
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum IdeQualifier {
    /// Transaktion
    #[serde(rename = "24")]
    Transaktion,
}

/// pruefidentifikator for PID 55203
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// Redispatch / Aktivierung ZP monatliche AAÜZ
    #[serde(rename = "55203")]
    RedispatchAktivierungZpMonatlicheAauez,
}

/// merkmal.code for PID 55203
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum RedispatchDatenCode {
    /// Summenzeitreihentyp
    #[serde(rename = "Z21")]
    Summenzeitreihentyp,
}

/// merkmal.klasse for PID 55203
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum RedispatchDatenKlasse {
    /// Struktur
    #[serde(rename = "15")]
    Struktur,
    /// Regelzone
    #[serde(rename = "Z18")]
    Regelzone,
    /// Bilanzkreis "an"
    #[serde(rename = "Z28")]
    Bilanzkreis2,
    /// Bilanzkreis "von"
    #[serde(rename = "Z29")]
    Bilanzkreis3,
    /// Bilanzierungsgebiet
    #[serde(rename = "Z20")]
    Bilanzierungsgebiet,
}

/// merkmal.qualifier for PID 55203
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum RedispatchDatenQualifier {
    /// Beispielcode
    #[serde(rename = "XYZ")]
    DieserCodeAnwendungDurchZulaessigenCodeNbGueltigenListe,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RedispatchDatenMerkmal {
    /// Required (X). (an..17)
    pub code: Option<RedispatchDatenCode>,
    /// Required (unknown). ()
    pub dimension: Option<String>,
    /// Required (X). (an..3)
    pub klasse: Option<RedispatchDatenKlasse>,
    /// Required (X). (an..3)
    pub qualifier: Option<RedispatchDatenQualifier>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RedispatchDatenErwProduktIdentifikation {
    /// Required (X [254]). (an..35)
    pub id: Option<String>,
}

/// Map key for Marktteilnehmer instances.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum MarktteilnehmerKey {
    /// Dokumenten-/Nachrichtenaussteller bzw. -absender
    #[serde(rename = "MS")]
    Ms,
    /// Nachrichtenempfänger
    #[serde(rename = "MR")]
    Mr,
}

impl std::fmt::Display for MarktteilnehmerKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Ms => write!(f, "MS"),
            Self::Mr => write!(f, "MR"),
        }
    }
}

/// Marktteilnehmer for PID 55203 — Aktivierung ZP monatliche AAÜZ.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktteilnehmer {
    /// Required (unknown). ()
    pub codeliste_code: Option<String>,
    /// Required (X). (an..3)
    pub marktrolle: Option<Marktrolle>,
    /// Required (X). (an..35)
    pub rollencodenummer: Option<String>,
    /// Required (X). (an..3)
    pub rollencodetyp: Option<Rollencodetyp>,
}

/// Messlokation for PID 55203 — Aktivierung ZP monatliche AAÜZ.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (X [951]). (an..35)
    pub mabis_zaehlpunkt_id: Option<String>,
}

/// Nachricht for PID 55203 — Aktivierung ZP monatliche AAÜZ.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Optional. (an..35)
    pub erstellungsdatum: Option<String>,
    /// Optional. ()
    pub nachrichtennummer: Option<String>,
    /// Optional. ()
    pub nachrichtentyp: Option<String>,
}

/// Prozessdaten for PID 55203 — Aktivierung ZP monatliche AAÜZ.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (X [UB1]). (an..35)
    pub aenderung_von: Option<String>,
    /// Required (X). (an..3)
    pub ide_qualifier: Option<IdeQualifier>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
}

/// RedispatchDaten for PID 55203 — Aktivierung ZP monatliche AAÜZ.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct RedispatchDaten {
    pub merkmal: Option<RedispatchDatenMerkmal>,
}

/// RedispatchDatenErw for PID 55203 — Aktivierung ZP monatliche AAÜZ.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct RedispatchDatenErw {
    pub produkt_identifikation: Option<RedispatchDatenErwProduktIdentifikation>,
}

/// PID 55203 transaction — Aktivierung ZP monatliche AAÜZ.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub messlokation: Option<Vec<Messlokation>>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub redispatch_daten: Option<Vec<RedispatchDaten>>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub redispatch_daten_erw: Option<Vec<RedispatchDatenErw>>,
}

/// PID 55203 message-level — Aktivierung ZP monatliche AAÜZ.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Message {
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_map_or_vec")]
    pub marktteilnehmer: Option<BTreeMap<MarktteilnehmerKey, Marktteilnehmer>>,
    pub nachricht: Option<Nachricht>,
}

/// Complete interchange for PID 55203 — Aktivierung ZP monatliche AAÜZ.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
