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

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

/// kommunikationstyp for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kommunikationstyp {
    /// E-Mail
    #[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,
}

/// marktrolle for PID 27003
#[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 27003
#[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,
    /// DE, DVGW Service & Consult GmbH
    #[serde(rename = "332")]
    DeDvgwServiceConsultGmbh,
}

/// dokumentenstatus for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Dokumentenstatus {
    /// Dokument nicht verfügbar
    #[serde(rename = "11")]
    DokumentNichtVerfuegbar,
}

/// dokumenttyp for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Dokumenttyp {
    /// Ausgleichsenergiepreis
    #[serde(rename = "Z04")]
    Ausgleichsenergiepreis,
    /// Preisblatt Messstellenbetrieb
    #[serde(rename = "Z32")]
    PreisblattMessstellenbetrieb,
    /// Preisblatt Sperren / Entsperren und Verzugskosten
    #[serde(rename = "Z54")]
    PreisblattSperrenEntsperrenVerzugskosten,
    /// Preisblatt Netznutzung ohne gemeindespezifische Konzessionsabgaben
    #[serde(rename = "Z64")]
    PreisblattNetznutzungOhneGemeindespezifischeKonzessionsabgaben,
    /// Preisblatt Blindarbeit
    #[serde(rename = "Z67")]
    PreisblattBlindarbeit,
    /// Preisblatt Netznutzung: Gemeindespezifische Konzessionsabgaben
    #[serde(rename = "Z70")]
    PreisblattNetznutzungGemeindespezifischeKonzessionsabgaben,
    /// Preisblatt Konfigurationen
    #[serde(rename = "Z77")]
    PreisblattKonfigurationen,
    /// Preisblatt Technik
    #[serde(rename = "Z94")]
    PreisblattTechnik,
}

/// produktgruppenart for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Produktgruppenart {
    /// keine Gruppe genutzt
    #[serde(rename = "9")]
    KeineGruppeGenutzt,
    /// Netzbetreiberindividuelle Artikel-ID
    #[serde(rename = "Z01")]
    NetzbetreiberindividuelleArtikelId,
}

/// artikelnummertyp for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Artikelnummertyp {
    /// Artikel-ID
    #[serde(rename = "Z09")]
    ArtikelId,
}

/// referenzQualifier for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ReferenzQualifier {
    /// Referenznummer einer vorangegangenen Nachricht
    #[serde(rename = "ACW")]
    ReferenznummerVorangegangenenNachricht,
    /// Preise des Netzbetreibers
    #[serde(rename = "Z56")]
    PreiseNetzbetreibers,
    /// Prüfidentifikator
    #[serde(rename = "Z13")]
    Pruefidentifikator,
}

/// waehrungCode for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WaehrungCode {
    /// Euro
    #[serde(rename = "EUR")]
    Euro,
}

/// waehrungQualifier for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WaehrungQualifier {
    /// Währung der Preisliste
    #[serde(rename = "8")]
    WaehrungPreisliste,
}

/// waehrungsverwendung for PID 27003
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Waehrungsverwendung {
    /// Referenzwährung
    #[serde(rename = "2")]
    Referenzwaehrung,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PreisSg40 {
    /// Optional. (n..9)
    pub einzelpreisbasis_menge: Option<String>,
    /// Optional. (an..8)
    pub masseinheit: Option<String>,
    /// Required (M [10] ∧ [512]). (n..18)
    pub obere_grenze: Option<String>,
    /// Required (X ([946] [513]) ∧ (([968] [48]) ⊻ ([902] [49]))). (n..15)
    pub preis_betrag: Option<String>,
    /// Required (X). (an..3)
    pub preis_qualifier: Option<String>,
    /// Required (unknown). ()
    pub preisart_code: Option<String>,
    /// Required (unknown). ()
    pub preisart_code2: Option<String>,
    /// Required (X ([926] [28] ⊻ [908] [29]) ∧ [72] ∧ [511]). (n..18)
    pub untere_grenze: Option<String>,
    /// Required (X). (an..8)
    pub wertebereich_masseinheit: Option<String>,
    /// Required (X). (an..3)
    pub wertebereich_qualifier: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PreispositionProduktIdentifikation {
    /// Required (X [942] ∧ [41]). (an..35)
    pub id: Option<String>,
}

/// Map key for Marktteilnehmer instances.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum MarktteilnehmerKey {
    /// Nachrichtenempfänger
    #[serde(rename = "MR")]
    Mr,
    /// Dokumenten-/Nachrichtenaussteller bzw. -absender
    #[serde(rename = "MS")]
    Ms,
}

impl std::fmt::Display for MarktteilnehmerKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Mr => write!(f, "MR"),
            Self::Ms => write!(f, "MS"),
        }
    }
}

/// Ansprechpartner for PID 27003 — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Ansprechpartner {
    /// Required (X). (an..3)
    pub funktionscode: Option<Funktionscode>,
    /// Required (X (([939][37]) ∨ ([940][38])) ∧ [519]). (an..512)
    pub kommunikationsadresse: Option<String>,
    /// Required (X [1P0..1]). (an..3)
    pub kommunikationstyp: Option<Kommunikationstyp>,
    /// Required (X). (an..256)
    pub kontaktname: Option<String>,
    /// Required (X). ()
    pub kontaktnummer: Option<String>,
}

/// Marktteilnehmer for PID 27003 — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktteilnehmer {
    /// Required (X). (an..3)
    pub marktrolle: Option<Marktrolle>,
    /// Required (unknown). ()
    pub regelzone: Option<String>,
    /// Required (X). (an..35)
    pub rollencodenummer: Option<String>,
    /// Required (X). (an..3)
    pub rollencodetyp: Option<Rollencodetyp>,
    pub ansprechpartner: Option<Ansprechpartner>,
}

/// Nachricht for PID 27003 — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Required (Muss). ()
    pub antwortart: Option<String>,
    /// Optional. (an..35)
    pub betrachtungszeitraum: Option<String>,
    /// Optional. (an..70)
    pub dokumentennummer: Option<String>,
    /// Optional. (an..3)
    pub dokumentenstatus: Option<Dokumentenstatus>,
    /// Optional. (an..3)
    pub dokumenttyp: Option<Dokumenttyp>,
    /// Optional. (an..35)
    pub erstellungsdatum: Option<String>,
    /// Required (Muss). ()
    pub nachrichtenfunktion: Option<String>,
    /// Optional. (an..35)
    pub preisblattzeitraum_ende: Option<String>,
}

/// Preis for PID 27003 — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Preis {
    pub sg40: Option<Vec<PreisSg40>>,
}

/// Preisgruppe for PID 27003 — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Preisgruppe {
    /// Required (X). (an..3)
    pub produktgruppenart: Option<Produktgruppenart>,
}

/// Preisposition for PID 27003 — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Preisposition {
    /// Required (X). (an..3)
    pub artikelnummertyp: Option<Artikelnummertyp>,
    /// Required (unknown). ()
    pub handlungscode: Option<String>,
    /// Required (X [911]). (an..6)
    pub positionsnummer: Option<String>,
    pub produkt_identifikation: Option<PreispositionProduktIdentifikation>,
}

/// Referenz for PID 27003 — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Referenz {
    /// Required (X). (an..3)
    pub referenz_qualifier: Option<ReferenzQualifier>,
    /// Required (X [504]). (an..70)
    pub referenz_wert: Option<String>,
}

/// Waehrung for PID 27003 — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Waehrung {
    /// Required (X). (an..3)
    pub waehrung_code: Option<WaehrungCode>,
    /// Required (X). (an..3)
    pub waehrung_qualifier: Option<WaehrungQualifier>,
    /// Required (X). (an..3)
    pub waehrungsverwendung: Option<Waehrungsverwendung>,
}

/// PID 27003 transaction — Preisblätter NB-Leistungen.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    pub preis: Option<Preis>,
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub preisgruppe: Option<Vec<Preisgruppe>>,
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub preisposition: Option<Vec<Preisposition>>,
}

/// PID 27003 message-level — Preisblätter NB-Leistungen.
#[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>,
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub referenz: Option<Vec<Referenz>>,
    pub waehrung: Option<Waehrung>,
}

/// Complete interchange for PID 27003 — Preisblätter NB-Leistungen.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
