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

/// anredeCode for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AnredeCode {
    /// Struktur von Personennamen
    #[serde(rename = "Z01")]
    StrukturPersonennamen,
    /// Struktur der Firmenbezeichnung
    #[serde(rename = "Z02")]
    StrukturFirmenbezeichnung,
}

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

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

/// mengenQualifier for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MengenQualifier {
    /// Veranschlagte Jahresmenge Gesamt/Jahresverbrauchsprognose für spezifische Arb...
    #[serde(rename = "265")]
    VeranschlagteJahresmengeGesamtJahresverbrauchsprognoseSpezifischeArbeit,
    /// Angepasste elektrische Arbeit nach Anhang D der VDN-Richtlinie "Lastprofile f...
    #[serde(rename = "Z08")]
    AngepassteElektrischeArbeitAnhangDVdnRichtlinieLastprofileUnterbrechbare,
    /// Veranschlagte Jahresmenge Gesamt
    #[serde(rename = "31")]
    VeranschlagteJahresmengeGesamt,
}

/// mengeneinheit for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MarktlokationMengenMengeneinheit {
    /// kWh/K (Kilowatt-Stunde/Kelvin)
    #[serde(rename = "Z16")]
    KwhKKilowattStundeKelvin,
    /// Kilowattstunde
    #[serde(rename = "KWH")]
    Kilowattstunde,
}

/// marktrolle for PID 55168
#[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 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Rollencodetyp {
    /// GS1
    #[serde(rename = "9")]
    Gs1,
    /// DE, BDEW (Bundesverband der Energie- und Wasserwirtschaft e.V.)
    #[serde(rename = "293")]
    DeBdewBundesverbandEnergieWasserwirtschaftEV,
}

/// mengeneinheit for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MesslokationMengeneinheit {
    /// Prozent
    #[serde(rename = "P1")]
    Prozent,
}

/// referenz.typ for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MesslokationDatenTyp {
    /// Messlokation
    #[serde(rename = "Z19")]
    Messlokation,
    /// zugeordnete Marktlokation
    #[serde(rename = "Z16")]
    ZugeordneteMarktlokation,
}

/// produktIdentifikation.funktion for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ProduktpaketDatenFunktion {
    /// Produktidentifikation
    #[serde(rename = "5")]
    Produktidentifikation,
}

/// produktIdentifikation.typ for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ProduktpaketDatenTyp {
    /// Produkt
    #[serde(rename = "Z11")]
    Produkt,
}

/// referenz.typ for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ProfilDatenTyp {
    /// Marktlokation
    #[serde(rename = "Z18")]
    Marktlokation,
}

/// ideQualifier for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum IdeQualifier {
    /// Transaktion
    #[serde(rename = "24")]
    Transaktion,
}

/// pruefidentifikator for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// WiM Strom / Verpflichtungsanfrage / Aufforderung
    #[serde(rename = "55168")]
    WimStromVerpflichtungsanfrageAufforderung,
}

/// referenz for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Referenz {
    /// WiM Strom / Verpflichtungsanfrage / Aufforderung
    #[serde(rename = "55168")]
    WimStromVerpflichtungsanfrageAufforderung,
}

/// transaktionsgrund for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// Kunde verlässt oder bezieht eine schon bestehende Marktlokation
    #[serde(rename = "E01")]
    KundeVerlaesstBestehendeMarktlokation,
    /// Kunde bezieht erstmals eine Marktlokation (z. B. Neubau)
    #[serde(rename = "E02")]
    KundeBeziehtErstmalsMarktlokationZBNeubau,
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
}

/// transaktionsgrundDetail for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TransaktionsgrundDetail {
    /// Der LFN wird einer Marktlokation vollständig zugeordnet (vollständige (100%ig...
    #[serde(rename = "ZW0")]
    LfnMarktlokationVollstaendigZugeordnetVollstaendige100IgeZuordnungDieser,
    /// Der LFN wird einer bestehenden Tranche vollständig zugeordnet (vollständige (...
    #[serde(rename = "ZW1")]
    LfnBestehendenTrancheVollstaendigZugeordnetVollstaendige100IgeZuordnung,
    /// Der LFN wird einer neu zu bildenden Tranche zugeordnet (anteiliger Zuordnungs...
    #[serde(rename = "ZW2")]
    LfnNeuBildendenTrancheZugeordnetAnteiligerZuordnungsvorgangBildungNeuer,
    /// Erzeugende Marktlokation
    #[serde(rename = "ZW3")]
    ErzeugendeMarktlokation,
    /// Verbrauchende Marktlokation
    #[serde(rename = "ZW4")]
    VerbrauchendeMarktlokation,
    /// Tranche
    #[serde(rename = "ZW5")]
    Tranche,
    /// Pauschale Marktlokation
    #[serde(rename = "ZW6")]
    PauschaleMarktlokation,
    /// Gemessene Marktlokation
    #[serde(rename = "ZW7")]
    GemesseneMarktlokation,
    /// Fall 1
    #[serde(rename = "ZW8")]
    Fall1,
    /// Fall 2
    #[serde(rename = "ZW9")]
    Fall2,
    /// Fall 3
    #[serde(rename = "ZX0")]
    Fall3,
    /// Fall 4
    #[serde(rename = "ZX1")]
    Fall4,
    /// ruhende Marktlokation
    #[serde(rename = "ZAP")]
    RuhendeMarktlokation,
    /// Die Stilllegung der MeLo hat auch die Stilllegung einer MaLo zur Folge (Diese...
    #[serde(rename = "ZZB")]
    StilllegungMeloStilllegungMaloFolgeDieserCodeErst142026GueltigDavor,
    /// Die Stilllegung der MeLo hat keine Stilllegung einer MaLo zur Folge (Dieser C...
    #[serde(rename = "ZZC")]
    StilllegungMeloKeineStilllegungMaloFolgeDieserCodeErst142026Gueltig,
}

/// transaktionsgrundErgaenzung for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TransaktionsgrundErgaenzung {
    /// Kunde verlässt eine schon bestehende Marktlokation
    #[serde(rename = "E01")]
    KundeVerlaesstBestehendeMarktlokation,
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
}

/// produktIdentifikation.funktion for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SteuerbareRessourceDatenFunktion {
    /// Produktidentifikation
    #[serde(rename = "5")]
    Produktidentifikation,
}

/// produktIdentifikation.typ for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SteuerbareRessourceDatenTyp {
    /// Konfigurationsprodukt
    #[serde(rename = "Z12")]
    Konfigurationsprodukt,
}

/// referenz.typ for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZaehlerDatenTyp {
    /// Messlokation
    #[serde(rename = "Z19")]
    Messlokation,
    /// Smartmeter-Gateway
    #[serde(rename = "Z14")]
    SmartmeterGateway,
}

/// merkmal.code for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungCode {
    /// Marktlokation liefert Energie ins Netz. --> Erzeugende Marktlokation
    #[serde(rename = "Z06")]
    MarktlokationLiefertEnergieInsNetzErzeugendeMarktlokation,
    /// Marktlokation entnimmt Energie aus dem Netz. --> Verbrauchende Marktlokation
    #[serde(rename = "Z07")]
    MarktlokationEntnimmtEnergieNetzVerbrauchendeMarktlokation,
    /// Zugeordneter Marktpartner
    #[serde(rename = "ZB3")]
    ZugeordneterMarktpartner,
    /// Spannungsebene der Marktlokation
    #[serde(rename = "E03")]
    SpannungsebeneMarktlokation,
    /// Messtechnische Einordnung der Marktlokation
    #[serde(rename = "Z83")]
    MesstechnischeEinordnungMarktlokation,
    /// NB
    #[serde(rename = "ZA8")]
    Nb,
    /// ÜNB
    #[serde(rename = "ZA9")]
    Uenb,
    /// Prognose auf Basis von Werten
    #[serde(rename = "ZC0")]
    PrognoseBasisWerten,
    /// Prognose auf Basis von Profilen
    #[serde(rename = "ZA6")]
    PrognoseBasisProfilen,
    /// Art der erzeugenden Marktlokation
    #[serde(rename = "Z34")]
    ArtErzeugendenMarktlokation,
    /// Modell 1 "Bilanzierung an der Marktlokation"
    #[serde(rename = "ZE9")]
    Modell1BilanzierungMarktlokation,
    /// Modell 2 "Bilanzierung im Bilanzierungsgebiet (BG) des LPB"
    #[serde(rename = "ZF0")]
    Modell2BilanzierungBilanzierungsgebietBgLpb,
}

/// merkmal.klasse for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungKlasse {
    /// Lieferrichtung
    #[serde(rename = "Z30")]
    Lieferrichtung,
    /// Verantwortlicher
    #[serde(rename = "6")]
    Verantwortlicher,
    /// Abwicklungsmodell
    #[serde(rename = "ZA2")]
    Abwicklungsmodell,
}

/// merkmal.qualifier for PID 55168
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungQualifier {
    /// LF
    #[serde(rename = "Z89")]
    Lf,
    /// ÜNB
    #[serde(rename = "Z90")]
    Uenb,
    /// MSB
    #[serde(rename = "Z91")]
    Msb,
    /// Höchstspannung
    #[serde(rename = "E03")]
    Hoechstspannung,
    /// Hochspannung
    #[serde(rename = "E04")]
    Hochspannung,
    /// Mittelspannung
    #[serde(rename = "E05")]
    Mittelspannung,
    /// Niederspannung
    #[serde(rename = "E06")]
    Niederspannung,
    /// Anzuwenden wenn alle Messlokationen, die zur Erfassung der Energiewerte der M...
    #[serde(rename = "Z52")]
    AnzuwendenAlleMesslokationenErfassungEnergiewerteMarktlokationErforderlich,
    /// Anzuwenden wenn noch mindestens eine Messlokation, die zur Erfassung der Ener...
    #[serde(rename = "Z53")]
    AnzuwendenMindestensMesslokationErfassungEnergiewerteMarktlokationKmeMme,
    /// SLP/SEP
    #[serde(rename = "E02")]
    SlpSep,
    /// TLP/TEP
    #[serde(rename = "E14")]
    TlpTep,
    /// TEP mit Referenzmessung
    #[serde(rename = "Z36")]
    TepReferenzmessung,
    /// EEG-Marktlokation ohne DV-Pflicht
    #[serde(rename = "Z33")]
    EegMarktlokationOhneDvPflicht,
    /// KWKG-Marktlokation ohne DV-Pflicht
    #[serde(rename = "Z34")]
    KwkgMarktlokationOhneDvPflicht,
    /// sonstige Marktlokation
    #[serde(rename = "Z35")]
    SonstigeMarktlokation,
    /// EEG-Marktlokation mit DV-Pflicht
    #[serde(rename = "Z37")]
    EegMarktlokationDvPflicht,
    /// KWKG-Marktlokation mit DV-Pflicht
    #[serde(rename = "Z46")]
    KwkgMarktlokationDvPflicht,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GeschaeftspartnerAdresse {
    /// Optional. (an..35)
    pub hausnummer: Option<String>,
    /// Required (X). (an..3)
    pub landescode: Option<String>,
    /// Required (X). (an..35)
    pub ort: Option<String>,
    /// Required (X). (an..17)
    pub postleitzahl: Option<String>,
    /// Required (S [166] M [212]). (an..35)
    pub strasse: Option<String>,
}

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

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LokationsbuendelDatenZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MarktlokationZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

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

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

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

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MesslokationDatenZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NetzlokationZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ObisKennzahlZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ObisMarktlokationZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ObisZaehleinrichtungZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProduktpaketDatenProduktIdentifikation {
    /// Required (X). (an..3)
    pub funktion: Option<ProduktpaketDatenFunktion>,
    /// Required (X [426]). (an..35)
    pub id: Option<String>,
    /// Required (X). (an..3)
    pub typ: Option<ProduktpaketDatenTyp>,
}

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

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

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProfilDatenZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReferenzprofilZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SteuerbareRessourceDatenProduktIdentifikation {
    /// Required (X). (an..3)
    pub funktion: Option<SteuerbareRessourceDatenFunktion>,
    /// Required (X). (an..35)
    pub id: Option<String>,
    /// Required (X). (an..3)
    pub typ: Option<SteuerbareRessourceDatenTyp>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SteuerbareRessourceDatenZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TechnischeRessourceZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZaehlerDatenZeitscheibe {
    /// Optional. (an..10)
    pub referenz: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZuordnungMerkmal {
    /// Required (X). (an..17)
    pub code: Option<ZuordnungCode>,
    /// Required (unknown). ()
    pub code_codepflege: Option<String>,
    /// Required (unknown). ()
    pub codeliste: Option<String>,
    /// Required (unknown). ()
    pub codepflege: Option<String>,
    /// Required (unknown). ()
    pub dimension: Option<String>,
    /// Required (unknown). ()
    pub eigenschaft: Option<String>,
    /// Required (unknown). ()
    pub eigenschaft_2: Option<String>,
    /// Required (X). (an..3)
    pub klasse: Option<ZuordnungKlasse>,
    /// Required (X). (an..3)
    pub qualifier: Option<ZuordnungQualifier>,
}

/// Map key for Geschaeftspartner instances.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum GeschaeftspartnerKey {
    #[serde(rename = "Z03")]
    Z03,
    #[serde(rename = "Z04")]
    Z04,
    #[serde(rename = "Z05")]
    Z05,
    #[serde(rename = "Z07")]
    Z07,
    #[serde(rename = "Z08")]
    Z08,
    #[serde(rename = "Z09")]
    Z09,
    #[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::Z03 => write!(f, "Z03"),
            Self::Z04 => write!(f, "Z04"),
            Self::Z05 => write!(f, "Z05"),
            Self::Z07 => write!(f, "Z07"),
            Self::Z08 => write!(f, "Z08"),
            Self::Z09 => write!(f, "Z09"),
            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 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Geschaeftspartner {
    pub adresse: Option<GeschaeftspartnerAdresse>,
    /// Optional. (an..70)
    pub anrede: Option<String>,
    /// Required (X). (an..3)
    pub anrede_code: Option<AnredeCode>,
    /// Required (Muss [586]). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [586]). ()
    pub codepflege_code: Option<String>,
    /// Required (Muss [586]). ()
    pub geschaeftspartner_id: Option<String>,
    /// Required (X). (an..70)
    pub name1: Option<String>,
    /// Optional. (an..70)
    pub name2: Option<String>,
    /// Optional. (an..70)
    pub name_zeile3_feld: Option<String>,
    /// Optional. (an..70)
    pub name_zeile4_feld: Option<String>,
    /// Required (X). (an..3)
    pub partnerrolle: Option<Partnerrolle>,
    /// Required (X [951]). (an..70)
    pub referenz: Option<String>,
    /// Required (Muss [586]). ()
    pub region: Option<String>,
    /// Optional. (an..35)
    pub strasse_zeile2: Option<String>,
    /// Optional. (an..35)
    pub strasse_zeile4: Option<String>,
    pub zeitscheibe: Option<GeschaeftspartnerZeitscheibe>,
    /// Required (K). (an..35)
    pub zusatzinfo: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo2: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo3: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo4: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo5: Option<String>,
}

/// Kontakt for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[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 (([939] [321]) ∨ ([940] [322])) ∧ [514]). (an..512)
    pub kommunikationsnummer: Option<String>,
    pub kontakt: Option<KontaktKontakt>,
    /// Required (X). (an..3)
    pub kontaktfunktion: Option<Kontaktfunktion>,
}

/// LokationsbuendelDaten for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct LokationsbuendelDaten {
    /// Required (X ([451] ∧ [950]) ⊻ ([452] ∧ [951]) ⊻ ([450] ∧ [960]) ⊻ ([456] ∧ [922])). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<LokationsbuendelDatenZeitscheibe>,
}

/// Marktlokation for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktlokation {
    /// Required (Muss [671]). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [671]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub marktlokations_id: Option<String>,
    /// Required (X [950]). (an..70)
    pub referenz: Option<String>,
    /// Required (X [950]). (an..35)
    pub ruhende_marktlokations_id: Option<String>,
    pub zeitscheibe: Option<MarktlokationZeitscheibe>,
}

/// MarktlokationMengen for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MarktlokationMengen {
    /// Required (X [902]). (an..35)
    pub menge: Option<String>,
    /// Required (X). (an..3)
    pub mengen_qualifier: Option<MengenQualifier>,
    /// Required (X [103]). (an..8)
    pub mengeneinheit: Option<MarktlokationMengenMengeneinheit>,
}

/// Marktteilnehmer for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[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>,
}

/// MengenDaten for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MengenDaten {
    pub produkt_identifikation: Option<MengenDatenProduktIdentifikation>,
    /// Required (X [950]). (an..70)
    pub referenz: Option<String>,
}

/// MengenDatenErw for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MengenDatenErw {
    pub produkt_identifikation: Option<MengenDatenErwProduktIdentifikation>,
    /// Required (X [951]). (an..70)
    pub referenz: Option<String>,
}

/// Messlokation for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (Muss [675]). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [675]). ()
    pub codepflege_code: Option<String>,
    /// Required (X [914] ∧ [930] ∧ [955]). (an..35)
    pub jahresverbrauchsprognose: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X). (an..8)
    pub mengeneinheit: Option<MesslokationMengeneinheit>,
    /// Required (X [951]). (an..35)
    pub messlokations_id: Option<String>,
}

/// MesslokationDaten for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MesslokationDaten {
    pub produkt_identifikation: Option<MesslokationDatenProduktIdentifikation>,
    pub referenz: Option<MesslokationDatenReferenz>,
    pub zeitscheibe: Option<MesslokationDatenZeitscheibe>,
}

/// Nachricht for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Required (X [931] [494]). (an..35)
    pub erstellungsdatum: Option<String>,
    /// Optional. ()
    pub nachrichtennummer: Option<String>,
    /// Optional. ()
    pub nachrichtentyp: Option<String>,
}

/// Netzlokation for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Netzlokation {
    /// Required (Soll [46] ∧ [670]). ()
    pub codeliste_code: Option<String>,
    /// Required (Soll [46] ∧ [670]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [960]). (an..35)
    pub netzlokations_id: Option<String>,
    /// Required (X [960]). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<NetzlokationZeitscheibe>,
}

/// ObisKennzahl for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ObisKennzahl {
    pub produkt_identifikation: Option<ObisKennzahlProduktIdentifikation>,
    /// Required (X [960]). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<ObisKennzahlZeitscheibe>,
}

/// ObisMarktlokation for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ObisMarktlokation {
    pub produkt_identifikation: Option<ObisMarktlokationProduktIdentifikation>,
    /// Required (X [950]). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<ObisMarktlokationZeitscheibe>,
}

/// ObisZaehleinrichtung for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ObisZaehleinrichtung {
    pub produkt_identifikation: Option<ObisZaehleinrichtungProduktIdentifikation>,
    /// Required (X). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<ObisZaehleinrichtungZeitscheibe>,
}

/// ProduktpaketDaten for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ProduktpaketDaten {
    pub produkt_identifikation: Option<ProduktpaketDatenProduktIdentifikation>,
    pub referenz: Option<ProduktpaketDatenReferenz>,
    pub zeitscheibe: Option<ProduktpaketDatenZeitscheibe>,
}

/// ProfilDaten for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ProfilDaten {
    pub referenz: Option<ProfilDatenReferenz>,
    pub zeitscheibe: Option<ProfilDatenZeitscheibe>,
}

/// Prozessdaten for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (unknown). ()
    pub bearbeitungsstand: Option<String>,
    /// Required (X). (an..35)
    pub datum_z50: Option<String>,
    /// Required (X [UB1]). (an..35)
    pub geplanter_lieferbeginn: Option<String>,
    /// Required (X). (an..3)
    pub ide_qualifier: Option<IdeQualifier>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..70)
    pub referenz: Option<Referenz>,
    /// Required (X). (an..3)
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Optional. (an..3)
    pub transaktionsgrund_detail: Option<TransaktionsgrundDetail>,
    /// Optional. (an..3)
    pub transaktionsgrund_ergaenzung: Option<TransaktionsgrundErgaenzung>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
}

/// Referenzprofil for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Referenzprofil {
    /// Required (X [950]). (an..70)
    pub referenz: Option<String>,
    pub zeitscheibe: Option<ReferenzprofilZeitscheibe>,
}

/// SteuerbareRessource for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct SteuerbareRessource {
    /// Required (Soll [46] ∧ [673]). ()
    pub codeliste_code: Option<String>,
    /// Required (Soll [46] ∧ [673]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [961]). (an..35)
    pub steuerbare_ressource_id: Option<String>,
}

/// SteuerbareRessourceDaten for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct SteuerbareRessourceDaten {
    pub produkt_identifikation: Option<SteuerbareRessourceDatenProduktIdentifikation>,
    pub referenz: Option<SteuerbareRessourceDatenReferenz>,
    pub zeitscheibe: Option<SteuerbareRessourceDatenZeitscheibe>,
}

/// TechnischeRessource for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct TechnischeRessource {
    /// Required (Soll [46] ∧ [672] ∧ [694] ∧ [698]). ()
    pub codeliste_code: Option<String>,
    /// Required (Soll [46] ∧ [672] ∧ [694] ∧ [698]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [922]). (an..70)
    pub referenz: Option<String>,
    /// Required (X [922]). (an..35)
    pub technische_ressource_id: Option<String>,
    pub zeitscheibe: Option<TechnischeRessourceZeitscheibe>,
}

/// Tranche for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Tranche {
    /// Required (Soll [166] ∧ [674]). ()
    pub codeliste_code: Option<String>,
    /// Required (Soll [166] ∧ [674]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub tranche_id: Option<String>,
}

/// ZaehlerDaten for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ZaehlerDaten {
    pub referenz: Option<ZaehlerDatenReferenz>,
    pub zeitscheibe: Option<ZaehlerDatenZeitscheibe>,
}

/// Zuordnung for PID 55168 — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Zuordnung {
    pub merkmal: Option<ZuordnungMerkmal>,
    /// Required (X [611]). (an..17)
    pub zugeordneter_mp: Option<String>,
}

/// PID 55168 transaction — Verpflicht-ungsanfrage / Aufforderung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (Muss [586]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_map_or_vec")]
    pub geschaeftspartner: Option<BTreeMap<GeschaeftspartnerKey, Geschaeftspartner>>,
    /// Required (Muss (([293] ∧ [2360] ∧ [2361]) ⊻ ([309] ∧ [2359] ∧ [2360])) ∧ [350]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub lokationsbuendel_daten: Option<Vec<LokationsbuendelDaten>>,
    /// Required (Muss [671]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub marktlokation: Option<Vec<Marktlokation>>,
    pub marktlokation_mengen: Option<MarktlokationMengen>,
    /// Required (Muss [2261]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub mengen_daten: Option<Vec<MengenDaten>>,
    /// Required (Muss [2309]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub mengen_daten_erw: Option<Vec<MengenDatenErw>>,
    /// Required (Muss [675]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub messlokation: Option<Vec<Messlokation>>,
    /// Required (Muss [2284]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub messlokation_daten: Option<Vec<MesslokationDaten>>,
    /// Required (Soll [46] ∧ [670]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub netzlokation: Option<Vec<Netzlokation>>,
    /// Required (Soll [166] ∧ [294]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub obis_kennzahl: Option<Vec<ObisKennzahl>>,
    /// Required (Muss [2308] ∧ [404]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub obis_marktlokation: Option<Vec<ObisMarktlokation>>,
    /// Required (Muss ([2287] ∧ [121]) ∨ [2350]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub obis_zaehleinrichtung: Option<Vec<ObisZaehleinrichtung>>,
    /// Required (Muss [2261]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub produktpaket_daten: Option<Vec<ProduktpaketDaten>>,
    /// Required (Muss [117] ∧ [2308]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub profil_daten: Option<Vec<ProfilDaten>>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (Muss [223] ∧ [265]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub referenzprofil: Option<Vec<Referenzprofil>>,
    /// Required (Soll [46] ∧ [673]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub steuerbare_ressource: Option<Vec<SteuerbareRessource>>,
    /// Required (Muss [205] ∧ [530]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub steuerbare_ressource_daten: Option<Vec<SteuerbareRessourceDaten>>,
    /// Required (Soll [46] ∧ [672] ∧ [694] ∧ [698]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub technische_ressource: Option<Vec<TechnischeRessource>>,
    /// Required (Soll [166] ∧ [674]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub tranche: Option<Vec<Tranche>>,
    /// Required (Muss [78]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub zaehler_daten: Option<Vec<ZaehlerDaten>>,
    pub zuordnung: Option<Zuordnung>,
}

/// PID 55168 message-level — Verpflicht-ungsanfrage / Aufforderung.
#[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 55168 — Verpflicht-ungsanfrage / Aufforderung.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
