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

/// textReferenz for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TextReferenz {
    /// Ergänzte Marktlokation
    #[serde(rename = "Z03")]
    ErgaenzteMarktlokation,
    /// Änderung vorhanden
    #[serde(rename = "Z05")]
    AenderungVorhanden,
}

/// textbezug for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Textbezug {
    /// Information über Abweichung
    #[serde(rename = "ABO")]
    InformationAbweichung,
}

/// partnerrolle for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Partnerrolle {
    /// Lieferanschrift
    #[serde(rename = "DP")]
    Lieferanschrift,
}

/// kommunikationsart for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kommunikationsart {
    /// Elektronische Post
    #[serde(rename = "EM")]
    ElektronischePost,
    /// Telefax
    #[serde(rename = "FX")]
    Telefax,
    /// Telefon
    #[serde(rename = "TE")]
    Telefon,
    /// weiteres Telefon
    #[serde(rename = "AJ")]
    WeiteresTelefon,
    /// Handy
    #[serde(rename = "AL")]
    Handy,
}

/// kontaktfunktion for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kontaktfunktion {
    /// Informationskontakt
    #[serde(rename = "IC")]
    Informationskontakt,
}

/// merkmal.code for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LastprofilDatenZuordnungCode {
    /// synthetisches Verfahren
    #[serde(rename = "E01")]
    SynthetischesVerfahren,
    /// analytisches Verfahren
    #[serde(rename = "Z10")]
    AnalytischesVerfahren,
}

/// merkmal.codepflege for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LastprofilDatenZuordnungCodepflege {
    /// Vergeben vom Händler (hier Netzbetreiber)
    #[serde(rename = "89")]
    VergebenHaendlerHierNetzbetreiber,
    /// DE, BDEW (Bundesverband der Energie- und Wasserwirtschaft e.V.)
    #[serde(rename = "293")]
    DeBdewBundesverbandEnergieWasserwirtschaftEV,
}

/// merkmal.klasse for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LastprofilDatenZuordnungKlasse {
    /// Lastprofil
    #[serde(rename = "Z12")]
    Lastprofil,
    /// Messstelle des Tagesparameters (derzeit ist nur die Temperatur ein erlaubter ...
    #[serde(rename = "Z99")]
    MessstelleTagesparametersDerzeitTemperaturErlaubterTagesparameter,
    /// Klimazone des Tagesparameters (derzeit ist Tagesparameter)
    #[serde(rename = "ZA0")]
    KlimazoneTagesparametersDerzeitTagesparameter,
}

/// merkmal.qualifier for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LastprofilDatenZuordnungQualifier {
    /// Dieser Code ist in der Anwendung durch einen zulässigen Code zu ersetzen!
    #[serde(rename = "XYZ")]
    DieserCodeAnwendungDurchZulaessigenCodeNbGueltigenListe,
}

/// sg10.bilanzierungsgebiet.qualifier for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MarktlokationZuordnungSg10Qualifier {
    /// Netznutzungsvertrag
    #[serde(rename = "Z74")]
    Netznutzungsvertrag,
    /// Zahlung der Netznutzung
    #[serde(rename = "Z73")]
    ZahlungNetznutzung,
}

/// sg10.bilanzierungsgebiet.wert for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MarktlokationZuordnungSg10Wert {
    /// Direkter Vertrag zwischen Kunden und NB
    #[serde(rename = "Z08")]
    DirekterVertragKundenNb,
    /// Vertrag zwischen Lieferanten und NB
    #[serde(rename = "Z09")]
    VertragLieferantenNb,
    /// Kunde
    #[serde(rename = "Z10")]
    Kunde,
    /// Lieferant
    #[serde(rename = "Z11")]
    Lieferant,
}

/// sg10.merkmal.klasse for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MarktlokationZuordnungSg10Klasse {
    /// Bilanzkreis
    #[serde(rename = "Z19")]
    Bilanzkreis,
}

/// marktrolle for PID 44020
#[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 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Rollencodetyp {
    /// GS1
    #[serde(rename = "9")]
    Gs1,
    /// DE, DVGW Service & Consult GmbH
    #[serde(rename = "332")]
    DeDvgwServiceConsultGmbh,
}

/// pruefidentifikator for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// GeLi Gas / Änderungsmeldung zur Bestandsliste
    #[serde(rename = "44020")]
    GeliGasAenderungsmeldungBestandsliste,
}

/// transaktionsgrund for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// Es wird unverzüglich eine Korrektur der Zuordnungsliste vom LF an den NB vers...
    #[serde(rename = "ZD0")]
    EsUnverzueglichKorrekturZuordnungslisteLfNbVersendetAbweichendenInhalt,
}

/// transaktionsnummer for PID 44020
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsnummer {
    /// GeLi Gas / Änderungsmeldung zur Bestandsliste
    #[serde(rename = "44020")]
    GeliGasAenderungsmeldungBestandsliste,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LastprofilDatenZuordnungMerkmal {
    /// Required (X). (an..17)
    pub code: Option<LastprofilDatenZuordnungCode>,
    /// Required (unknown). ()
    pub code_codepflege: Option<String>,
    /// Required (unknown). ()
    pub codeliste: Option<String>,
    /// Required (X). (an..3)
    pub codepflege: Option<LastprofilDatenZuordnungCodepflege>,
    /// Required (unknown). ()
    pub dimension: Option<String>,
    /// Required (X). (an..3)
    pub klasse: Option<LastprofilDatenZuordnungKlasse>,
    /// Required (X). (an..3)
    pub qualifier: Option<LastprofilDatenZuordnungQualifier>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MarktlokationZuordnungSg10Bilanzierungsgebiet {
    /// Required (X). (an..3)
    pub qualifier: Option<MarktlokationZuordnungSg10Qualifier>,
    /// Required (X). (an..35)
    pub wert: Option<MarktlokationZuordnungSg10Wert>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MarktlokationZuordnungSg10Marktgebiet {
    /// Required (X). (an..3)
    pub qualifier: Option<MarktlokationZuordnungSg10Qualifier>,
    /// Required (X). (an..35)
    pub wert: Option<MarktlokationZuordnungSg10Wert>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MarktlokationZuordnungSg10Regelzone {
    /// Required (X). (an..3)
    pub qualifier: Option<MarktlokationZuordnungSg10Qualifier>,
    /// Required (X). (an..35)
    pub wert: Option<MarktlokationZuordnungSg10Wert>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MarktlokationZuordnungSg10 {
    pub bilanzierungsgebiet: Option<MarktlokationZuordnungSg10Bilanzierungsgebiet>,
    pub marktgebiet: Option<MarktlokationZuordnungSg10Marktgebiet>,
    pub merkmal: Option<MarktlokationZuordnungSg10Merkmal>,
    pub regelzone: Option<MarktlokationZuordnungSg10Regelzone>,
}

/// Map key for Geschaeftspartner instances.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum GeschaeftspartnerKey {
    #[serde(rename = "DP")]
    Dp,
    #[serde(rename = "Z09")]
    Z09,
}

impl std::fmt::Display for GeschaeftspartnerKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Dp => write!(f, "DP"),
            Self::Z09 => write!(f, "Z09"),
        }
    }
}

/// 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"),
        }
    }
}

/// Freitext for PID 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Freitext {
    /// Required (Kann). (an..512)
    pub text: Option<String>,
    /// Required (X). (an..17)
    pub text_referenz: Option<TextReferenz>,
    /// Required (unknown). ()
    pub text_zeile2: Option<String>,
    /// Required (unknown). ()
    pub text_zeile3: Option<String>,
    /// Required (unknown). ()
    pub text_zeile4: Option<String>,
    /// Required (unknown). ()
    pub text_zeile5: Option<String>,
    /// Required (X). (an..3)
    pub textbezug: Option<Textbezug>,
    /// Required (unknown). ()
    pub textfunktion: Option<String>,
}

/// Geschaeftspartner for PID 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Geschaeftspartner {
    /// Optional. (an..35)
    pub adresszusatz: Option<String>,
    /// Required (X). ()
    pub geschaeftspartner_id: Option<String>,
    /// Optional. (an..35)
    pub hausnummer: Option<String>,
    /// Required (X). (an..3)
    pub land: Option<String>,
    /// Required (X). (an..70)
    pub name1: Option<String>,
    /// Optional. (an..70)
    pub name2: Option<String>,
    /// Optional. (an..70)
    pub namenszusatz1: Option<String>,
    /// Required (X). (an..35)
    pub ort: Option<String>,
    /// Required (X). (an..3)
    pub partnerrolle: Option<Partnerrolle>,
    /// Required (X). (an..17)
    pub postleitzahl: Option<String>,
    /// Required (X). ()
    pub region: Option<String>,
    /// Required (S [166] M [212]). (an..35)
    pub strasse: Option<String>,
    /// Optional. (an..35)
    pub strasse_zusatz: Option<String>,
    /// Required (K). (an..35)
    pub zusatzinfo: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo_zeile2: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo_zeile3: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo_zeile4: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo_zeile5: Option<String>,
}

/// Kontakt for PID 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Kontakt {
    /// Required (X [1P0..1]). (an..3)
    pub kommunikationsart: Option<Kommunikationsart>,
    /// Required (X). (an..512)
    pub kommunikationsnummer: Option<String>,
    pub kontakt: Option<KontaktKontakt>,
    /// Required (X). (an..3)
    pub kontaktfunktion: Option<Kontaktfunktion>,
}

/// LastprofilDaten for PID 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct LastprofilDaten {
}

/// LastprofilDatenZuordnung for PID 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct LastprofilDatenZuordnung {
    pub merkmal: Option<LastprofilDatenZuordnungMerkmal>,
    /// Required (unknown). ()
    pub zugeordneter_mp: Option<String>,
}

/// Marktlokation for PID 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktlokation {
    /// Required (X [902] ∧ [937]). (an..35)
    pub jahresmenge_gesamt: Option<String>,
    /// Required (X [902] ∧ [937]). (an..35)
    pub kundenwert: Option<String>,
}

/// MarktlokationZuordnung for PID 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MarktlokationZuordnung {
    pub sg10: Option<Vec<MarktlokationZuordnungSg10>>,
}

/// Marktteilnehmer for PID 44020 — Änderungs-meldung zur Bestands-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>,
    pub kontakt: Option<Kontakt>,
}

/// Messlokation for PID 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (X [950]). (an..35)
    pub meldepunkt_id: Option<String>,
}

/// Nachricht for PID 44020 — Änderungs-meldung zur Bestands-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 44020 — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (X [UB2]). (an..35)
    pub bilanzierungsbeginn: Option<String>,
    /// Required (X [UB2]). (an..35)
    pub bilanzierungsende: Option<String>,
    /// Required (X [UB2]). (an..35)
    pub gueltig_ab: Option<String>,
    /// Required (X [UB2]). (an..35)
    pub gueltig_bis: Option<String>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (unknown). ()
    pub status_code: Option<String>,
    /// Required (X). (an..3)
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Required (X). (an..70)
    pub transaktionsnummer: Option<Transaktionsnummer>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
}

/// PID 44020 transaction — Änderungs-meldung zur Bestands-liste.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    pub freitext: Option<Freitext>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_map_or_vec")]
    pub geschaeftspartner: Option<BTreeMap<GeschaeftspartnerKey, Geschaeftspartner>>,
    /// Required (X).
    pub lastprofil_daten: Option<LastprofilDaten>,
    pub lastprofil_daten_zuordnung: Option<LastprofilDatenZuordnung>,
    /// Required (Soll [92]).
    pub marktlokation: Option<Marktlokation>,
    pub marktlokation_zuordnung: Option<MarktlokationZuordnung>,
    /// Required (Muss [2061] ∧ [583]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub messlokation: Option<Vec<Messlokation>>,
    pub prozessdaten: Option<Prozessdaten>,
}

/// PID 44020 message-level — Änderungs-meldung zur Bestands-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 44020 — Änderungs-meldung zur Bestands-liste.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
