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

/// mengenQualifier for PID 55065
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MengenQualifier {
    /// Leistung der Marktlokation
    #[serde(rename = "Z10")]
    LeistungMarktlokation,
    /// Veranschlagte Jahresmenge Gesamt/Jahresverbrauchsprognose für spezifische Arb...
    #[serde(rename = "265")]
    VeranschlagteJahresmengeGesamtJahresverbrauchsprognoseSpezifischeArbeit,
    /// Angepasste elektrische Arbeit nach Anhang D der VDN-Richtlinie "Lastprofile f...
    #[serde(rename = "Z08")]
    AngepassteElektrischeArbeitAnhangDVdnRichtlinieLastprofileUnterbrechbare,
    /// Veranschlagte Jahresmenge Gesamt
    #[serde(rename = "31")]
    VeranschlagteJahresmengeGesamt,
    /// Tatsächlich bilanzierte Energiemenge
    #[serde(rename = "Z07")]
    TatsaechlichBilanzierteEnergiemenge,
}

/// mengeneinheit for PID 55065
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MarktlokationMengenMengeneinheit {
    /// kWh/K (Kilowatt-Stunde/Kelvin)
    #[serde(rename = "Z16")]
    KwhKKilowattStundeKelvin,
    /// Kilowattstunde
    #[serde(rename = "KWH")]
    Kilowattstunde,
    /// Kilowatt
    #[serde(rename = "KWT")]
    Kilowatt,
}

/// marktrolle for PID 55065
#[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 55065
#[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 55065
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MesslokationMengeneinheit {
    /// Kilowattstunde
    #[serde(rename = "KWH")]
    Kilowattstunde,
}

/// referenz.typ for PID 55065
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ProfilDatenTyp {
    /// Referenz auf ein Profil
    #[serde(rename = "Z12")]
    ReferenzProfil,
    /// Marktlokation
    #[serde(rename = "Z18")]
    Marktlokation,
}

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

/// pruefidentifikator for PID 55065
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// MaBiS / Lieferantenclearingliste
    #[serde(rename = "55065")]
    MabisLieferantenclearingliste,
}

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

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

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

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

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

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

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReferenzprofilZeitscheibe {
    /// Optional. (an..10)
    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 {
    /// Optional. (an..10)
    pub referenz: 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 55065 — Lieferanten-clearingliste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktlokation {
    /// Required (Muss [2061] ∧ [348]). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [2061] ∧ [348]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub marktlokations_id: Option<String>,
    /// Required (X [950]). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<MarktlokationZeitscheibe>,
}

/// MarktlokationMengen for PID 55065 — Lieferanten-clearingliste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MarktlokationMengen {
    /// Required (X [902]). (an..35)
    pub menge: Option<String>,
    /// Required (X). (an..3)
    pub mengen_qualifier: Option<MengenQualifier>,
    /// Required (X [103]). (an..8)
    pub mengeneinheit: Option<MarktlokationMengenMengeneinheit>,
}

/// Marktteilnehmer for PID 55065 — Lieferanten-clearingliste.
#[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 55065 — Lieferanten-clearingliste.
#[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 55065 — Lieferanten-clearingliste.
#[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>,
    /// Required (X [503]). (an..70)
    pub referenz_version: Option<String>,
}

/// ProfilDaten for PID 55065 — Lieferanten-clearingliste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ProfilDaten {
    pub referenz: Option<ProfilDatenReferenz>,
    pub zeitscheibe: Option<ProfilDatenZeitscheibe>,
}

/// Prozessdaten for PID 55065 — Lieferanten-clearingliste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (X [UB1]). (an..35)
    pub aenderung_bis: Option<String>,
    /// 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>,
}

/// Referenzprofil for PID 55065 — Lieferanten-clearingliste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Referenzprofil {
    /// Required (X). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<ReferenzprofilZeitscheibe>,
}

/// SummenzeitreihenDaten for PID 55065 — Lieferanten-clearingliste.
#[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 55065 — Lieferanten-clearingliste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Tranche {
    /// Required (Soll [2061] ∧ [166]). ()
    pub codeliste_code: Option<String>,
    /// Required (Soll [2061] ∧ [166]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub tranche_id: Option<String>,
}

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

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

/// PID 55065 transaction — Lieferanten-clearingliste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (Muss [2061] ∧ [348]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub marktlokation: Option<Vec<Marktlokation>>,
    pub marktlokation_mengen: Option<MarktlokationMengen>,
    /// Required (Muss [2140]).
    pub messlokation: Option<Messlokation>,
    /// Required (Muss [370] ∧ [371]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub profil_daten: Option<Vec<ProfilDaten>>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (Soll [372] ∧ [373]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub referenzprofil: Option<Vec<Referenzprofil>>,
    /// Required (X).
    pub summenzeitreihen_daten: Option<SummenzeitreihenDaten>,
    /// Required (Soll [2061] ∧ [166]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub tranche: Option<Vec<Tranche>>,
    /// Required (Muss [167]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub tranche_daten: Option<Vec<TrancheDaten>>,
    pub zuordnung: Option<Zuordnung>,
}

/// PID 55065 message-level — Lieferanten-clearingliste.
#[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 55065 — Lieferanten-clearingliste.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
