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

/// kontakt.funktion_code for PID 33004
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AnsprechpartnerFunktionCode {
    /// Informationsstelle
    #[serde(rename = "IC")]
    Informationskontakt,
}

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

/// dokumenttyp for PID 33004
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DokumentDokumenttyp {
    /// Handelsrechnung
    #[serde(rename = "380")]
    Handelsrechnung,
    /// Selbst ausgestellte Rechnung (engl.: "Self-billed invoice")
    #[serde(rename = "389")]
    SelbstAusgestellteRechnungEnglSelfBilledInvoice,
    /// Storno für Belastung
    #[serde(rename = "457")]
    StornoBelastung,
    /// Storno für selbst ausgestellte Rechnung (Gutschrift im Gutschriftsverfahren)
    #[serde(rename = "Z25")]
    StornoSelbstAusgestellteRechnungGutschriftGutschriftsverfahren,
}

/// marktrolle for PID 33004
#[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 33004
#[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 33004
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum NachrichtDokumenttyp {
    /// Abgelehnte Forderung (Nicht-Zahlungsavis)
    #[serde(rename = "239")]
    AbgelehnteForderungNichtZahlungsavis,
    /// Zahlungsavis
    #[serde(rename = "481")]
    Zahlungsavis,
}

/// pruefidentifikator for PID 33004
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// Prüfidentifikator
    #[serde(rename = "33001")]
    Bestaetigung,
    /// Prüfidentifikator
    #[serde(rename = "33002")]
    Abweisung,
    /// Prüfidentifikator
    #[serde(rename = "33003")]
    AbweisungKopfSumme,
    /// Prüfidentifikator
    #[serde(rename = "33004")]
    AbweisungPosition,
}

/// unsKennung for PID 33004
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum UnsKennung {
    /// Trennung von Positions- und Summenteil
    #[serde(rename = "S")]
    TrennungPositionsSummenteil,
}

/// aktionCode for PID 33004
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AktionCode {
    /// Enthalten in Dokument/Nachricht
    #[serde(rename = "1")]
    EnthaltenDokumentNachricht,
}

/// waehrungCode for PID 33004
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WaehrungCode {
    /// ISO 4217 3-Alpha Code
    #[serde(rename = "EUR")]
    Euro,
}

/// waehrungQualifier for PID 33004
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WaehrungQualifier {
    /// Zahlungswährung
    #[serde(rename = "11")]
    Zahlungswaehrung,
}

/// waehrungsverwendung for PID 33004
#[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 AnsprechpartnerKontakt {
    /// Required (X). (an..3)
    pub funktion_code: Option<AnsprechpartnerFunktionCode>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PositionsabweichungSg12 {
    /// Required (X). (an..70)
    pub abweichungsreferenz: Option<String>,
    /// Required (X). (an..6)
    pub ebd_referenz: Option<String>,
    /// Required (X [548]). (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 (X ([15] ∧ ([11] ⊻ [12] ⊻ [47] ⊻ [48] ⊻ [75] ⊻ [76] ⊻ [77] ⊻ [78] ⊻ [79] ⊻ [80] ⊻ [91] ⊻ [92] ⊻ [105] ⊻ [106] ⊻ [107] ⊻ [108])) ⊻ [33] ⊻ [34]). (an..3)
    pub pruefschritt_code: Option<String>,
    /// Required (X [26] ⊻ ([70] ∧ ([65] ⊻ [68] ⊻ [66] ⊻ [69] ⊻ [64] ⊻ [67] ⊻ [114] ⊻ [115] ⊻ [116] ⊻ [117])) ⊻ ([97] ∧ ([51] ⊻ [52]))). (an..3)
    pub referenz_qualifier: Option<String>,
    /// Required (unknown). ()
    pub text_funktion: Option<String>,
    /// Required (X). (an..3)
    pub text_qualifier: Option<String>,
    /// Required (unknown). ()
    pub text_referenz: Option<String>,
}

/// Ansprechpartner for PID 33004 — Strom Abweisung Position.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Ansprechpartner {
    /// Required (X (([939][89]) ∨ ([940][90])) ∧ [549]). (an..512)
    pub kommunikationsadresse: Option<String>,
    /// Required (X [1P0..1]). (an..3)
    pub kommunikationstyp: Option<Kommunikationstyp>,
    pub kontakt: Option<AnsprechpartnerKontakt>,
    /// Required (X). ()
    pub name: Option<String>,
    /// Required (X). (an..35)
    pub telefonnummer: Option<String>,
}

/// Dokument for PID 33004 — Strom Abweisung Position.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Dokument {
    /// Required (X [512]). (an..70)
    pub abrechnungsreferenz: Option<String>,
    /// Required (X [931]). (an..35)
    pub dokumentdatum: Option<String>,
    /// Required (X [511]). (an..35)
    pub dokumentennummer: Option<String>,
    /// Required (X). (an..3)
    pub dokumenttyp: Option<DokumentDokumenttyp>,
    /// Required (X [930] [501]). (n..35)
    pub faelliger_betrag: Option<String>,
    /// Required (X [930] [501]). (n..35)
    pub ueberweisungsbetrag: Option<String>,
}

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

/// Nachricht for PID 33004 — Strom Abweisung Position.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Optional. (an..35)
    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>,
    /// Optional. (n..35)
    pub ueberweisungsbetrag: Option<String>,
    /// Optional. (a1)
    pub uns_kennung: Option<UnsKennung>,
}

/// Position for PID 33004 — Strom Abweisung Position.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Position {
    /// Required (X). (an..3)
    pub aktion_code: Option<AktionCode>,
    /// Required (X [526]). (an..6)
    pub positionsnummer: Option<String>,
}

/// Positionsabweichung for PID 33004 — Strom Abweisung Position.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Positionsabweichung {
    pub sg12: Option<Vec<PositionsabweichungSg12>>,
}

/// Waehrung for PID 33004 — Strom Abweisung Position.
#[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 33004 transaction — Strom Abweisung Position.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub dokument: Option<Vec<Dokument>>,
    /// Required (X).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub position: Option<Vec<Position>>,
    pub positionsabweichung: Option<Positionsabweichung>,
}

/// PID 33004 message-level — Strom Abweisung Position.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Message {
    pub ansprechpartner: Option<Ansprechpartner>,
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub marktteilnehmer: Option<Vec<Marktteilnehmer>>,
    pub nachricht: Option<Nachricht>,
    pub waehrung: Option<Waehrung>,
}

/// Complete interchange for PID 33004 — Strom Abweisung Position.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
