// 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 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Marktrolle {
    /// Nachrichtenempfänger
    #[serde(rename = "MR")]
    Nachrichtenempfaenger,
    /// Dokumenten-/Nachrichtenaussteller bzw. -absender
    #[serde(rename = "MS")]
    DokumentenNachrichtenausstellerAbsender,
}

/// rollencodetyp for PID 21003
#[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,
}

/// dokumenttyp for PID 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Dokumenttyp {
    /// MaBiS Meldung(en)
    #[serde(rename = "Z03")]
    MabisMeldungEn,
}

/// ebdNummer for PID 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EbdNummer {
    /// EBD Nr. E_0062
    #[serde(rename = "E_0062")]
    EbdNrE0062,
    /// EBD Nr. E_0063
    #[serde(rename = "E_0063")]
    EbdNrE0063,
    /// EBD Nr. E_0064
    #[serde(rename = "E_0064")]
    EbdNrE0064,
    /// EBD Nr. E_0065
    #[serde(rename = "E_0065")]
    EbdNrE0065,
    /// EBD Nr. E_0098
    #[serde(rename = "E_0098")]
    EbdNrE0098,
    /// EBD Nr. E_0099
    #[serde(rename = "E_0099")]
    EbdNrE0099,
}

/// statusCode for PID 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusCode {
    /// Zeitreihe akzeptiert
    #[serde(rename = "Z07")]
    ZeitreiheAkzeptiert,
    /// Zeitreihe nicht akzeptiert
    #[serde(rename = "Z08")]
    ZeitreiheNichtAkzeptiert,
}

/// statusKategorie for PID 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusZ03StatusKategorie {
    /// Prüfstatus zur Summenzeitreihe
    #[serde(rename = "Z03")]
    PruefstatusSummenzeitreihe,
    /// Datenstatus zur Summenzeitreihe
    #[serde(rename = "Z04")]
    DatenstatusSummenzeitreihe,
}

/// pruefschrittCode for PID 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PruefschrittCode {
    /// Zeitreihe akzeptiert
    #[serde(rename = "Z07")]
    ZeitreiheAkzeptiert,
    /// Zeitreihe nicht akzeptiert
    #[serde(rename = "Z08")]
    ZeitreiheNichtAkzeptiert,
}

/// statusKategorie for PID 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusZ04StatusKategorie {
    /// Prüfstatus zur Summenzeitreihe
    #[serde(rename = "Z03")]
    PruefstatusSummenzeitreihe,
    /// Datenstatus zur Summenzeitreihe
    #[serde(rename = "Z04")]
    DatenstatusSummenzeitreihe,
}

/// pruefidentifikator for PID 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// MaBiS / Statusmeldung vom BIKO an NB/ÜNB
    #[serde(rename = "21003")]
    MabisStatusmeldungBikoNbUenb,
}

/// zeitreihenVersion for PID 21003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ZeitreihenVersion {
    /// MaBiS / Statusmeldung vom BIKO an NB/ÜNB
    #[serde(rename = "21003")]
    MabisStatusmeldungBikoNbUenb,
}

/// Marktteilnehmer for PID 21003 — Status-meldung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktteilnehmer {
    /// Required (X). (an..3)
    pub marktrolle: Option<Marktrolle>,
    /// Required (X [27]). (an..35)
    pub rollencodenummer: Option<String>,
    /// Required (X). (an..3)
    pub rollencodetyp: Option<Rollencodetyp>,
}

/// Messlokation for PID 21003 — Status-meldung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Messlokation {
    /// Required (X). (an..35)
    pub bilanzierungsperiode: Option<String>,
    /// Required (X [951] [504]). (an..35)
    pub meldepunkt_id: Option<String>,
    /// Required (X). (an..35)
    pub statusaenderung_zeitstempel: Option<String>,
}

/// Nachricht for PID 21003 — Status-meldung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Required (X). (an..70)
    pub dokumentennummer: Option<String>,
    /// Required (X). (an..3)
    pub dokumenttyp: Option<Dokumenttyp>,
    /// Required (X [931] [494]). (an..35)
    pub erstellungsdatum: Option<String>,
}

/// StatusZ03 for PID 21003 — Status-meldung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct StatusZ03 {
    /// Required (X). (an..17)
    pub ebd_nummer: Option<EbdNummer>,
    /// Required (X [45] ∨ [46]). (an..3)
    pub pruefschritt_code: Option<String>,
    /// Required (X). (an..3)
    pub status_code: Option<StatusCode>,
    /// Required (X). (an..3)
    pub status_kategorie: Option<StatusZ03StatusKategorie>,
}

/// StatusZ04 for PID 21003 — Status-meldung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct StatusZ04 {
    /// Required (Muss ([6] ∧ [7]) ∨ [8]). ()
    pub ebd_nummer: Option<String>,
    /// Required (X). (an..3)
    pub pruefschritt_code: Option<PruefschrittCode>,
    /// Required (X). (an..3)
    pub status_kategorie: Option<StatusZ04StatusKategorie>,
}

/// Vorgang for PID 21003 — Status-meldung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Vorgang {
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X [911]). (an..17)
    pub vorgangsnummer: Option<String>,
    /// Required (X). (an..70)
    pub zeitreihen_version: Option<ZeitreihenVersion>,
}

/// PID 21003 transaction — Status-meldung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    /// Required (X).
    pub messlokation: Option<Messlokation>,
    /// Required (Muss ([6] ∧ [7]) ∨ [8]).
    pub status_z03: Option<StatusZ03>,
    /// Required (Muss ([6] ∧ [7]) ∨ [8]).
    pub status_z04: Option<StatusZ04>,
    pub vorgang: Option<Vorgang>,
}

/// PID 21003 message-level — Status-meldung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Message {
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub marktteilnehmer: Option<Vec<Marktteilnehmer>>,
    pub nachricht: Option<Nachricht>,
}

/// Complete interchange for PID 21003 — Status-meldung.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
