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

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

/// antwortKategorie for PID 55024
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AntwortKategorie {
    /// Transaktionsgrund
    #[serde(rename = "7")]
    Transaktionsgrund,
    /// Status der Antwort
    #[serde(rename = "E01")]
    StatusAntwort,
}

/// pruefidentifikator for PID 55024
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Pruefidentifikator {
    /// GPKE / Ablehnung Anfrage Stornierung
    #[serde(rename = "55024")]
    GpkeAblehnungAnfrageStornierung,
}

/// pruefschrittCode for PID 55024
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PruefschrittCode {
    /// Dient dem Rückruf von abgegebenen Meldungen
    #[serde(rename = "E05")]
    DientRueckrufAbgegebenenMeldungen,
}

/// transaktionsnummer for PID 55024
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Transaktionsnummer {
    /// GPKE / Ablehnung Anfrage Stornierung
    #[serde(rename = "55024")]
    GpkeAblehnungAnfrageStornierung,
}

#[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"),
        }
    }
}

/// Marktteilnehmer for PID 55024 — Ablehnung Anfrage Stornierung.
#[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>,
}

/// Nachricht for PID 55024 — Ablehnung Anfrage Stornierung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Nachricht {
    /// Optional. (an..35)
    pub erstellungsdatum: Option<String>,
    /// Optional. ()
    pub nachrichtennummer: Option<String>,
    /// Optional. ()
    pub nachrichtentyp: Option<String>,
}

/// Prozessdaten for PID 55024 — Ablehnung Anfrage Stornierung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Prozessdaten {
    /// Required (X). (an..3)
    pub antwort_kategorie: Option<AntwortKategorie>,
    /// Required (unknown). ()
    pub antwort_status: Option<String>,
    /// Required (unknown). ()
    pub ebd_nummer: Option<String>,
    /// Required (X). (an..512)
    pub freitext: Option<String>,
    /// Required (unknown). ()
    pub freitext_referenz: Option<String>,
    /// Required (X). (an..70)
    pub pruefidentifikator: Option<Pruefidentifikator>,
    /// Required (X). (an..3)
    pub pruefschritt_code: Option<PruefschrittCode>,
    /// Required (X). (an..70)
    pub transaktionsnummer: Option<Transaktionsnummer>,
    /// Required (X). (an..35)
    pub vorgang_id: Option<String>,
    pub zeitscheibe: Option<ProzessdatenZeitscheibe>,
}

/// PID 55024 transaction — Ablehnung Anfrage Stornierung.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Transaktion {
    pub prozessdaten: Option<Prozessdaten>,
}

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