// 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 55223
#[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 55223
#[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 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum IdeQualifier {
    /// Liste
    #[serde(rename = "Z01")]
    Liste,
    /// Transaktion
    #[serde(rename = "24")]
    Transaktion,
}

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

/// transaktionsgrund for PID 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// Stammdaten
    #[serde(rename = "ZP3")]
    Stammdaten,
    /// Werte
    #[serde(rename = "ZP4")]
    Werte,
}

/// transaktionsgrundDetail for PID 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TransaktionsgrundDetail {
    /// Der LFN wird einer Marktlokation vollständig zugeordnet (vollständige (100%ig...
    #[serde(rename = "ZW0")]
    LfnMarktlokationVollstaendigZugeordnetVollstaendige100IgeZuordnungDieser,
    /// Der LFN wird einer bestehenden Tranche vollständig zugeordnet (vollständige (...
    #[serde(rename = "ZW1")]
    LfnBestehendenTrancheVollstaendigZugeordnetVollstaendige100IgeZuordnung,
    /// Der LFN wird einer neu zu bildenden Tranche zugeordnet (anteiliger Zuordnungs...
    #[serde(rename = "ZW2")]
    LfnNeuBildendenTrancheZugeordnetAnteiligerZuordnungsvorgangBildungNeuer,
    /// Erzeugende Marktlokation
    #[serde(rename = "ZW3")]
    ErzeugendeMarktlokation,
    /// Verbrauchende Marktlokation
    #[serde(rename = "ZW4")]
    VerbrauchendeMarktlokation,
    /// Tranche
    #[serde(rename = "ZW5")]
    Tranche,
    /// Pauschale Marktlokation
    #[serde(rename = "ZW6")]
    PauschaleMarktlokation,
    /// Gemessene Marktlokation
    #[serde(rename = "ZW7")]
    GemesseneMarktlokation,
    /// Fall 1
    #[serde(rename = "ZW8")]
    Fall1,
    /// Fall 2
    #[serde(rename = "ZW9")]
    Fall2,
    /// Fall 3
    #[serde(rename = "ZX0")]
    Fall3,
    /// Fall 4
    #[serde(rename = "ZX1")]
    Fall4,
    /// ruhende Marktlokation
    #[serde(rename = "ZAP")]
    RuhendeMarktlokation,
    /// Die Stilllegung der MeLo hat auch die Stilllegung einer MaLo zur Folge
    #[serde(rename = "ZZB")]
    StilllegungMeloStilllegungMaloFolgeDieserCodeErst142026GueltigDavor,
    /// Die Stilllegung der MeLo hat keine Stilllegung einer MaLo zur Folge
    #[serde(rename = "ZZC")]
    StilllegungMeloKeineStilllegungMaloFolgeDieserCodeErst142026Gueltig,
}

/// transaktionsgrundErgaenzung for PID 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TransaktionsgrundErgaenzung {
    /// Kunde verlässt eine schon bestehende Marktlokation
    #[serde(rename = "E01")]
    KundeVerlaesstBestehendeMarktlokation,
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
}

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

/// mengenQualifier for PID 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZeitreihenDaten47MengenMengenQualifier {
    /// Veranschlagte Jahresmenge Gesamt
    #[serde(rename = "31")]
    VeranschlagteJahresmengeGesamt,
    /// Energiemenge: DZÜ-Anteil
    #[serde(rename = "Z36")]
    EnergiemengeDzueAnteil,
    /// Zu bilanzierende Energiemenge
    #[serde(rename = "Z45")]
    BilanzierendeEnergiemenge,
}

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

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

/// mengenQualifier for PID 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZeitreihenDaten48MengenMengenQualifier {
    /// Veranschlagte Jahresmenge Gesamt
    #[serde(rename = "31")]
    VeranschlagteJahresmengeGesamt,
    /// Energiemenge: DZÜ-Anteil
    #[serde(rename = "Z36")]
    EnergiemengeDzueAnteil,
    /// Zu bilanzierende Energiemenge
    #[serde(rename = "Z45")]
    BilanzierendeEnergiemenge,
}

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

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

/// mengenQualifier for PID 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZeitreihenDaten49MengenMengenQualifier {
    /// Veranschlagte Jahresmenge Gesamt
    #[serde(rename = "31")]
    VeranschlagteJahresmengeGesamt,
    /// Energiemenge: DZÜ-Anteil
    #[serde(rename = "Z36")]
    EnergiemengeDzueAnteil,
    /// Zu bilanzierende Energiemenge
    #[serde(rename = "Z45")]
    BilanzierendeEnergiemenge,
}

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

/// merkmal.klasse for PID 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungKlasse {
    /// 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 55223
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungQualifier {
    /// Beispielcode
    #[serde(rename = "XYZ")]
    DieserCodeAnwendungDurchZulaessigenCodeNbGueltigenListe,
    /// Lokation im Regelbetrieb
    #[serde(rename = "ZG3")]
    LokationRegelbetrieb,
    /// Lokation außerhalb des Regelbetriebs (Stilllegung)
    #[serde(rename = "ZG4")]
    LokationAusserhalbRegelbetriebsStilllegung,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZeitreihenDaten47MengenDatum {
    /// Required (X). (an..3)
    pub format: Option<ZeitreihenDaten47MengenFormat>,
    /// Required (X [UB1]). (an..35)
    pub wert: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZeitreihenDaten48MengenDatum {
    /// Required (X). (an..3)
    pub format: Option<ZeitreihenDaten48MengenFormat>,
    /// Required (X [UB1]). (an..35)
    pub wert: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZeitreihenDaten49MengenDatum {
    /// Required (X). (an..3)
    pub format: Option<ZeitreihenDaten49MengenFormat>,
    /// Required (X [UB1]). (an..35)
    pub wert: Option<String>,
}

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

/// 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 55223 — DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktlokation {
    /// Required (X). ()
    pub codeliste_code: Option<String>,
    /// Required (X). ()
    pub codepflege_code: Option<String>,
    /// Required (X). (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub marktlokations_id: Option<String>,
}

/// Marktteilnehmer for PID 55223 — 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 55223 — 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 55223 — DZÜ Liste.
#[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 55223 — DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (unknown). ()
    pub bearbeitungsstand: Option<String>,
    /// Required (X). (an..3)
    pub ide_qualifier: Option<IdeQualifier>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..3)
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Optional. (an..3)
    pub transaktionsgrund_detail: Option<TransaktionsgrundDetail>,
    /// Optional. (an..3)
    pub transaktionsgrund_ergaenzung: Option<TransaktionsgrundErgaenzung>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
}

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

/// ZeitreihenDaten47 for PID 55223 — DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ZeitreihenDaten47 {
}

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

/// ZeitreihenDaten48 for PID 55223 — DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ZeitreihenDaten48 {
    /// Required (X [951]). (an..70)
    pub referenz: Option<String>,
}

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

/// ZeitreihenDaten49 for PID 55223 — DZÜ Liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ZeitreihenDaten49 {
    /// Required (X [951]). (an..70)
    pub referenz: Option<String>,
}

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

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

/// PID 55223 transaction — DZÜ Liste.
#[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 marktlokation: Option<Vec<Marktlokation>>,
    /// Required (X).
    pub messlokation: Option<Messlokation>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub tranche: Option<Vec<Tranche>>,
    /// Required (X).
    pub zeitreihen_daten47: Option<ZeitreihenDaten47>,
    pub zeitreihen_daten47_mengen: Option<ZeitreihenDaten47Mengen>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub zeitreihen_daten48: Option<Vec<ZeitreihenDaten48>>,
    pub zeitreihen_daten48_mengen: Option<ZeitreihenDaten48Mengen>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub zeitreihen_daten49: Option<Vec<ZeitreihenDaten49>>,
    pub zeitreihen_daten49_mengen: Option<ZeitreihenDaten49Mengen>,
    pub zuordnung: Option<Zuordnung>,
}

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