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

/// bankQualifier for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum BankQualifier {
    /// Kreditinstitut
    #[serde(rename = "BK")]
    Kreditinstitut,
}

/// namensformatCode for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum NamensformatCode {
    /// Struktur der Firmenbezeichnung
    #[serde(rename = "Z02")]
    StrukturFirmenbezeichnung,
}

/// qualifier for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum GeschaeftspartnerQualifier {
    /// Messstellenbetreiber
    #[serde(rename = "DEB")]
    Messstellenbetreiber,
    /// Ansprechpartner Übertragungsweg / Datenaustausch
    #[serde(rename = "Z10")]
    AnsprechpartnerUebertragungswegDatenaustausch,
    /// Ansprechpartner Rahmenverträge
    #[serde(rename = "Z11")]
    AnsprechpartnerRahmenvertraege,
    /// Ansprechpartner Kündigungsprozesse
    #[serde(rename = "Z12")]
    AnsprechpartnerKuendigungsprozesse,
    /// Ansprechpartner Wechselprozesse
    #[serde(rename = "Z13")]
    AnsprechpartnerWechselprozesse,
    /// Ansprechpartner Stammdatenprozesse
    #[serde(rename = "Z14")]
    AnsprechpartnerStammdatenprozesse,
    /// Ansprechpartner Abrechnungsprozesse
    #[serde(rename = "Z17")]
    AnsprechpartnerAbrechnungsprozesse,
    /// Ansprechpartner Bewegungsdaten
    #[serde(rename = "Z19")]
    AnsprechpartnerBewegungsdaten,
    /// Ansprechpartner Sperr-/Entsperrprozesse
    #[serde(rename = "Z20")]
    AnsprechpartnerSperrEntsperrprozesse,
    /// Ansprechpartner technischer Netzanschluss für Neuanlagen und Anlagenumbau
    #[serde(rename = "Z33")]
    AnsprechpartnerTechnischerNetzanschlussNeuanlagenAnlagenumbau,
}

/// registerQualifier for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum RegisterQualifier {
    /// Internetseite
    #[serde(rename = "Z13")]
    Internetseite,
    /// Gericht und Handelsregister-Nummer
    #[serde(rename = "Z15")]
    GerichtHandelsregisterNummer,
}

/// websiteQualifier for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WebsiteQualifier {
    /// Internetseite
    #[serde(rename = "Z13")]
    Internetseite,
    /// Gericht und Handelsregister-Nummer
    #[serde(rename = "Z15")]
    GerichtHandelsregisterNummer,
}

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

/// dokumentVersionsnummer for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DokumentVersionsnummer {
    /// Dokument nicht verfügbar
    #[serde(rename = "11")]
    DokumentNichtVerfuegbar,
}

/// unsKennung for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum UnsKennung {
    /// Trennung von Kopf- und Positionsteil
    #[serde(rename = "D")]
    TrennungKopfPositionsteil,
}

/// kontakt.funktion_code for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ParteiAnsprechpartnerFunktionCode {
    /// Informationskontakt
    #[serde(rename = "IC")]
    Informationskontakt,
}

/// kommunikationstyp1 for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kommunikationstyp1 {
    /// Elektronische Post
    #[serde(rename = "EM")]
    ElektronischePost,
    /// Telefon
    #[serde(rename = "TE")]
    Telefon,
    /// Telefax
    #[serde(rename = "FX")]
    Telefax,
}

/// kommunikationstyp2 for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kommunikationstyp2 {
    /// Elektronische Post
    #[serde(rename = "EM")]
    ElektronischePost,
    /// Telefon
    #[serde(rename = "TE")]
    Telefon,
    /// Telefax
    #[serde(rename = "FX")]
    Telefax,
}

/// qualifier for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ParteiReferenzQualifier {
    /// Umsatzsteuernummer
    #[serde(rename = "VA")]
    Umsatzsteuernummer,
    /// Steuernummer
    #[serde(rename = "FC")]
    Steuernummer,
    /// Faxnummer
    #[serde(rename = "Z25")]
    Faxnummer,
}

/// datumQualifier for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DatumQualifier {
    /// Gültigkeit, Beginndatum
    #[serde(rename = "157")]
    GueltigkeitBeginndatum,
}

/// qualifier for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ReferenzQualifier {
    /// Prüfidentifikator
    #[serde(rename = "Z13")]
    Pruefidentifikator,
    /// Anwendungsreferenznummer
    #[serde(rename = "AGK")]
    Anwendungsreferenznummer,
    /// Referenznummer einer vorangegangenen Nachricht
    #[serde(rename = "ACW")]
    ReferenznummerVorangegangenenNachricht,
}

/// referenz for PID 37010
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ReferenzReferenz {
    /// Kommunikationsdaten des MSB Gas
    #[serde(rename = "37010")]
    KommunikationsdatenMsbGas,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ParteiAnsprechpartnerKontakt {
    /// Required (X). (an..3)
    pub funktion_code: Option<ParteiAnsprechpartnerFunktionCode>,
    /// Required (X [501]). (an..256)
    pub name: Option<String>,
    /// Required (X). ()
    pub nummer: 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"),
        }
    }
}

/// Erreichbarkeit for PID 37010 — Kommunikationsdaten des MSB Gas.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Erreichbarkeit {
    /// Required (X [503]). (an..35)
    pub dienstag_zeitraum: Option<String>,
    /// Required (X [503]). (an..35)
    pub donnerstag_zeitraum: Option<String>,
    /// Required (X [503]). (an..35)
    pub freitag_zeitraum: Option<String>,
    /// Required (X [503]). (an..35)
    pub mittwoch_zeitraum: Option<String>,
    /// Required (X [503]). (an..35)
    pub montag_zeitraum: Option<String>,
    /// Required (X [503]). (an..35)
    pub samstag_zeitraum: Option<String>,
}

/// Geschaeftspartner for PID 37010 — Kommunikationsdaten des MSB Gas.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Geschaeftspartner {
    /// Required (X). (an..512)
    pub amtsgericht: Option<String>,
    /// Required (unknown). ()
    pub bank_codepflege_code2: Option<String>,
    /// Required (unknown). ()
    pub bank_filiale: Option<String>,
    /// Required (unknown). ()
    pub bank_land: Option<String>,
    /// Required (X). (an..70)
    pub bank_name: Option<String>,
    /// Required (X). (an..3)
    pub bank_qualifier: Option<BankQualifier>,
    /// Required (X). (an..11)
    pub bic: Option<String>,
    /// Optional. (an..512)
    pub handelsregisternummer: Option<String>,
    /// Required (X). (an..35)
    pub iban: Option<String>,
    /// Required (unknown). ()
    pub identifikation: Option<String>,
    /// Required (X). (an..35)
    pub kontoinhaber: Option<String>,
    /// Required (K). (an..35)
    pub kontoinhaber2: Option<String>,
    /// Required (X [506]). (an..3)
    pub land: Option<String>,
    /// Required (X [506]). (an..70)
    pub nachname: Option<String>,
    /// Optional. (an..70)
    pub nachname2: Option<String>,
    /// Optional. (an..70)
    pub nachname3: Option<String>,
    /// Optional. (an..70)
    pub nachname4: Option<String>,
    /// Required (unknown). ()
    pub nachname5: Option<String>,
    /// Required (X). (an..3)
    pub namensformat_code: Option<NamensformatCode>,
    /// Required (X [506]). (an..35)
    pub ort: Option<String>,
    /// Required (M [2] ∧ [506] S [3] ∧ [506]). (an..17)
    pub postleitzahl: Option<String>,
    /// Required (X). (an..3)
    pub qualifier: Option<GeschaeftspartnerQualifier>,
    /// Required (unknown). ()
    pub region: Option<String>,
    /// Required (unknown). ()
    pub register_code: Option<String>,
    /// Optional. (an..512)
    pub register_freitext3: Option<String>,
    /// Optional. (an..512)
    pub register_freitext4: Option<String>,
    /// Optional. (an..512)
    pub register_freitext5: Option<String>,
    /// Required (unknown). ()
    pub register_funktion: Option<String>,
    /// Required (X). (an..3)
    pub register_qualifier: Option<RegisterQualifier>,
    /// Required (X [506]). (an..256)
    pub strasse: Option<String>,
    /// Optional. (an..256)
    pub strasse2: Option<String>,
    /// Optional. (an..256)
    pub strasse3: Option<String>,
    /// Optional. (an..256)
    pub strasse4: Option<String>,
    /// Required (X). (an..512)
    pub website: Option<String>,
    /// Required (unknown). ()
    pub website_code: Option<String>,
    /// Optional. (an..512)
    pub website_freitext2: Option<String>,
    /// Optional. (an..512)
    pub website_freitext3: Option<String>,
    /// Optional. (an..512)
    pub website_freitext4: Option<String>,
    /// Optional. (an..512)
    pub website_freitext5: Option<String>,
    /// Required (unknown). ()
    pub website_funktion: Option<String>,
    /// Required (X). (an..3)
    pub website_qualifier: Option<WebsiteQualifier>,
    /// Required (unknown). ()
    pub zusatzinfo: Option<String>,
}

/// Marktteilnehmer for PID 37010 — Kommunikationsdaten des MSB Gas.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktteilnehmer {
    /// Required (X). (an..3)
    pub marktrolle: Option<Marktrolle>,
    /// Required (X [41]). (an..35)
    pub rollencodenummer: Option<String>,
    /// Required (X). (an..3)
    pub rollencodetyp: Option<Rollencodetyp>,
}

/// Nachricht for PID 37010 — Kommunikationsdaten des MSB Gas.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Required (Muss). ()
    pub antworttyp: Option<String>,
    /// Required (S [9]). (an..3)
    pub dokument_versionsnummer: Option<DokumentVersionsnummer>,
    /// Required (X). (an..70)
    pub dokumentennummer: Option<String>,
    /// Required (X [931][494]). (an..35)
    pub erstellungsdatum: Option<String>,
    /// Required (Muss). ()
    pub nachrichtenfunktion: Option<String>,
    /// Required (X). (a1)
    pub uns_kennung: Option<UnsKennung>,
}

/// ParteiAnsprechpartner for PID 37010 — Kommunikationsdaten des MSB Gas.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ParteiAnsprechpartner {
    /// Required (X (([939][6]) ⊻ ([940][8])) ∧ [502]). (an..512)
    pub kommunikationsadresse1: Option<String>,
    /// Required (X (([939][6]) ⊻ ([940][8])) ∧ [502]). (an..512)
    pub kommunikationsadresse2: Option<String>,
    /// Required (X [1P1..1]). (an..3)
    pub kommunikationstyp1: Option<Kommunikationstyp1>,
    /// Required (X [1P1..1]). (an..3)
    pub kommunikationstyp2: Option<Kommunikationstyp2>,
    pub kontakt: Option<ParteiAnsprechpartnerKontakt>,
}

/// ParteiReferenz for PID 37010 — Kommunikationsdaten des MSB Gas.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ParteiReferenz {
    /// Required (X [2P0..1] ⊻ [3P1..1]). (an..3)
    pub qualifier: Option<ParteiReferenzQualifier>,
    /// Required (X). (an..70)
    pub referenz: Option<String>,
}

/// Referenz for PID 37010 — Kommunikationsdaten des MSB Gas.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Referenz {
    /// Required (X). (an..3)
    pub datum_qualifier: Option<DatumQualifier>,
    /// Required (X [UB1]). (an..35)
    pub datum_wert: Option<String>,
    /// Required (X). (an..3)
    pub qualifier: Option<ReferenzQualifier>,
    /// Required (X). (an..70)
    pub referenz: Option<ReferenzReferenz>,
    /// Required (unknown). ()
    pub versionsnummer: Option<String>,
    /// Required (unknown). ()
    pub zeilennummer: Option<String>,
}

/// PID 37010 transaction — Kommunikationsdaten des MSB Gas.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (X).
    pub erreichbarkeit: Option<Erreichbarkeit>,
    pub geschaeftspartner: Option<Geschaeftspartner>,
    /// Required (X).
    pub partei_ansprechpartner: Option<ParteiAnsprechpartner>,
    /// Required (Muss [504] ∧ [509]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub partei_referenz: Option<Vec<ParteiReferenz>>,
}

/// PID 37010 message-level — Kommunikationsdaten des MSB Gas.
#[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>,
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub referenz: Option<Vec<Referenz>>,
}

/// Complete interchange for PID 37010 — Kommunikationsdaten des MSB Gas.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
