// 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;

/// merkmal.klasse for PID 55202
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MarktlokationKlasse {
    /// Bilanzkreis
    #[serde(rename = "Z19")]
    Bilanzkreis,
    /// Bilanzierungsgebiet
    #[serde(rename = "Z20")]
    Bilanzierungsgebiet,
    /// Struktur
    #[serde(rename = "15")]
    Struktur,
}

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

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

/// marktrolle for PID 55202
#[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 55202
#[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,
}

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

/// ebdNummer for PID 55202
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EbdNummer {
    /// EBD Nr. E_0096
    #[serde(rename = "E_0096")]
    EbdNrE0096,
    /// EBD Nr. E_0097
    #[serde(rename = "E_0097")]
    EbdNrE0097,
}

/// ebdNummer2 for PID 55202
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EbdNummer2 {
    /// EBD Nr. E_0096
    #[serde(rename = "E_0096")]
    EbdNrE0096,
    /// EBD Nr. E_0097
    #[serde(rename = "E_0097")]
    EbdNrE0097,
}

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

/// pruefidentifikator for PID 55202
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// Redispatch / Korrekturliste LF-AACL
    #[serde(rename = "55202")]
    RedispatchKorrekturlisteLfAacl,
}

/// transaktionsnummer for PID 55202
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsnummer {
    /// Redispatch / Korrekturliste LF-AACL
    #[serde(rename = "55202")]
    RedispatchKorrekturlisteLfAacl,
}

/// transaktionsnummer2 for PID 55202
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsnummer2 {
    /// Redispatch / Korrekturliste LF-AACL
    #[serde(rename = "55202")]
    RedispatchKorrekturlisteLfAacl,
}

/// referenz.typ for PID 55202
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SummenzeitreihenDatenTyp {
    /// Referenz auf eine Zeitreihe
    #[serde(rename = "AUU")]
    ReferenzZeitreihe,
}

/// referenz.typ for PID 55202
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TrancheDatenTyp {
    /// Tranche
    #[serde(rename = "Z20")]
    Tranche,
}

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

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

#[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 SummenzeitreihenDatenReferenz {
    /// Required (X). (an..70)
    pub id: Option<String>,
    /// Required (X). (an..3)
    pub typ: Option<SummenzeitreihenDatenTyp>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TrancheDatenReferenz {
    /// Required (X [950]). (an..70)
    pub id: Option<String>,
    /// Required (X). (an..3)
    pub typ: Option<TrancheDatenTyp>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TrancheDatenZeitscheibe {
    /// Required (X). (an..10)
    pub referenz: 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 55202 — Korrekturliste LF-AACL.
#[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 [910]). (an..35)
    pub jahresverbrauchsprognose: Option<String>,
    /// Required (X). (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub marktlokations_id: Option<String>,
    /// Required (X). (an..8)
    pub mengeneinheit: Option<MarktlokationMengeneinheit>,
    pub merkmal: Option<MarktlokationMerkmal>,
    /// Required (X [950]). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<MarktlokationZeitscheibe>,
}

/// Marktteilnehmer for PID 55202 — Korrekturliste LF-AACL.
#[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 55202 — Korrekturliste LF-AACL.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (X [902]). (an..35)
    pub jahresverbrauchsprognose: Option<String>,
    /// Required (X [951]). (an..35)
    pub mabis_zaehlpunkt_id: Option<String>,
    /// Required (X). (an..8)
    pub mengeneinheit: Option<MesslokationMengeneinheit>,
}

/// Nachricht for PID 55202 — Korrekturliste LF-AACL.
#[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 55202 — Korrekturliste LF-AACL.
#[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>,
}

/// SummenzeitreihenDaten for PID 55202 — Korrekturliste LF-AACL.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct SummenzeitreihenDaten {
    pub referenz: Option<SummenzeitreihenDatenReferenz>,
    pub zeitscheibe: Option<SummenzeitreihenDatenZeitscheibe>,
}

/// Tranche for PID 55202 — Korrekturliste LF-AACL.
#[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>,
}

/// TrancheDaten for PID 55202 — Korrekturliste LF-AACL.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct TrancheDaten {
    pub referenz: Option<TrancheDatenReferenz>,
    pub zeitscheibe: Option<TrancheDatenZeitscheibe>,
}

/// PID 55202 transaction — Korrekturliste LF-AACL.
#[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).
    pub summenzeitreihen_daten: Option<SummenzeitreihenDaten>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub tranche: Option<Vec<Tranche>>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub tranche_daten: Option<Vec<TrancheDaten>>,
}

/// PID 55202 message-level — Korrekturliste LF-AACL.
#[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 55202 — Korrekturliste LF-AACL.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
