// 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 44140
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Partnerrolle {
    /// Location manager
    #[serde(rename = "DDO")]
    Hausverwalter,
}

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

/// gmsb.qualifier for PID 44140
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MesslokationZuordnungQualifier {
    /// MSB
    #[serde(rename = "Z91")]
    Msb,
    /// gMSB
    #[serde(rename = "ZF0")]
    Gmsb,
    /// H-Gas
    #[serde(rename = "Y04")]
    HGas,
    /// L-Gas
    #[serde(rename = "Y05")]
    LGas,
}

/// marktpartner.zuordnung for PID 44140
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MesslokationZuordnungZuordnung {
    /// Auf vertraglicher Grundlage gegenüber Anschlussnutzer / Anschlussnehmer
    #[serde(rename = "Z19")]
    VertraglicherGrundlageGegenueberAnschlussnutzerAnschlussnehmer,
    /// In der Ausübung der Weiterverpflichtung durch den gMSB
    #[serde(rename = "Z20")]
    AusuebungWeiterverpflichtungDurchGmsb,
}

/// merkmal.code for PID 44140
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MesslokationZuordnungCode {
    /// Zugeordneter Marktpartner
    #[serde(rename = "ZB3")]
    ZugeordneterMarktpartner,
    /// Gasqualität
    #[serde(rename = "Y02")]
    Gasqualitaet,
}

/// referenz.id for PID 44140
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ProzessdatenId {
    /// SDÄ Gas / Nicht bila.rel. Anfrage an NB MSB an NB
    #[serde(rename = "44140")]
    SdaeGasNichtBilaRelAnfrageNbMsbNb,
}

/// pruefidentifikator for PID 44140
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// SDÄ Gas / Nicht bila.rel. Anfrage an NB MSB an NB
    #[serde(rename = "44140")]
    SdaeGasNichtBilaRelAnfrageNbMsbNb,
}

/// transaktionsgrund for PID 44140
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// Nicht bila.rel. Anfrage an NB
    #[serde(rename = "ZF4")]
    NichtBilaRelAnfrageNb,
}

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

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

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

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

/// Map key for Geschaeftspartner instances.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum GeschaeftspartnerKey {
    #[serde(rename = "DDO")]
    Ddo,
    #[serde(rename = "EO")]
    Eo,
    #[serde(rename = "Z25")]
    Z25,
    #[serde(rename = "Z26")]
    Z26,
}

impl std::fmt::Display for GeschaeftspartnerKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Ddo => write!(f, "DDO"),
            Self::Eo => write!(f, "EO"),
            Self::Z25 => write!(f, "Z25"),
            Self::Z26 => write!(f, "Z26"),
        }
    }
}

/// 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 44140 — Nicht bila.rel. Anfrage an NB.
#[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 (Muss). (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 (M [268] S [166]). (an..17)
    pub postleitzahl: Option<String>,
    /// Required (X). ()
    pub region: Option<String>,
    /// Required (X). (an..35)
    pub strasse: Option<String>,
    /// Required (X). (an..35)
    pub strasse_zusatz: Option<String>,
    /// Required (X). ()
    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>,
}

/// Marktteilnehmer for PID 44140 — Nicht bila.rel. Anfrage an NB.
#[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 44140 — Nicht bila.rel. Anfrage an NB.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (X [951]). (an..35)
    pub meldepunkt_id: Option<String>,
    /// Required (X [951]). (an..70)
    pub messlokation_id: Option<String>,
}

/// MesslokationZuordnung for PID 44140 — Nicht bila.rel. Anfrage an NB.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MesslokationZuordnung {
    pub gmsb: Option<MesslokationZuordnungGmsb>,
    pub marktpartner: Option<MesslokationZuordnungMarktpartner>,
    pub merkmal: Option<MesslokationZuordnungMerkmal>,
}

/// Nachricht for PID 44140 — Nicht bila.rel. Anfrage an NB.
#[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 44140 — Nicht bila.rel. Anfrage an NB.
#[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 gueltig_ab: Option<String>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    pub referenz: Option<ProzessdatenReferenz>,
    /// Required (unknown). ()
    pub status_code: Option<String>,
    /// Required (X). (an..3)
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
}

/// PID 44140 transaction — Nicht bila.rel. Anfrage an NB.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// 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 messlokation_zuordnung: Option<MesslokationZuordnung>,
    pub prozessdaten: Option<Prozessdaten>,
}

/// PID 44140 message-level — Nicht bila.rel. Anfrage an NB.
#[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 44140 — Nicht bila.rel. Anfrage an NB.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
