// 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 55600
#[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 55600
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Partnerrolle {
    /// Korrespondenzanschrift des Kunden des LF
    #[serde(rename = "Z04")]
    KorrespondenzanschriftKundenLf,
}

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

/// merkmal.code for PID 55600
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MarktlokationCode {
    /// Haushaltskunde gem. EnWG
    #[serde(rename = "Z15")]
    HaushaltskundeEnwg,
    /// Kein Haushaltskunde gem. EnWG
    #[serde(rename = "Z18")]
    KeinHaushaltskundeEnwg,
}

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

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

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

/// produkteigenschaft.klasse for PID 55600
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ProduktpaketDatenKlasse {
    /// Produkteigenschaft
    #[serde(rename = "Z66")]
    Produkteigenschaft,
}

/// umsetzungsgrad.prioritaet for PID 55600
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ProduktpaketDatenPrioritaet {
    /// 1. Priorität
    #[serde(rename = "Z75")]
    Code1Prioritaet,
    /// 2. Priorität
    #[serde(rename = "Z76")]
    Code2Prioritaet,
    /// 3. Priorität
    #[serde(rename = "Z77")]
    Code3Prioritaet,
    /// 4. Priorität
    #[serde(rename = "Z78")]
    Code4Prioritaet,
    /// 5. Priorität
    #[serde(rename = "Z79")]
    Code5Prioritaet,
}

/// umsetzungsgrad.relevanz for PID 55600
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ProduktpaketDatenRelevanz {
    /// Der NB darf den LF der Marktlokation bzw. Tranche nur dann mit diesem Produkt...
    #[serde(rename = "Z01")]
    NbDarfLfMarktlokationTrancheDannDiesemProduktpaketZuordnenAlleProdukte,
    /// Der NB darf den LF der Marktlokation bzw. Tranche dann mit diesem Produktpake...
    #[serde(rename = "Z02")]
    NbDarfLfMarktlokationTrancheDannDiesemProduktpaketZuordnenAlleTeil,
}

/// pruefidentifikator for PID 55600
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// GPKE / Anmeldung neue verbrauchende Marktlokation
    #[serde(rename = "55600")]
    GpkeAnmeldungNeueVerbrauchendeMarktlokation,
}

/// transaktionsgrund for PID 55600
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// Kunde bezieht erstmals eine Marktlokation (z. B. Neubau)
    #[serde(rename = "E02")]
    KundeBeziehtErstmalsMarktlokationZBNeubau,
}

/// transaktionsgrundDetail for PID 55600
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TransaktionsgrundDetail {
    /// Verbrauchende Marktlokation
    #[serde(rename = "ZW4")]
    VerbrauchendeMarktlokation,
}

/// transaktionsgrundErgaenzung for PID 55600
#[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,
}

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

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

#[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 MarktlokationMerkmal {
    /// Required (X). (an..17)
    pub code: Option<MarktlokationCode>,
}

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

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProduktpaketDatenPriorisierung {
    /// Required (X [914] ∧ [937] [41]). (an..10)
    pub produktpaket_ref: 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 [292]). (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 ProduktpaketDatenProdukteigenschaft {
    /// Required (X [38]). (an..35)
    pub code: Option<String>,
    /// Required (X). (an..3)
    pub klasse: Option<ProduktpaketDatenKlasse>,
    /// Required (X [38]). (an..35)
    pub wert: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProduktpaketDatenUmsetzungsgrad {
    /// Required (X). (an..3)
    pub klasse: Option<ProduktpaketDatenKlasse>,
    /// Required (X [10P1..1]). (an..3)
    pub prioritaet: Option<ProduktpaketDatenPrioritaet>,
    /// Required (X [1P0..5]). (an..3)
    pub relevanz: Option<ProduktpaketDatenRelevanz>,
}

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

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

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZaehlerMerkmal {
    /// Required (X). (an..17)
    pub code: Option<ZaehlerCode>,
    /// Required (X). (an..35)
    pub eigenschaft: Option<String>,
    /// Required (X). (an..3)
    pub qualifier: Option<ZaehlerQualifier>,
}

/// Map key for Geschaeftspartner instances.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum GeschaeftspartnerKey {
    #[serde(rename = "Z04")]
    Z04,
    #[serde(rename = "Z09")]
    Z09,
    #[serde(rename = "Z60")]
    Z60,
}

impl std::fmt::Display for GeschaeftspartnerKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Z04 => write!(f, "Z04"),
            Self::Z09 => write!(f, "Z09"),
            Self::Z60 => write!(f, "Z60"),
        }
    }
}

/// 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 55600 — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Geschaeftspartner {
    /// Optional. (an..70)
    pub anrede: Option<String>,
    /// Required (X). (an..3)
    pub anrede_code: Option<AnredeCode>,
    /// Optional. (an..35)
    pub hausnummer: Option<String>,
    /// Required (Muss [556] ∧ [559]). ()
    pub identifikation: Option<String>,
    /// Required (X). (an..3)
    pub land: Option<String>,
    /// Required (X). (an..70)
    pub nachname: Option<String>,
    /// Optional. (an..70)
    pub name_zeile3: Option<String>,
    /// Optional. (an..70)
    pub name_zeile4: 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 (Muss [556] ∧ [559]). ()
    pub region: Option<String>,
    /// Required (X). (an..35)
    pub strasse: Option<String>,
    /// Optional. (an..35)
    pub strasse_zeile4: Option<String>,
    /// Optional. (an..35)
    pub strasse_zusatz: Option<String>,
    /// Optional. (an..70)
    pub vorname: Option<String>,
    /// Required (K). (an..35)
    pub zusatzinfo: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo_zeile2: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo_zeile3: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo_zeile4: Option<String>,
    /// Optional. (an..35)
    pub zusatzinfo_zeile5: Option<String>,
}

/// Kontakt for PID 55600 — Anmeldung neue verb. MaLo.
#[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>,
}

/// Marktlokation for PID 55600 — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktlokation {
    /// Required (X [950]). (an..35)
    pub marktlokations_id: Option<String>,
    pub merkmal: Option<MarktlokationMerkmal>,
    pub zeitscheibe: Option<MarktlokationZeitscheibe>,
}

/// Marktteilnehmer for PID 55600 — Anmeldung neue verb. MaLo.
#[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>,
}

/// Messlokation for PID 55600 — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (X [951]). (an..35)
    pub messlokations_id: Option<String>,
    pub zeitscheibe: Option<MesslokationZeitscheibe>,
}

/// Nachricht for PID 55600 — Anmeldung neue verb. MaLo.
#[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>,
}

/// ProduktpaketDaten for PID 55600 — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ProduktpaketDaten {
    pub priorisierung: Option<ProduktpaketDatenPriorisierung>,
    pub produkt_identifikation: Option<ProduktpaketDatenProduktIdentifikation>,
    pub produkteigenschaft: Option<ProduktpaketDatenProdukteigenschaft>,
    pub umsetzungsgrad: Option<ProduktpaketDatenUmsetzungsgrad>,
    pub zeitscheibe: Option<ProduktpaketDatenZeitscheibe>,
}

/// Prozessdaten for PID 55600 — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (X [UB1]). (an..35)
    pub gueltig_ab: Option<String>,
    /// Required (X [UB1]). (an..35)
    pub gueltig_bis: Option<String>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..3)
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Required (X). (an..3)
    pub transaktionsgrund_detail: Option<TransaktionsgrundDetail>,
    /// Optional. (an..3)
    pub transaktionsgrund_ergaenzung: Option<TransaktionsgrundErgaenzung>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
}

/// SteuerbareRessource for PID 55600 — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct SteuerbareRessource {
    /// Required (X [961]). (an..35)
    pub steuerbare_ressource_id: Option<String>,
    pub zeitscheibe: Option<SteuerbareRessourceZeitscheibe>,
}

/// TechnischeRessource for PID 55600 — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct TechnischeRessource {
    /// Required (X [922]). (an..35)
    pub technische_ressource_id: Option<String>,
    pub zeitscheibe: Option<TechnischeRessourceZeitscheibe>,
}

/// Zaehler for PID 55600 — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Zaehler {
    pub merkmal: Option<ZaehlerMerkmal>,
}

/// PID 55600 transaction — Anmeldung neue verb. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (Muss [556] ∧ [559]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_map_or_vec")]
    pub geschaeftspartner: Option<BTreeMap<GeschaeftspartnerKey, Geschaeftspartner>>,
    /// Required (Soll [2061] ∧ [165]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub marktlokation: Option<Vec<Marktlokation>>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub messlokation: Option<Vec<Messlokation>>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub produktpaket_daten: Option<Vec<ProduktpaketDaten>>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub steuerbare_ressource: Option<Vec<SteuerbareRessource>>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub technische_ressource: Option<Vec<TechnischeRessource>>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub zaehler: Option<Vec<Zaehler>>,
}

/// PID 55600 message-level — Anmeldung neue verb. MaLo.
#[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 55600 — Anmeldung neue verb. MaLo.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
