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

/// partnerrolle for PID 44104
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Partnerrolle {
    /// andere zugehörige Partei
    #[serde(rename = "VY")]
    AndereZugehoerigePartei,
}

/// kommunikationsart for PID 44104
#[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 44104
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kontaktfunktion {
    /// Informationskontakt
    #[serde(rename = "IC")]
    Informationskontakt,
}

/// merkmal.code for PID 44104
#[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 44104
#[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 44104
#[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 44104
#[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,
}

/// merkmal.code for PID 44104
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MarktlokationZuordnungCode {
    /// Prognose auf Basis von Werten
    #[serde(rename = "ZC0")]
    PrognoseBasisWerten,
    /// Prognose auf Basis von Profilen
    #[serde(rename = "ZA6")]
    PrognoseBasisProfilen,
    /// Fallgruppenzuordnung nach GABi Gas
    #[serde(rename = "Z17")]
    FallgruppenzuordnungGabiGas,
}

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

/// bilanzkreiszuordnungStatus for PID 44104
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum BilanzkreiszuordnungStatus {
    /// gescheitert
    #[serde(rename = "Z13")]
    Gescheitert,
    /// erfolgreich
    #[serde(rename = "Z14")]
    Erfolgreich,
}

/// pruefidentifikator for PID 44104
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// NBW Gas / Aktualisierte Stammdaten zur verbrauchenden Marktlokation
    #[serde(rename = "44104")]
    NbwGasAktualisierteStammdatenVerbrauchendenMarktlokation,
}

/// statusCode for PID 44104
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusCode {
    /// gescheitert
    #[serde(rename = "Z13")]
    Gescheitert,
    /// erfolgreich
    #[serde(rename = "Z14")]
    Erfolgreich,
}

/// transaktionsgrund for PID 44104
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// Zusätzlicher Datensatz
    #[serde(rename = "Z15")]
    ZusaetzlicherDatensatz,
    /// Stammdatenänderung
    #[serde(rename = "ZE3")]
    Stammdatenaenderung,
    /// Weggefallene Markt- bzw. Messlokation
    #[serde(rename = "ZE4")]
    WeggefalleneMarktMesslokation,
}

#[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 MarktlokationZuordnungBilanzierungsgebiet {
    /// Required (unknown). ()
    pub qualifier: Option<String>,
    /// Required (unknown). ()
    pub wert: Option<String>,
}

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

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MarktlokationZuordnungRegelzone {
    /// Required (unknown). ()
    pub qualifier: Option<String>,
    /// Required (unknown). ()
    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"),
        }
    }
}

/// Geschaeftspartner for PID 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Geschaeftspartner {
    /// Required (Muss [570]). ()
    pub adresszusatz: Option<String>,
    /// Required (X). (an..35)
    pub geschaeftspartner_id: Option<String>,
    /// Required (Muss [570]). ()
    pub hausnummer: Option<String>,
    /// Required (Muss [570]). ()
    pub land: Option<String>,
    /// Required (Muss [570]). ()
    pub name1: Option<String>,
    /// Required (Muss [570]). ()
    pub name2: Option<String>,
    /// Required (Muss [570]). ()
    pub namenszusatz1: Option<String>,
    /// Required (Muss [570]). ()
    pub ort: Option<String>,
    /// Required (X). (an..3)
    pub partnerrolle: Option<Partnerrolle>,
    /// Required (Muss [570]). ()
    pub postleitzahl: Option<String>,
    /// Required (Muss [570]). ()
    pub region: Option<String>,
    /// Required (Muss [570]). ()
    pub strasse: Option<String>,
    /// Required (Muss [570]). ()
    pub strasse_zusatz: Option<String>,
    /// Required (Muss [570]). ()
    pub zusatzinfo: Option<String>,
    /// Required (Muss [570]). ()
    pub zusatzinfo_zeile2: Option<String>,
    /// Required (Muss [570]). ()
    pub zusatzinfo_zeile3: Option<String>,
    /// Required (Muss [570]). ()
    pub zusatzinfo_zeile4: Option<String>,
    /// Required (Muss [570]). ()
    pub zusatzinfo_zeile5: Option<String>,
}

/// Kontakt for PID 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[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 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct LastprofilDaten {
}

/// LastprofilDatenZuordnung for PID 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[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 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[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 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MarktlokationZuordnung {
    pub bilanzierungsgebiet: Option<MarktlokationZuordnungBilanzierungsgebiet>,
    pub marktgebiet: Option<MarktlokationZuordnungMarktgebiet>,
    pub merkmal: Option<MarktlokationZuordnungMerkmal>,
    pub regelzone: Option<MarktlokationZuordnungRegelzone>,
}

/// Marktteilnehmer for PID 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[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 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[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 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[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 44104 — Aktualisierte Stammdaten zur Markt-lokation.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (X [UB2]). (an..35)
    pub aenderung_zum: Option<String>,
    /// Required (X [UB2]). (an..35)
    pub bilanzierungsbeginn: Option<String>,
    /// Required (X [UB2]). (an..35)
    pub bilanzierungsende: Option<String>,
    /// Required (X). (an..3)
    pub bilanzkreiszuordnung_status: Option<BilanzkreiszuordnungStatus>,
    /// 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 (X). (an..3)
    pub status_code: Option<StatusCode>,
    /// Required (X). (an..3)
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
}

/// PID 44104 transaction — Aktualisierte Stammdaten zur Markt-lokation.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (Muss [570]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub geschaeftspartner: Option<Vec<Geschaeftspartner>>,
    /// Required (Muss [9] ∧ [106]).
    pub lastprofil_daten: Option<LastprofilDaten>,
    pub lastprofil_daten_zuordnung: Option<LastprofilDatenZuordnung>,
    /// Required (Muss [9]).
    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 44104 message-level — Aktualisierte Stammdaten zur Markt-lokation.
#[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 44104 — Aktualisierte Stammdaten zur Markt-lokation.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
