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

/// textbezug for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Textbezug {
    /// Zusätzliche Informationen (für allgemeine Hinweise)
    #[serde(rename = "ACB")]
    ZusaetzlicheInformationenAllgemeineHinweise,
}

/// codepflegeCode for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum CodepflegeCode {
    /// GS1
    #[serde(rename = "9")]
    Gs1,
    /// DE, BDEW (Bundesverband der Energie- und Wasserwirtschaft e.V.)
    #[serde(rename = "293")]
    DeBdewBundesverbandEnergieWasserwirtschaftEV,
}

/// partnerrolle for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Partnerrolle {
    /// andere zugehörige Partei
    #[serde(rename = "VY")]
    AndereZugehoerigePartei,
}

/// kommunikationsart for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kommunikationsart {
    /// Elektronische Post
    #[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 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Kontaktfunktion {
    /// Informationskontakt
    #[serde(rename = "IC")]
    Informationskontakt,
}

/// marktrolle for PID 55080
#[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 55080
#[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,
}

/// ideQualifier for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum IdeQualifier {
    /// Transaktion
    #[serde(rename = "24")]
    Transaktion,
}

/// pruefidentifikator for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// GPKE / Ablehnung Anmeldung erzeugende Marktlokation
    #[serde(rename = "55080")]
    GpkeAblehnungAnmeldungErzeugendeMarktlokation,
}

/// pruefschrittCode for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PruefschrittCode {
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
    /// Tranche
    #[serde(rename = "ZW5")]
    Tranche,
    /// Erzeugende Marktlokation
    #[serde(rename = "ZW3")]
    ErzeugendeMarktlokation,
}

/// statusZ35 for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusZ35 {
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
    /// Tranche
    #[serde(rename = "ZW5")]
    Tranche,
    /// Erzeugende Marktlokation
    #[serde(rename = "ZW3")]
    ErzeugendeMarktlokation,
}

/// statusZ35Ebdnummer2 for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusZ35Ebdnummer2 {
    /// EBD Nr. E_0622
    #[serde(rename = "E_0622")]
    EbdNrE0622,
    /// EBD Nr. E_0623
    #[serde(rename = "E_0623")]
    EbdNrE0623,
    /// EBD Nr. E_0624
    #[serde(rename = "E_0624")]
    EbdNrE0624,
}

/// statusZ35Transaktionsgrund2 for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StatusZ35Transaktionsgrund2 {
    /// Erzeugende Marktlokation
    #[serde(rename = "ZW3")]
    ErzeugendeMarktlokation,
    /// Tranche
    #[serde(rename = "ZW5")]
    Tranche,
}

/// transaktionsgrund for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsgrund {
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
    /// Tranche
    #[serde(rename = "ZW5")]
    Tranche,
    /// Erzeugende Marktlokation
    #[serde(rename = "ZW3")]
    ErzeugendeMarktlokation,
}

/// transaktionsgrundDetail for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TransaktionsgrundDetail {
    /// Erzeugende Marktlokation
    #[serde(rename = "ZW3")]
    ErzeugendeMarktlokation,
    /// Tranche
    #[serde(rename = "ZW5")]
    Tranche,
}

/// transaktionsgrundErgaenzung for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TransaktionsgrundErgaenzung {
    /// Kunde verlässt eine schon bestehende Marktlokation
    #[serde(rename = "E01")]
    KundeVerlaesstBestehendeMarktlokation,
    /// - Kunde bleibt an der Marktlokation, hat nur den Marktpartner gewechselt - Ma...
    #[serde(rename = "E03")]
    KundeBleibtMarktlokationMarktpartnerGewechseltMarktpartnerKunden,
}

/// transaktionsnummer for PID 55080
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsnummer {
    /// GPKE / Ablehnung Anmeldung erzeugende Marktlokation
    #[serde(rename = "55080")]
    GpkeAblehnungAnmeldungErzeugendeMarktlokation,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GeschaeftspartnerAdresse {
    /// Required (Muss [84] ∧ [566]). ()
    pub hausnummer: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub landescode: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub ort: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub postleitzahl: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub strasse: Option<String>,
}

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

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProzessdatenZeitscheibe {
    /// Required (unknown). ()
    pub referenz: Option<String>,
}

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

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

/// Freitext for PID 55080 — Ablehnung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Freitext {
    /// Required (X). (an..512)
    pub text: Option<String>,
    /// Required (unknown). ()
    pub text_referenz: Option<String>,
    /// Optional. (an..512)
    pub text_zeile2: Option<String>,
    /// Optional. (an..512)
    pub text_zeile3: Option<String>,
    /// Optional. (an..512)
    pub text_zeile4: Option<String>,
    /// Optional. (an..512)
    pub text_zeile5: Option<String>,
    /// Required (X). (an..3)
    pub textbezug: Option<Textbezug>,
    /// Required (unknown). ()
    pub textfunktion: Option<String>,
}

/// Geschaeftspartner for PID 55080 — Ablehnung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Geschaeftspartner {
    pub adresse: Option<GeschaeftspartnerAdresse>,
    /// Required (Muss [84] ∧ [566]). ()
    pub anrede: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub codeliste_code: Option<String>,
    /// Required (X). (an..3)
    pub codepflege_code: Option<CodepflegeCode>,
    /// Required (X). (an..35)
    pub geschaeftspartner_id: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub name1: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub name2: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub name_zeile3_feld: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub name_zeile4_feld: Option<String>,
    /// Required (X). (an..3)
    pub partnerrolle: Option<Partnerrolle>,
    /// Required (X [950]). (an..70)
    pub referenz: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub region: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub strasse_zeile2: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub strasse_zeile4: Option<String>,
    /// Required (Muss [84] ∧ [566]). ()
    pub zusatzinfo: Option<String>,
}

/// Kontakt for PID 55080 — Ablehnung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Kontakt {
    /// Required (X [1P0..1]). (an..3)
    pub kommunikationsart: Option<Kommunikationsart>,
    /// Required (X (([939] [321]) ∨ ([940] [322])) ∧ [514]). (an..512)
    pub kommunikationsnummer: Option<String>,
    pub kontakt: Option<KontaktKontakt>,
    /// Required (X). (an..3)
    pub kontaktfunktion: Option<Kontaktfunktion>,
}

/// Marktteilnehmer for PID 55080 — Ablehnung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Marktteilnehmer {
    /// Required (unknown). ()
    pub codeliste_code: Option<String>,
    /// Required (X). (an..3)
    pub marktrolle: Option<Marktrolle>,
    /// Required (X). (an..35)
    pub rollencodenummer: Option<String>,
    /// Required (X). (an..3)
    pub rollencodetyp: Option<Rollencodetyp>,
    pub kontakt: Option<Kontakt>,
}

/// Nachricht for PID 55080 — Ablehnung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Required (X [931] [494]). (an..35)
    pub erstellungsdatum: Option<String>,
    /// Optional. ()
    pub nachrichtennummer: Option<String>,
    /// Optional. ()
    pub nachrichtentyp: Option<String>,
}

/// Prozessdaten for PID 55080 — Ablehnung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (unknown). ()
    pub antwort_bearbeitungsstand: Option<String>,
    /// Required (unknown). ()
    pub bearbeitungsstand: Option<String>,
    /// Required (unknown). ()
    pub codepflege_stelle: Option<String>,
    /// Required (X [UB1]). (an..35)
    pub datum_naechste_bearbeitung: Option<String>,
    /// Required (unknown). ()
    pub ebd_nummer: Option<String>,
    /// Required (X [UB1]). (an..35)
    pub gueltig_ab: Option<String>,
    /// Required (X). (an..3)
    pub ide_qualifier: Option<IdeQualifier>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..3)
    pub pruefschritt_code: Option<PruefschrittCode>,
    /// Required (X). (an..3)
    pub status_z35: Option<StatusZ35>,
    /// Required (unknown). ()
    pub status_z35_bearbeitungsstand: Option<String>,
    /// Required (unknown). ()
    pub status_z35_codepflegestelle2: Option<String>,
    /// Required (X). (an..17)
    pub status_z35_ebdnummer2: Option<StatusZ35Ebdnummer2>,
    /// Required (X). (an..3)
    pub status_z35_transaktionsgrund2: Option<StatusZ35Transaktionsgrund2>,
    /// Required (unknown). ()
    pub status_z35_zeitraumid2: Option<String>,
    /// Required (X). (an..3)
    pub transaktionsgrund: Option<Transaktionsgrund>,
    /// Required (X). (an..3)
    pub transaktionsgrund_detail: Option<TransaktionsgrundDetail>,
    /// Optional. (an..3)
    pub transaktionsgrund_ergaenzung: Option<TransaktionsgrundErgaenzung>,
    /// Required (X). (an..70)
    pub transaktionsnummer: Option<Transaktionsnummer>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
    pub zeitscheibe: Option<ProzessdatenZeitscheibe>,
}

/// PID 55080 transaction — Ablehnung Anmeldung erz. MaLo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    pub freitext: Option<Freitext>,
    /// Required (Muss [84] ∧ [566]).
    #[serde(default, deserialize_with = "crate::serde_helpers::deserialize_vec_or_single")]
    pub geschaeftspartner: Option<Vec<Geschaeftspartner>>,
    pub prozessdaten: Option<Prozessdaten>,
}

/// PID 55080 message-level — Ablehnung Anmeldung erz. MaLo.
#[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>,
}

/// Complete interchange for PID 55080 — Ablehnung Anmeldung erz. MaLo.
pub type Interchange = crate::model::Interchange<Message, Transaktion>;
