pub const IDE_VORGANG: &str = "24";
pub const IDE_LISTE: &str = "Z01";
pub const BGM_MABIS_ZP_LIFECYCLE: &str = "Z07";
pub const BGM_CLEARINGLISTE: &str = "Z05";
pub const SEQ_SUMMENZEITREIHE: &str = "Z22";
pub const RFF_ZEITREIHE: &str = "AUU";
pub mod loc {
pub const MELDEPUNKT: &str = "172";
pub const MABIS_ZAEHLPUNKT: &str = "Z15";
pub const MARKTLOKATION: &str = "Z16";
pub const MESSLOKATION: &str = "Z17";
pub const NETZLOKATION: &str = "Z18";
pub const STEUERBARE_RESSOURCE: &str = "Z19";
pub const TECHNISCHE_RESSOURCE: &str = "Z20";
pub const TRANCHE: &str = "Z21";
pub const RUHENDE_MARKTLOKATION: &str = "Z22";
}
pub mod dtm {
pub const LEISTUNGSBEGINN_GEPLANT: &str = "76";
pub const BEGINN_ZUM: &str = "92";
pub const ENDE_ZUM: &str = "93";
pub const BESTAETIGTES_VERTRAGSENDE: &str = "Z05";
pub const AENDERUNG_ZUM: &str = "157";
pub const ENDE_NAECHSTMOEGLICH: &str = "471";
pub const BILANZIERUNGSBEGINN: &str = "158";
pub const BILANZIERUNGSENDE: &str = "159";
pub const UET_LIEFERANMELDUNG: &str = "154";
pub const KUENDIGUNGSFRIST: &str = "Z01";
pub const KUENDIGUNGSTERMIN: &str = "Z10";
pub const NACHRICHTENDATUM: &str = "137";
}
pub const STS_TRANSAKTIONSGRUND: &str = "7";
pub const STS_ANTWORT_DRITTER: &str = "Z35";
pub const STS_STATUS_ANTWORT: &str = "E01";
pub mod transaktionsgrund {
pub const EIN_AUSZUG: &str = "E01";
pub const EINZUG_NEUANLAGE: &str = "E02";
pub const WECHSEL: &str = "E03";
pub const STORNIERUNG: &str = "E05";
pub const ERSATZBELIEFERUNG: &str = "E06";
pub const KUENDIGUNG_LRV: &str = "Z02";
pub const INFO_EXISTIERENDE_ZUORDNUNG: &str = "Z26";
pub const AUSZUG_STILLLEGUNG: &str = "Z33";
pub const EOG_UMZUG: &str = "Z36";
pub const EOG_NEUANLAGE: &str = "Z37";
pub const EOG_VORUEBERGEHEND: &str = "Z39";
pub const ESV_ENDE_OHNE_FOLGE: &str = "Z41";
pub const EOG_BK_SCHLIESSUNG: &str = "ZC6";
pub const EOG_ZUORDNUNGSERMAECHTIGUNG: &str = "ZC7";
pub const BEENDIGUNG_ZUORDNUNG: &str = "ZC8";
pub const BEENDIGUNG_RUECKZUORDNUNG: &str = "ZD9";
pub const AUFHEBUNG_EEG38: &str = "ZG5";
pub const BEENDIGUNG_EEG38: &str = "ZG6";
pub const AUFHEBUNG_AUSZUG: &str = "ZG9";
pub const AUFHEBUNG_FRUEHERE_ANMELDUNG: &str = "ZH0";
pub const AUFHEBUNG_STILLLEGUNG: &str = "ZH1";
pub const AUFHEBUNG_VERTRAGSVERHAELTNIS: &str = "ZH2";
pub const ZUSAETZLICHER_DATENSATZ: &str = "Z15";
pub const STAMMDATENAENDERUNG: &str = "ZE3";
pub const UEBERNAHME_KEIN_IMS: &str = "ZJ4";
pub const STAMMDATEN: &str = "ZP3";
pub const WERTE: &str = "ZP4";
pub const ABMELDUNG_FEHLENDE_ZUORDNUNGSERMAECHTIGUNG: &str = "ZQ7";
pub const KUENDIGUNG_ANSCHLUSSNEHMER: &str = "ZR9";
pub const ABMELDUNG_FEHLENDE_ZE_ZRT: &str = "ZT0";
pub const ENDE_KUENDIGUNG_LF: &str = "ZT4";
pub const ENDE_KUENDIGUNG_KUNDE: &str = "ZT5";
pub const EOG_KUENDIGUNG_LF: &str = "ZT6";
pub const EOG_KUENDIGUNG_KUNDE: &str = "ZT7";
pub const AENDERUNG_MSB_ABRECHNUNGSDATEN: &str = "ZU1";
pub const ABRECHNUNGSDATEN_BK_ERZEUGEND: &str = "ZX2";
pub const ABRECHNUNGSDATEN_BK_VERBRAUCHEND: &str = "ZX3";
}
pub mod ergaenzung {
pub const ERZEUGENDE_MALO: &str = "ZW3";
pub const VERBRAUCHENDE_MALO: &str = "ZW4";
pub const TRANCHE: &str = "ZW5";
pub const RUHENDE_MALO: &str = "ZAP";
}
pub mod zuordnungsfall {
pub const FALL_1: &str = "ZW8";
pub const FALL_2: &str = "ZW9";
pub const FALL_3: &str = "ZX0";
pub const FALL_4: &str = "ZX1";
}
pub mod nad {
pub const ABSENDER: &str = "MS";
pub const EMPFAENGER: &str = "MR";
pub const KUNDE_DES_LF: &str = "Z09";
pub const ZUGEHOERIGE_PARTEI: &str = "VY";
}
pub mod namensformat {
pub const PERSON: &str = "Z01";
pub const FIRMA: &str = "Z02";
}
pub mod produkt {
pub const SEQ_PRODUKTPAKET: &str = "Z79";
pub const PIA_ERFORDERLICHES_PRODUKT: &str = "5";
pub const PIA_TYP_PRODUKT: &str = "Z11";
pub const CCI_PRODUKTEIGENSCHAFT: &str = "Z66";
pub const CAV_EIGENSCHAFT: &str = "ZH9";
pub const CAV_WERT: &str = "ZV4";
pub const SEQ_PRIORISIERUNG: &str = "ZH0";
pub const CCI_UMSETZUNGSGRAD: &str = "Z65";
pub const UMSETZUNG_VOLLUMFAENGLICH: &str = "Z01";
pub const UMSETZUNG_IN_TEILEN: &str = "Z02";
pub const BILANZKREIS: &str = "9991000002082";
pub const TRANCHENGROESSE: &str = "9991000002090";
pub const CCI_BILANZKREIS_GAS: &str = "Z19";
pub const PRIORITAET: [&str; 5] = ["Z75", "Z76", "Z77", "Z78", "Z79"];
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Produkt {
pub produkt_code: String,
pub eigenschaft: Option<String>,
pub wert: Option<String>,
}
impl Produkt {
#[must_use]
pub fn bilanzkreis(bk: impl Into<String>) -> Self {
Self {
produkt_code: produkt::BILANZKREIS.to_owned(),
eigenschaft: None,
wert: Some(bk.into()),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Umsetzungsgrad {
#[default]
Vollumfaenglich,
InTeilen,
}
impl Umsetzungsgrad {
#[must_use]
pub const fn code(self) -> &'static str {
match self {
Self::Vollumfaenglich => produkt::UMSETZUNG_VOLLUMFAENGLICH,
Self::InTeilen => produkt::UMSETZUNG_IN_TEILEN,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Produktpaket {
pub paket_id: u32,
pub produkte: Vec<Produkt>,
pub umsetzung: Umsetzungsgrad,
}
impl Produktpaket {
#[must_use]
pub fn bilanzkreis(bk: impl Into<String>) -> Self {
Self {
paket_id: 1,
produkte: vec![Produkt::bilanzkreis(bk)],
umsetzung: Umsetzungsgrad::Vollumfaenglich,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Transaktionsgrund {
pub grund: String,
pub ergaenzung: Option<String>,
pub befristet: Option<String>,
}
impl Transaktionsgrund {
#[must_use]
pub fn verbrauchende_malo(grund: impl Into<String>) -> Self {
Self {
grund: grund.into(),
ergaenzung: Some(ergaenzung::VERBRAUCHENDE_MALO.to_owned()),
befristet: None,
}
}
#[must_use]
pub fn new(grund: impl Into<String>, ergaenzung: impl Into<String>) -> Self {
Self {
grund: grund.into(),
ergaenzung: Some(ergaenzung.into()),
befristet: None,
}
}
#[must_use]
pub fn bare(grund: impl Into<String>) -> Self {
Self {
grund: grund.into(),
ergaenzung: None,
befristet: None,
}
}
#[must_use]
pub fn befristet(mut self, code: impl Into<String>) -> Self {
self.befristet = Some(code.into());
self
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AntwortStatus {
pub code: String,
pub codeliste: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DritterAntwortStatus {
pub code: String,
pub codeliste: String,
pub referenz_lokation: Option<String>,
pub objekt: Option<String>,
}
impl DritterAntwortStatus {
#[must_use]
pub fn verbrauchend(code: impl Into<String>) -> Self {
Self {
code: code.into(),
codeliste: EBD_BEENDIGUNG_ZUORDNUNG.to_owned(),
referenz_lokation: None,
objekt: None,
}
}
#[must_use]
pub fn erzeugend(
code: impl Into<String>,
referenz_lokation: impl Into<String>,
objekt: impl Into<String>,
) -> Self {
Self {
code: code.into(),
codeliste: EBD_BEENDIGUNG_ZUORDNUNG.to_owned(),
referenz_lokation: Some(referenz_lokation.into()),
objekt: Some(objekt.into()),
}
}
}
pub const EBD_BEENDIGUNG_ZUORDNUNG: &str = "E_0624";
pub const CODES_REQUIRING_DRITTER: &[&str] = &["A50", "A57"];
impl AntwortStatus {
#[must_use]
pub fn from_codeliste(code: impl Into<String>, codeliste: impl Into<String>) -> Self {
Self {
code: code.into(),
codeliste: Some(codeliste.into()),
}
}
#[must_use]
pub fn bare(code: impl Into<String>) -> Self {
Self {
code: code.into(),
codeliste: None,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_mig_example_shape_is_grund_ergaenzung_befristet() {
let t = Transaktionsgrund::verbrauchende_malo(transaktionsgrund::EIN_AUSZUG)
.befristet(transaktionsgrund::WECHSEL);
assert_eq!(t.grund, "E01");
assert_eq!(t.ergaenzung.as_deref(), Some("ZW4"));
assert_eq!(t.befristet.as_deref(), Some("E03"));
}
#[test]
fn ide_carries_a_vorgang_not_a_location() {
assert_eq!(IDE_VORGANG, "24");
assert_eq!(loc::STEUERBARE_RESSOURCE, "Z19");
assert_ne!(IDE_VORGANG, loc::MARKTLOKATION);
}
}