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

/// textbezug for PID 44016
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Textbezug {
    /// Zusätzliche Informationen (für allgemeine Hinweise)
    #[serde(rename = "ACB")]
    ZusaetzlicheInformationenAllgemeineHinweise,
}

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

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

/// identifikationslogikCode for PID 44016
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum IdentifikationslogikCode {
    /// Identifikationslogik
    #[serde(rename = "Z36")]
    Identifikationslogik,
}

/// identifikationslogikWert for PID 44016
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum IdentifikationslogikWert {
    /// Marktlokations-ID
    #[serde(rename = "Z12")]
    MarktlokationsId,
    /// Alle Identifikationsdaten
    #[serde(rename = "Z13")]
    AlleIdentifikationsdaten,
}

/// pruefidentifikator for PID 44016
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// GeLi Gas / Kündigung beim alten Lieferanten
    #[serde(rename = "44016")]
    GeliGasKuendigungBeimAltenLieferanten,
}

/// transaktionsgrund for PID 44016
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
}

/// geraetnummer.qualifier for PID 44016
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZaehlerZuordnungQualifier {
    /// Gerätenummer
    #[serde(rename = "Z30")]
    Geraetenummer,
}

/// merkmal.code for PID 44016
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZaehlerZuordnungCode {
    /// Zählertyp
    #[serde(rename = "E13")]
    Zaehlertyp,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZaehlerZuordnungGeraetnummer {
    /// Required (unknown). ()
    pub codeliste_code: Option<String>,
    /// Required (unknown). ()
    pub codepflege: Option<String>,
    /// Required (X). (an..35)
    pub nummer: Option<String>,
    /// Required (X). (an..3)
    pub qualifier: Option<ZaehlerZuordnungQualifier>,
    /// Optional. (an..35)
    pub teil2: Option<String>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZaehlerZuordnungVolumenerfassung {
    /// Required (unknown). ()
    pub codeliste_code: Option<String>,
    /// Required (unknown). ()
    pub codepflege: Option<String>,
    /// Required (X). (an..3)
    pub qualifier: Option<ZaehlerZuordnungQualifier>,
    /// Required (X). (an..35)
    pub wert: Option<String>,
}

/// 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 44016 — Kündigung beim alten Lieferanten.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Freitext {
    /// Required (X). (an..512)
    pub text: Option<String>,
    /// Required (unknown). ()
    pub text_referenz: Option<String>,
    /// Optional. (an..512)
    pub text_zeile2: Option<String>,
    /// Optional. (an..512)
    pub text_zeile3: Option<String>,
    /// Optional. (an..512)
    pub text_zeile4: Option<String>,
    /// Optional. (an..512)
    pub text_zeile5: Option<String>,
    /// Required (X). (an..3)
    pub textbezug: Option<Textbezug>,
    /// Required (unknown). ()
    pub textfunktion: Option<String>,
}

/// Geschaeftspartner for PID 44016 — Kündigung beim alten Lieferanten.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Geschaeftspartner {
    /// Required (X). (an..35)
    pub adresszusatz: Option<String>,
    /// Required (X). ()
    pub geschaeftspartner_id: Option<String>,
    /// Required (X). (an..35)
    pub hausnummer: Option<String>,
    /// Required (X). (an..3)
    pub land: Option<String>,
    /// Required (X). (an..70)
    pub name1: Option<String>,
    /// Required (X). (an..70)
    pub name2: Option<String>,
    /// Required (X). (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 [165] M [212]). (an..35)
    pub strasse: Option<String>,
    /// Required (X). (an..35)
    pub strasse_zusatz: Option<String>,
    /// Required (K). (an..35)
    pub zusatzinfo: Option<String>,
    /// Required (X). (an..35)
    pub zusatzinfo_zeile2: Option<String>,
    /// Required (X). (an..35)
    pub zusatzinfo_zeile3: Option<String>,
    /// Required (X). (an..35)
    pub zusatzinfo_zeile4: Option<String>,
    /// Required (X). (an..35)
    pub zusatzinfo_zeile5: Option<String>,
}

/// Marktteilnehmer for PID 44016 — Kündigung beim alten Lieferanten.
#[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 44016 — Kündigung beim alten Lieferanten.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (X [953]). (an..35)
    pub meldepunkt_id: Option<String>,
}

/// Nachricht for PID 44016 — Kündigung beim alten Lieferanten.
#[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 44016 — Kündigung beim alten Lieferanten.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (X [UB2]). (an..35)
    pub ende_zum: Option<String>,
    /// Required (X [UB2]). (an..35)
    pub gueltig_bis: Option<String>,
    /// Required (unknown). ()
    pub identifikationsformat: Option<String>,
    /// Required (X). (an..3)
    pub identifikationslogik_code: Option<IdentifikationslogikCode>,
    /// Required (X). (an..17)
    pub identifikationslogik_wert: Option<IdentifikationslogikWert>,
    /// 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..35)
    pub vorgang_id: Option<String>,
}

/// Zaehler for PID 44016 — Kündigung beim alten Lieferanten.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Zaehler {
    pub referenz: Option<ZaehlerReferenz>,
}

/// ZaehlerZuordnung for PID 44016 — Kündigung beim alten Lieferanten.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ZaehlerZuordnung {
    pub geraetnummer: Option<ZaehlerZuordnungGeraetnummer>,
    pub merkmal: Option<ZaehlerZuordnungMerkmal>,
    pub volumenerfassung: Option<ZaehlerZuordnungVolumenerfassung>,
}

/// PID 44016 transaction — Kündigung beim alten Lieferanten.
#[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).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub messlokation: Option<Vec<Messlokation>>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub zaehler: Option<Vec<Zaehler>>,
    pub zaehler_zuordnung: Option<ZaehlerZuordnung>,
}

/// PID 44016 message-level — Kündigung beim alten Lieferanten.
#[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 44016 — Kündigung beim alten Lieferanten.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
