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

/// kommunikationstyp for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kommunikationstyp {
    /// Elektronische Post
    #[serde(rename = "EM")]
    ElektronischePost,
    /// Telefon
    #[serde(rename = "TE")]
    Telefon,
    /// weiteres Telefon
    #[serde(rename = "AJ")]
    WeiteresTelefon,
    /// Handy
    #[serde(rename = "AL")]
    Handy,
}

/// kontaktFunktion for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum KontaktFunktion {
    /// Informationskontakt
    #[serde(rename = "IC")]
    Informationskontakt,
}

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

/// marktrolle for PID 21037
#[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 21037
#[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 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Dokumenttyp {
    /// Redispatch Meldung(en)
    #[serde(rename = "Z49")]
    RedispatchMeldungEn,
}

/// aceQualifier for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AceQualifier {
    /// Prüfidentifikator
    #[serde(rename = "Z13")]
    Pruefidentifikator,
    /// Referenznummer einer vorangegangenen Nachricht
    #[serde(rename = "ACW")]
    ReferenznummerVorangegangenenNachricht,
    /// Nummer des zugehörigen Dokuments
    #[serde(rename = "ACE")]
    NummerZugehoerigenDokuments,
    /// Referenznummer einer vorangegangenen Nachricht
    #[serde(rename = "ACW")]
    ReferenznummerVorangegangenenNachricht2,
    /// Nummer des zugehörigen Dokuments
    #[serde(rename = "ACE")]
    NummerZugehoerigenDokuments2,
    /// Referenznummer einer vorangegangenen Nachricht
    #[serde(rename = "ACW")]
    ReferenznummerVorangegangenenNachricht3,
}

/// acwQualifier for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AcwQualifier {
    /// Prüfidentifikator
    #[serde(rename = "Z13")]
    Pruefidentifikator,
    /// Referenznummer einer vorangegangenen Nachricht
    #[serde(rename = "ACW")]
    ReferenznummerVorangegangenenNachricht,
    /// Nummer des zugehörigen Dokuments
    #[serde(rename = "ACE")]
    NummerZugehoerigenDokuments,
    /// Referenznummer einer vorangegangenen Nachricht
    #[serde(rename = "ACW")]
    ReferenznummerVorangegangenenNachricht2,
    /// Nummer des zugehörigen Dokuments
    #[serde(rename = "ACE")]
    NummerZugehoerigenDokuments2,
    /// Referenznummer einer vorangegangenen Nachricht
    #[serde(rename = "ACW")]
    ReferenznummerVorangegangenenNachricht3,
}

/// ebdNummer for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EbdNummer {
    /// EBD Nr. E_0902
    #[serde(rename = "E_0902")]
    EbdNrE0902,
    /// EBD Nr. E_0901
    #[serde(rename = "E_0901")]
    EbdNrE0901,
}

/// pruefidentifikator for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// RD / NB-Bewertung
    #[serde(rename = "21037")]
    RdNbBewertung,
}

/// referenz for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Referenz {
    /// RD / NB-Bewertung
    #[serde(rename = "21037")]
    RdNbBewertung,
}

/// statusCode for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusCode {
    /// zugestimmt
    #[serde(rename = "Z30")]
    Zugestimmt,
    /// abgelehnt
    #[serde(rename = "Z32")]
    Abgelehnt,
}

/// statusKategorie for PID 21037
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusKategorie {
    /// Status der Ausfallarbeit
    #[serde(rename = "Z27")]
    StatusAusfallarbeit,
    /// Status des Fahrplananteils
    #[serde(rename = "Z28")]
    StatusFahrplananteils,
    /// Status des Gegenvorschlags der Ausfallarbeit
    #[serde(rename = "Z29")]
    StatusGegenvorschlagsAusfallarbeit,
}

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

/// Betreiber for PID 21037 — Ansicht NB.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Betreiber {
    /// Required (unknown). ()
    pub anrede: Option<String>,
    /// Required (unknown). ()
    pub beteiligter: Option<String>,
    /// Required (unknown). ()
    pub codepflege_code: Option<String>,
    /// Required (unknown). ()
    pub identifikation: Option<String>,
    /// Required (X). (an..512)
    pub kommunikationsadresse: Option<String>,
    /// Required (X [1P1..1]). (an..3)
    pub kommunikationstyp: Option<Kommunikationstyp>,
    pub kontakt: Option<BetreiberKontakt>,
    /// Required (X). (an..3)
    pub kontakt_funktion: Option<KontaktFunktion>,
    /// Required (unknown). ()
    pub nachname: Option<String>,
    /// Required (unknown). ()
    pub name_format_code: Option<String>,
    /// Required (X). (an..3)
    pub partnerrolle: Option<Partnerrolle>,
    /// Required (unknown). ()
    pub titel: Option<String>,
    /// Required (unknown). ()
    pub vorname: Option<String>,
    /// Required (unknown). ()
    pub zusatzinfo: Option<String>,
}

/// Freitext for PID 21037 — Ansicht NB.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Freitext {
    /// Required (X). (an..512)
    pub freitext1: Option<String>,
    /// Optional. (an..512)
    pub freitext2: Option<String>,
    /// Optional. (an..512)
    pub freitext3: Option<String>,
    /// Optional. (an..512)
    pub freitext4: Option<String>,
    /// Optional. (an..512)
    pub freitext5: Option<String>,
    /// Required (unknown). ()
    pub freitext_code: Option<String>,
    /// Required (X [903]). (an..6)
    pub sendungsposition: Option<String>,
    /// Required (unknown). ()
    pub text_funktion: Option<String>,
}

/// Marktteilnehmer for PID 21037 — Ansicht NB.
#[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>,
}

/// Nachricht for PID 21037 — Ansicht NB.
#[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>,
}

/// Status for PID 21037 — Ansicht NB.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Status {
    /// Required (X). (an..3)
    pub ace_qualifier: Option<AceQualifier>,
    /// Required (X). (an..3)
    pub acw_qualifier: Option<AcwQualifier>,
    /// Required (X). (an..17)
    pub ebd_nummer: Option<EbdNummer>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X [62] ∨ [63]). (an..3)
    pub pruefschritt_code: Option<String>,
    /// Required (X). (an..70)
    pub referenz: Option<Referenz>,
    /// Required (X). (an..3)
    pub status_code: Option<StatusCode>,
    /// Required (X). (an..3)
    pub status_kategorie: Option<StatusKategorie>,
}

/// Vorgang for PID 21037 — Ansicht NB.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Vorgang {
    /// Required (unknown). ()
    pub loc_qualifier: Option<String>,
    /// Required (unknown). ()
    pub meldepunkt_id: Option<String>,
    /// Required (X [911]). (n..5)
    pub vorgangsnummer: Option<String>,
}

/// PID 21037 transaction — Ansicht NB.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    pub betreiber: Option<Betreiber>,
    pub freitext: Option<Freitext>,
    /// Required (Muss [57] ∧ [58]  Soll [60]).
    pub status: Option<Status>,
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub vorgang: Option<Vec<Vorgang>>,
}

/// PID 21037 message-level — Ansicht NB.
#[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 21037 — Ansicht NB.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
