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

/// referenzQualifier for PID 55175
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ReferenzQualifier {
    /// Lokationsbündelstruktur
    #[serde(rename = "Z31")]
    Lokationsbuendelstruktur,
    /// Keine standardisierte Lokationsbündelstruktur vorhanden
    #[serde(rename = "Z39")]
    KeineStandardisierteLokationsbuendelstrukturVorhanden,
}

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

/// pruefidentifikator for PID 55175
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// GPKE / Änderung der Lokationsbündelstruktur NB an LF
    #[serde(rename = "55175")]
    GpkeAenderungLokationsbuendelstrukturNbLf,
}

/// transaktionsgrund for PID 55175
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// Änderung der Lokationsbündelstruktur
    #[serde(rename = "ZY2")]
    AenderungLokationsbuendelstruktur,
}

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

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

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

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

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

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

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TrancheZeitscheibe {
    /// Required (X [914] ∧ [937]). (an..256)
    pub referenz: 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"),
        }
    }
}

/// LokationsbuendelDaten for PID 55175 — Änderung der Lokationsbündelstruktur.
#[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 lokationsbuendel_id: Option<String>,
    /// Required (X ([451] ∧ [950]) ⊻ ([452] ∧ [951]) ⊻ ([450] ∧ [960]) ⊻ ([456] ∧ [922])). (an..70)
    pub objektcode: Option<String>,
    /// Required (X ([451] ∧ [950]) ⊻ ([452] ∧ [951]) ⊻ ([450] ∧ [960]) ⊻ ([456] ∧ [922])). (an..70)
    pub vorgelagerte_lokation: Option<String>,
    /// Required (X ([451] ∧ [950]) ⊻ ([452] ∧ [951]) ⊻ ([450] ∧ [960]) ⊻ ([456] ∧ [922])). (an..70)
    pub vorgelagerte_lokation2: Option<String>,
    pub zeitscheibe: Option<LokationsbuendelDatenZeitscheibe>,
    /// Required (X ([451] ∧ [950]) ⊻ ([452] ∧ [951]) ⊻ ([450] ∧ [960]) ⊻ ([456] ∧ [922])). (an..70)
    pub zugeordnete_marktlokation: Option<String>,
    /// Required (X ([451] ∧ [950]) ⊻ ([452] ∧ [951]) ⊻ ([450] ∧ [960]) ⊻ ([456] ∧ [922])). (an..70)
    pub zugeordnete_netzlokation: Option<String>,
    /// Required (X ([451] ∧ [950]) ⊻ ([452] ∧ [951]) ⊻ ([450] ∧ [960]) ⊻ ([456] ∧ [922])). (an..70)
    pub zugeordnete_steuerbare_ressource: Option<String>,
    /// Required (X ([451] ∧ [950]) ⊻ ([452] ∧ [951]) ⊻ ([450] ∧ [960]) ⊻ ([456] ∧ [922])). (an..70)
    pub zugeordnete_technische_ressource: Option<String>,
}

/// LokationsbuendelStruktur for PID 55175 — Änderung der Lokationsbündelstruktur.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct LokationsbuendelStruktur {
    /// Required (M [914] ∧ [937] [242]). (an..6)
    pub fortlaufende_nummer: Option<String>,
    /// Required (X [333]). (an..70)
    pub lokationsbuendel_struktur_id: Option<String>,
    /// Required (X). (an..3)
    pub referenz_qualifier: Option<ReferenzQualifier>,
    pub zeitscheibe: Option<LokationsbuendelStrukturZeitscheibe>,
}

/// Marktlokation for PID 55175 — Änderung der Lokationsbündelstruktur.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktlokation {
    /// Required (X). ()
    pub codeliste_code: Option<String>,
    /// Required (X). ()
    pub codepflege_code: Option<String>,
    /// Required (X [914] ∧ [937]). (an..256)
    pub lokation_zeitraum_id: Option<String>,
    /// Required (X [950] [129]). (an..35)
    pub marktlokations_id: Option<String>,
    /// Required (X [950]). (an..35)
    pub ruhende_marktlokations_id: Option<String>,
    pub zeitscheibe: Option<MarktlokationZeitscheibe>,
}

/// Marktteilnehmer for PID 55175 — Änderung der Lokationsbündelstruktur.
#[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 55175 — Änderung der Lokationsbündelstruktur.
#[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 55175 — Änderung der Lokationsbündelstruktur.
#[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>,
}

/// Netzlokation for PID 55175 — Änderung der Lokationsbündelstruktur.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Netzlokation {
    /// Required (X [960]). (an..35)
    pub netzlokations_id: Option<String>,
    pub zeitscheibe: Option<NetzlokationZeitscheibe>,
}

/// Prozessdaten for PID 55175 — Änderung der Lokationsbündelstruktur.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..3)
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
}

/// SteuerbareRessource for PID 55175 — Änderung der Lokationsbündelstruktur.
#[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 55175 — Änderung der Lokationsbündelstruktur.
#[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>,
}

/// Tranche for PID 55175 — Änderung der Lokationsbündelstruktur.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Tranche {
    /// Required (X [950] [129]). (an..35)
    pub identifikation: Option<String>,
    pub zeitscheibe: Option<TrancheZeitscheibe>,
}

/// PID 55175 transaction — Änderung der Lokationsbündelstruktur.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub lokationsbuendel_daten: Option<Vec<LokationsbuendelDaten>>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub lokationsbuendel_struktur: Option<Vec<LokationsbuendelStruktur>>,
    /// Required (X).
    #[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 netzlokation: Option<Vec<Netzlokation>>,
    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 tranche: Option<Vec<Tranche>>,
}

/// PID 55175 message-level — Änderung der Lokationsbündelstruktur.
#[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 55175 — Änderung der Lokationsbündelstruktur.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
