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

/// marktrolle for PID 55078
#[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 55078
#[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 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Mengeneinheit {
    /// Prozent
    #[serde(rename = "P1")]
    Prozent,
}

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

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

/// pruefidentifikator for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// GPKE / Bestätigung Anmeldung erzeugende Marktlokation
    #[serde(rename = "55078")]
    GpkeBestaetigungAnmeldungErzeugendeMarktlokation,
}

/// pruefschrittCode for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PruefschrittCode {
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
}

/// referenz for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Referenz {
    /// GPKE / Bestätigung Anmeldung erzeugende Marktlokation
    #[serde(rename = "55078")]
    GpkeBestaetigungAnmeldungErzeugendeMarktlokation,
}

/// transaktionsgrund for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
}

/// transaktionsgrundDetail for PID 55078
#[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,
}

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

/// transaktionsnummer for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsnummer {
    /// GPKE / Bestätigung Anmeldung erzeugende Marktlokation
    #[serde(rename = "55078")]
    GpkeBestaetigungAnmeldungErzeugendeMarktlokation,
}

/// merkmal.code for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungCode {
    /// Zugeordneter Marktpartner
    #[serde(rename = "ZB3")]
    ZugeordneterMarktpartner,
}

/// merkmal.eigenschaft for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungEigenschaft {
    /// Grundzuständiger Messstellenbetreiber
    #[serde(rename = "Z39")]
    GrundzustaendigerMessstellenbetreiber,
    /// Wettbewerblicher Messstellenbetreiber
    #[serde(rename = "Z40")]
    WettbewerblicherMessstellenbetreiber,
    /// Auffangmessstellenbetreiber
    #[serde(rename = "Z41")]
    Auffangmessstellenbetreiber,
}

/// merkmal.eigenschaft_2 for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungEigenschaft2 {
    /// 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.qualifier for PID 55078
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZuordnungQualifier {
    /// MSB
    #[serde(rename = "Z91")]
    Msb,
}

#[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 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 ProzessdatenZeitscheibe {
    /// Required (unknown). ()
    pub referenz: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SteuerbareRessourceZeitscheibe {
    /// 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 codepflege: Option<String>,
    /// Required (unknown). ()
    pub dimension: Option<String>,
    /// Required (X). (an..35)
    pub eigenschaft: Option<ZuordnungEigenschaft>,
    /// Required (X). (an..35)
    pub eigenschaft_2: Option<ZuordnungEigenschaft2>,
    /// Required (unknown). ()
    pub klasse: Option<String>,
    /// Required (X). (an..3)
    pub qualifier: Option<ZuordnungQualifier>,
}

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

/// Marktlokation for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktlokation {
    /// Required (Muss [2061]). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [2061]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub marktlokations_id: Option<String>,
    pub zeitscheibe: Option<MarktlokationZeitscheibe>,
}

/// Marktteilnehmer for PID 55078 — Bestätigung Anmeldung erz. 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>,
}

/// Messlokation for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (Muss [623]). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [623]). ()
    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<Mengeneinheit>,
    /// Required (X [951]). (an..35)
    pub messlokations_id: Option<String>,
}

/// MesslokationDaten for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct MesslokationDaten {
    pub referenz: Option<MesslokationDatenReferenz>,
    pub zeitscheibe: Option<MesslokationDatenZeitscheibe>,
}

/// Nachricht for PID 55078 — Bestätigung Anmeldung erz. 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>,
}

/// Netzlokation for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Netzlokation {
    /// Required (Soll [46] ∧ [688]). ()
    pub codeliste_code: Option<String>,
    /// Required (Soll [46] ∧ [688]). ()
    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>,
}

/// Prozessdaten for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (unknown). ()
    pub antwort_bearbeitungsstand: Option<String>,
    /// Required (unknown). ()
    pub bearbeitungsstand: Option<String>,
    /// Required (unknown). ()
    pub codepflege_stelle: Option<String>,
    /// Required (unknown). ()
    pub ebd_nummer: Option<String>,
    /// Required (X [UB1]). (an..35)
    pub gueltig_ab: Option<String>,
    /// Required (X). (an..3)
    pub ide_qualifier: Option<IdeQualifier>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..3)
    pub pruefschritt_code: Option<PruefschrittCode>,
    /// Required (X). (an..70)
    pub referenz: Option<Referenz>,
    /// 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..70)
    pub transaktionsnummer: Option<Transaktionsnummer>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
    pub zeitscheibe: Option<ProzessdatenZeitscheibe>,
}

/// SteuerbareRessource for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct SteuerbareRessource {
    /// Required (Soll [46] ∧ [690]). ()
    pub codeliste_code: Option<String>,
    /// Required (Soll [46] ∧ [690]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [961]). (an..70)
    pub referenz: Option<String>,
    /// Required (X [961]). (an..35)
    pub steuerbare_ressource_id: Option<String>,
    pub zeitscheibe: Option<SteuerbareRessourceZeitscheibe>,
}

/// TechnischeRessource for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct TechnischeRessource {
    /// Required (Soll [46] ∧ [689] ∧ [694] ∧ [698]). ()
    pub codeliste_code: Option<String>,
    /// Required (Soll [46] ∧ [689] ∧ [694] ∧ [698]). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [922]). (an..35)
    pub technische_ressource_id: Option<String>,
}

/// Tranche for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Tranche {
    /// Required (Muss [2061] ∧ ([477] ⊻ [478])). ()
    pub codeliste_code: Option<String>,
    /// Required (Muss [2061] ∧ ([477] ⊻ [478])). ()
    pub codepflege_code: Option<String>,
    /// Optional. (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub tranche_id: Option<String>,
}

/// Zuordnung for PID 55078 — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Zuordnung {
    pub merkmal: Option<ZuordnungMerkmal>,
    /// Required (X). (an..17)
    pub zugeordneter_mp: Option<String>,
}

/// PID 55078 transaction — Bestätigung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (Muss [2061]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub marktlokation: Option<Vec<Marktlokation>>,
    /// Required (Muss [623]).
    #[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] ∧ [688]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub netzlokation: Option<Vec<Netzlokation>>,
    pub prozessdaten: Option<Prozessdaten>,
    /// Required (Soll [46] ∧ [690]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub steuerbare_ressource: Option<Vec<SteuerbareRessource>>,
    /// Required (Soll [46] ∧ [689] ∧ [694] ∧ [698]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub technische_ressource: Option<Vec<TechnischeRessource>>,
    /// Required (Muss [2061] ∧ ([477] ⊻ [478])).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub tranche: Option<Vec<Tranche>>,
    pub zuordnung: Option<Zuordnung>,
}

/// PID 55078 message-level — Bestätigung Anmeldung erz. 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 55078 — Bestätigung Anmeldung erz. MaLo.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
