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

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

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

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

/// marktrolle for PID 44016
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Marktrolle {
    /// Dokumenten-/Nachrichtenaussteller bzw. -absender
    #[serde(rename = "MS")]
    Nachrichtenaussteller,
    /// 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")]
    Dvgw,
}

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

/// 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 KontaktKontakt {
    /// Required (X). ()
    pub name: Option<String>,
}

#[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 {
    /// Optional. ()
    pub codeliste_code: Option<String>,
    /// Optional. ()
    pub codepflege: Option<String>,
    /// Required (X). ()
    pub nummer: Option<String>,
    /// Required (X). ()
    pub qualifier: Option<ZaehlerZuordnungQualifier>,
    /// Optional. ()
    pub teil2: Option<String>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZaehlerZuordnungVolumenerfassung {
    /// Optional. ()
    pub codeliste_code: Option<String>,
    /// Optional. ()
    pub codepflege: Option<String>,
    /// Required (X). ()
    pub qualifier: Option<ZaehlerZuordnungQualifier>,
    /// Required (X). ()
    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). ()
    pub text: Option<String>,
    /// Optional. ()
    pub text_referenz: Option<String>,
    /// Optional. ()
    pub text_zeile2: Option<String>,
    /// Optional. ()
    pub text_zeile3: Option<String>,
    /// Optional. ()
    pub text_zeile4: Option<String>,
    /// Optional. ()
    pub text_zeile5: Option<String>,
    /// Required (X). ()
    pub textbezug: Option<Textbezug>,
    /// Optional. ()
    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). ()
    pub adresszusatz: Option<String>,
    /// Required (X). ()
    pub geschaeftspartner_id: Option<String>,
    /// Required (X). ()
    pub hausnummer: Option<String>,
    /// Required (X). ()
    pub land: Option<String>,
    /// Required (X). ()
    pub name1: Option<String>,
    /// Required (X). ()
    pub name2: Option<String>,
    /// Required (X). ()
    pub namenszusatz1: Option<String>,
    /// Required (X). ()
    pub ort: Option<String>,
    /// Required (X). ()
    pub partnerrolle: Option<Partnerrolle>,
    /// Required (X). ()
    pub postleitzahl: Option<String>,
    /// Required (X). ()
    pub region: Option<String>,
    /// Required (S [165] M [212]). ()
    pub strasse: Option<String>,
    /// Required (X). ()
    pub strasse_zusatz: Option<String>,
    /// Required (K). ()
    pub zusatzinfo: Option<String>,
    /// Required (X). ()
    pub zusatzinfo_zeile2: Option<String>,
    /// Required (X). ()
    pub zusatzinfo_zeile3: Option<String>,
    /// Required (X). ()
    pub zusatzinfo_zeile4: Option<String>,
    /// Required (X). ()
    pub zusatzinfo_zeile5: Option<String>,
}

/// Kontakt for PID 44016 — Kündigung beim alten Lieferanten.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Kontakt {
    /// Required (X [1P0..1]). ()
    pub kommunikationsart: Option<Kommunikationsart>,
    /// Required (X). ()
    pub kommunikationsnummer: Option<String>,
    pub kontakt: Option<KontaktKontakt>,
    /// Required (X). ()
    pub kontaktfunktion: Option<Kontaktfunktion>,
}

/// Marktteilnehmer for PID 44016 — Kündigung beim alten Lieferanten.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktteilnehmer {
    /// Optional. ()
    pub codeliste_code: Option<String>,
    /// Required (X). ()
    pub marktrolle: Option<Marktrolle>,
    /// Required (X). ()
    pub rollencodenummer: Option<String>,
    /// Required (X). ()
    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]). ()
    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. ()
    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]). ()
    pub ende_zum: Option<String>,
    /// Required (X [UB2]). ()
    pub gueltig_bis: Option<String>,
    /// Optional. ()
    pub identifikationsformat: Option<String>,
    /// Required (X). ()
    pub identifikationslogik_code: Option<IdentifikationslogikCode>,
    /// Required (X). ()
    pub identifikationslogik_wert: Option<IdentifikationslogikWert>,
    /// Required (X). ()
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Optional. ()
    pub status_code: Option<String>,
    /// Required (X). ()
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Required (X). ()
    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).
    pub messlokation: Option<Messlokation>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (X).
    pub zaehler: Option<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 {
    pub kontakt: Option<Kontakt>,
    #[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>;
