// 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 55224
#[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 55224
#[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,
}

/// ebdNummer for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EbdNummer {
    /// EBD Nr. E_0070
    #[serde(rename = "E_0070")]
    EbdNrE0070,
}

/// ebdNummer2 for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EbdNummer2 {
    /// EBD Nr. E_0070
    #[serde(rename = "E_0070")]
    EbdNrE0070,
}

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

/// pruefidentifikator for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// MaBiS / Antwort auf DZÜ Liste
    #[serde(rename = "55224")]
    MabisAntwortDzueListe,
}

/// transaktionsnummer for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsnummer {
    /// MaBiS / Antwort auf DZÜ Liste
    #[serde(rename = "55224")]
    MabisAntwortDzueListe,
}

/// transaktionsnummer2 for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsnummer2 {
    /// MaBiS / Antwort auf DZÜ Liste
    #[serde(rename = "55224")]
    MabisAntwortDzueListe,
}

/// merkmal.klasse for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZaehlerKlasse {
    /// Bilanzkreis
    #[serde(rename = "Z19")]
    Bilanzkreis,
    /// Bilanzierungsgebiet
    #[serde(rename = "Z20")]
    Bilanzierungsgebiet,
    /// Struktur
    #[serde(rename = "15")]
    Struktur,
    /// Standardlastprofil
    #[serde(rename = "Z02")]
    Standardlastprofil,
    /// Standardeinspeiseprofil
    #[serde(rename = "Z04")]
    Standardeinspeiseprofil,
    /// Verantwortlicher
    #[serde(rename = "6")]
    Verantwortlicher,
}

/// merkmal.qualifier for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZaehlerQualifier {
    /// Beispielcode
    #[serde(rename = "XYZ")]
    DieserCodeAnwendungDurchZulaessigenCodeNbGueltigenListe,
    /// Lokation im Regelbetrieb
    #[serde(rename = "ZG3")]
    LokationRegelbetrieb,
    /// Lokation außerhalb des Regelbetriebs (Stilllegung)
    #[serde(rename = "ZG4")]
    LokationAusserhalbRegelbetriebsStilllegung,
}

/// datum.format for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZaehlerMengenFormat {
    /// CCYYMMDDHHMMZZZ
    #[serde(rename = "303")]
    Ccyymmddhhmmzzz,
}

/// mengenQualifier for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MengenQualifier {
    /// Veranschlagte Jahresmenge Gesamt
    #[serde(rename = "31")]
    VeranschlagteJahresmengeGesamt,
    /// Zu bilanzierende Energiemenge
    #[serde(rename = "Z45")]
    BilanzierendeEnergiemenge,
}

/// mengeneinheit for PID 55224
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Mengeneinheit {
    /// Kilowattstunde
    #[serde(rename = "KWH")]
    Kilowattstunde,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProzessdatenZeitscheibe {
    /// Required (unknown). ()
    pub referenz: Option<String>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZaehlerMengenDatum {
    /// Required (X). (an..3)
    pub format: Option<ZaehlerMengenFormat>,
    /// Required (X [UB1] ∧ [454]). (an..35)
    pub wert: 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"),
        }
    }
}

/// Marktlokation for PID 55224 — Antwort auf DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktlokation {
    /// Required (Muss [2061] ∧ [348] ∧ [659]). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [2061] ∧ [348] ∧ [659]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950] [528]). (an..35)
    pub marktlokations_id: Option<String>,
}

/// Marktteilnehmer for PID 55224 — Antwort auf DZÜ Liste.
#[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 55224 — Antwort auf DZÜ Liste.
#[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>,
    /// Required (X). (an..70)
    pub referenz: Option<String>,
}

/// Nachricht for PID 55224 — Antwort auf DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Required (X [931] [494]). (an..35)
    pub erstellungsdatum: Option<String>,
    /// Optional. ()
    pub nachrichtennummer: Option<String>,
    /// Optional. ()
    pub nachrichtentyp: Option<String>,
}

/// Prozessdaten for PID 55224 — Antwort auf DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (unknown). ()
    pub antwort_bearbeitungsstand: Option<String>,
    /// Required (unknown). ()
    pub antwort_bearbeitungsstand2: Option<String>,
    /// Required (unknown). ()
    pub codepflege_stelle: Option<String>,
    /// Required (unknown). ()
    pub codepflege_stelle2: Option<String>,
    /// Required (X). (an..17)
    pub ebd_nummer: Option<EbdNummer>,
    /// Required (X). (an..17)
    pub ebd_nummer2: Option<EbdNummer2>,
    /// Required (X). (an..3)
    pub ide_qualifier: Option<IdeQualifier>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..3)
    pub pruefschritt_code: Option<String>,
    /// Required (X). (an..3)
    pub pruefschritt_code2: Option<String>,
    /// Required (X). (an..70)
    pub transaktionsnummer: Option<Transaktionsnummer>,
    /// Required (X). (an..70)
    pub transaktionsnummer2: Option<Transaktionsnummer2>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
    /// Required (unknown). ()
    pub zeitraum_id2: Option<String>,
    pub zeitscheibe: Option<ProzessdatenZeitscheibe>,
}

/// Tranche for PID 55224 — Antwort auf DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Tranche {
    /// Required (Muss [2061] ∧ [347] ∧ [659]). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [2061] ∧ [347] ∧ [659]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950] [528]). (an..35)
    pub tranche_id: Option<String>,
}

/// Zaehler for PID 55224 — Antwort auf DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Zaehler {
    pub merkmal: Option<ZaehlerMerkmal>,
}

/// ZaehlerMengen for PID 55224 — Antwort auf DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ZaehlerMengen {
    pub datum: Option<ZaehlerMengenDatum>,
    /// Required (X [902] ∧ [937]). (an..35)
    pub menge: Option<String>,
    /// Required (X). (an..3)
    pub mengen_qualifier: Option<MengenQualifier>,
    /// Required (X). (an..8)
    pub mengeneinheit: Option<Mengeneinheit>,
}

/// PID 55224 transaction — Antwort auf DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (Muss [2061] ∧ [348] ∧ [659]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub marktlokation: Option<Vec<Marktlokation>>,
    /// Required (X).
    pub messlokation: Option<Messlokation>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (Muss [2061] ∧ [347] ∧ [659]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub tranche: Option<Vec<Tranche>>,
    /// Required (Soll [31]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub zaehler: Option<Vec<Zaehler>>,
    pub zaehler_mengen: Option<ZaehlerMengen>,
}

/// PID 55224 message-level — Antwort auf DZÜ Liste.
#[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 55224 — Antwort auf DZÜ Liste.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
