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

/// ebdReferenz for PID 29002
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EbdReferenz {
    /// Codeliste Strom Nr. S_0108
    #[serde(rename = "S_0108")]
    CodelisteStromNrS0108,
}

/// dokumenttyp for PID 29002
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DokumentDokumenttyp {
    /// Lieferschein Grund- / Arbeitspreis
    #[serde(rename = "Z41")]
    LieferscheinGrundArbeitspreis,
    /// Lieferschein Arbeits- / Leistungspreis
    #[serde(rename = "Z42")]
    LieferscheinArbeitsLeistungspreis,
}

/// kommunikationstyp for PID 29002
#[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,
}

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

/// marktrolle for PID 29002
#[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 29002
#[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 29002
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum NachrichtDokumenttyp {
    /// Belastungsanzeige
    #[serde(rename = "456")]
    Belastungsanzeige,
    /// MSCONS, die eine INVOIC unterstützt
    #[serde(rename = "739")]
    MsconsInvoicUnterstuetzt,
}

/// pruefidentifikator for PID 29002
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// Prüfidentifikator
    #[serde(rename = "29001")]
    Pruefidentifikator,
    /// Prüfidentifikator
    #[serde(rename = "29002")]
    Pruefidentifikator2,
}

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

/// Abweichung for PID 29002 — Ablehnung IFTSTA.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Abweichung {
    /// Required (X [492]). (an..6)
    pub ebd_referenz: Option<EbdReferenz>,
    /// Required (unknown). ()
    pub freitext: Option<String>,
    /// Required (unknown). ()
    pub freitext_funktion: Option<String>,
    /// Required (unknown). ()
    pub freitext_qualifier: Option<String>,
    /// Required (unknown). ()
    pub freitext_referenz: Option<String>,
    /// Required (X). (an..3)
    pub pruefschritt_code: Option<String>,
}

/// Dokument for PID 29002 — Ablehnung IFTSTA.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Dokument {
    /// Required (X [506]). (an..70)
    pub dokumentennummer: Option<String>,
    /// Required (X). (an..3)
    pub dokumenttyp: Option<DokumentDokumenttyp>,
}

/// Marktteilnehmer for PID 29002 — Ablehnung IFTSTA.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktteilnehmer {
    /// Required (X (([939][21]) ∨ ([940][22])) ∧ [508]). (an..512)
    pub kommunikationsadresse: Option<String>,
    /// Required (X [1P0..1]). (an..3)
    pub kommunikationstyp: Option<Kommunikationstyp>,
    pub kontakt: Option<MarktteilnehmerKontakt>,
    /// Required (X). (an..3)
    pub kontakt_funktion: Option<KontaktFunktion>,
    /// Required (X). (an..3)
    pub marktrolle: Option<Marktrolle>,
    /// Required (X [3]). (an..35)
    pub rollencodenummer: Option<String>,
    /// Required (X). (an..3)
    pub rollencodetyp: Option<Rollencodetyp>,
}

/// Nachricht for PID 29002 — Ablehnung IFTSTA.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Optional. (an..70)
    pub dokumentennummer: Option<String>,
    /// Optional. (an..3)
    pub dokumenttyp: Option<NachrichtDokumenttyp>,
    /// Optional. (an..35)
    pub erstellungsdatum: Option<String>,
    /// Optional. (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (unknown). ()
    pub waehrung_code: Option<String>,
    /// Required (unknown). ()
    pub waehrung_qualifier: Option<String>,
    /// Required (unknown). ()
    pub waehrungsverwendung: Option<String>,
}

/// PID 29002 transaction — Ablehnung IFTSTA.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    pub abweichung: Option<Abweichung>,
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub dokument: Option<Vec<Dokument>>,
}

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