pub const IDE_VORGANG: &str = "24";
pub const IDE_LISTE: &str = "Z01";
pub mod loc {
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_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 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";
}
#[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>,
}
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);
}
}