// <auto-generated>
// Generated by automapper-generator generate-conditions
// AHB: xml-migs-and-ahbs/FV2504/ORDRSP_AHB_1_0a_Fehlerkorrektur_20250417.xml
// Generated: 2026-03-12T09:54:30Z
// </auto-generated>
#[allow(unused_imports)]
use crate::eval::format_validators::*;
use crate::eval::{ConditionEvaluator, ConditionResult, EvaluationContext};
/// Generated condition evaluator for ORDRSP FV2504.
pub struct OrdrspConditionEvaluatorFV2504 {
// External condition IDs that require runtime context.
external_conditions: std::collections::HashSet<u32>,
}
impl Default for OrdrspConditionEvaluatorFV2504 {
fn default() -> Self {
let mut external_conditions = std::collections::HashSet::new();
external_conditions.insert(3);
external_conditions.insert(4);
external_conditions.insert(5);
external_conditions.insert(9);
external_conditions.insert(10);
external_conditions.insert(12);
external_conditions.insert(14);
external_conditions.insert(15);
external_conditions.insert(16);
external_conditions.insert(17);
external_conditions.insert(18);
external_conditions.insert(29);
external_conditions.insert(30);
external_conditions.insert(31);
external_conditions.insert(32);
external_conditions.insert(40);
external_conditions.insert(49);
external_conditions.insert(52);
external_conditions.insert(60);
external_conditions.insert(70);
external_conditions.insert(71);
external_conditions.insert(75);
external_conditions.insert(492);
external_conditions.insert(493);
Self {
external_conditions,
}
}
}
impl ConditionEvaluator for OrdrspConditionEvaluatorFV2504 {
fn message_type(&self) -> &str {
"ORDRSP"
}
fn format_version(&self) -> &str {
"FV2504"
}
fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
match condition {
1 => self.evaluate_1(ctx),
3 => self.evaluate_3(ctx),
4 => self.evaluate_4(ctx),
5 => self.evaluate_5(ctx),
9 => self.evaluate_9(ctx),
10 => self.evaluate_10(ctx),
11 => self.evaluate_11(ctx),
12 => self.evaluate_12(ctx),
14 => self.evaluate_14(ctx),
15 => self.evaluate_15(ctx),
16 => self.evaluate_16(ctx),
17 => self.evaluate_17(ctx),
18 => self.evaluate_18(ctx),
21 => self.evaluate_21(ctx),
22 => self.evaluate_22(ctx),
23 => self.evaluate_23(ctx),
24 => self.evaluate_24(ctx),
25 => self.evaluate_25(ctx),
27 => self.evaluate_27(ctx),
28 => self.evaluate_28(ctx),
29 => self.evaluate_29(ctx),
30 => self.evaluate_30(ctx),
31 => self.evaluate_31(ctx),
32 => self.evaluate_32(ctx),
33 => self.evaluate_33(ctx),
34 => self.evaluate_34(ctx),
37 => self.evaluate_37(ctx),
38 => self.evaluate_38(ctx),
39 => self.evaluate_39(ctx),
40 => self.evaluate_40(ctx),
41 => self.evaluate_41(ctx),
42 => self.evaluate_42(ctx),
43 => self.evaluate_43(ctx),
44 => self.evaluate_44(ctx),
45 => self.evaluate_45(ctx),
46 => self.evaluate_46(ctx),
47 => self.evaluate_47(ctx),
48 => self.evaluate_48(ctx),
49 => self.evaluate_49(ctx),
50 => self.evaluate_50(ctx),
51 => self.evaluate_51(ctx),
52 => self.evaluate_52(ctx),
53 => self.evaluate_53(ctx),
54 => self.evaluate_54(ctx),
55 => self.evaluate_55(ctx),
56 => self.evaluate_56(ctx),
57 => self.evaluate_57(ctx),
58 => self.evaluate_58(ctx),
59 => self.evaluate_59(ctx),
60 => self.evaluate_60(ctx),
61 => self.evaluate_61(ctx),
62 => self.evaluate_62(ctx),
63 => self.evaluate_63(ctx),
64 => self.evaluate_64(ctx),
65 => self.evaluate_65(ctx),
66 => self.evaluate_66(ctx),
67 => self.evaluate_67(ctx),
68 => self.evaluate_68(ctx),
69 => self.evaluate_69(ctx),
70 => self.evaluate_70(ctx),
71 => self.evaluate_71(ctx),
72 => self.evaluate_72(ctx),
73 => self.evaluate_73(ctx),
74 => self.evaluate_74(ctx),
75 => self.evaluate_75(ctx),
76 => self.evaluate_76(ctx),
77 => self.evaluate_77(ctx),
490 => self.evaluate_490(ctx),
491 => self.evaluate_491(ctx),
492 => self.evaluate_492(ctx),
493 => self.evaluate_493(ctx),
494 => self.evaluate_494(ctx),
500 => self.evaluate_500(ctx),
503 => self.evaluate_503(ctx),
504 => self.evaluate_504(ctx),
513 => self.evaluate_513(ctx),
518 => self.evaluate_518(ctx),
519 => self.evaluate_519(ctx),
520 => self.evaluate_520(ctx),
521 => self.evaluate_521(ctx),
522 => self.evaluate_522(ctx),
523 => self.evaluate_523(ctx),
524 => self.evaluate_524(ctx),
525 => self.evaluate_525(ctx),
526 => self.evaluate_526(ctx),
527 => self.evaluate_527(ctx),
529 => self.evaluate_529(ctx),
530 => self.evaluate_530(ctx),
533 => self.evaluate_533(ctx),
534 => self.evaluate_534(ctx),
535 => self.evaluate_535(ctx),
536 => self.evaluate_536(ctx),
537 => self.evaluate_537(ctx),
538 => self.evaluate_538(ctx),
539 => self.evaluate_539(ctx),
540 => self.evaluate_540(ctx),
542 => self.evaluate_542(ctx),
902 => self.evaluate_902(ctx),
903 => self.evaluate_903(ctx),
930 => self.evaluate_930(ctx),
931 => self.evaluate_931(ctx),
932 => self.evaluate_932(ctx),
933 => self.evaluate_933(ctx),
934 => self.evaluate_934(ctx),
935 => self.evaluate_935(ctx),
939 => self.evaluate_939(ctx),
940 => self.evaluate_940(ctx),
2036 => self.evaluate_2036(ctx),
_ => ConditionResult::Unknown,
}
}
fn is_external(&self, condition: u32) -> bool {
self.external_conditions.contains(&condition)
}
fn is_known(&self, condition: u32) -> bool {
matches!(
condition,
1 | 3
| 4
| 5
| 9
| 10
| 11
| 12
| 14
| 15
| 16
| 17
| 18
| 21
| 22
| 23
| 24
| 25
| 27
| 28
| 29
| 30
| 31
| 32
| 33
| 34
| 37
| 38
| 39
| 40
| 41
| 42
| 43
| 44
| 45
| 46
| 47
| 48
| 49
| 50
| 51
| 52
| 53
| 54
| 55
| 56
| 57
| 58
| 59
| 60
| 61
| 62
| 63
| 64
| 65
| 66
| 67
| 68
| 69
| 70
| 71
| 72
| 73
| 74
| 75
| 76
| 77
| 490
| 491
| 492
| 493
| 494
| 500
| 503
| 504
| 513
| 518
| 519
| 520
| 521
| 522
| 523
| 524
| 525
| 526
| 527
| 529
| 530
| 533
| 534
| 535
| 536
| 537
| 538
| 539
| 540
| 542
| 902
| 903
| 930
| 931
| 932
| 933
| 934
| 935
| 939
| 940
| 2036
)
}
}
impl OrdrspConditionEvaluatorFV2504 {
/// [52] wenn es sich bei der Reklamation um die Reklamation der ausgerollten Leistungskurvendefinitionen handelte
/// EXTERNAL: Requires context from outside the message.
fn evaluate_52(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external
.evaluate("complaint_was_about_rolled_out_power_curve_definitions")
}
/// [60] wenn es sich bei der Reklamation um die Reklamation der Übersicht der Zählzeitdefinitionen handelte
/// EXTERNAL: Requires context from outside the message.
fn evaluate_60(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external
.evaluate("complaint_was_about_overview_time_of_use_definitions")
}
/// [70] wenn es sich bei der Reklamation um die Reklamation der ausgerollten Zählzeitdefinitionen handelte
/// EXTERNAL: Requires context from outside the message.
fn evaluate_70(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external
.evaluate("complaint_was_about_rolled_out_time_of_use_definitions")
}
/// [71] wenn es sich bei der Reklamation um die Reklamation der ausgerollten Schaltzeitdefinitionen handelte
/// EXTERNAL: Requires context from outside the message.
fn evaluate_71(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external
.evaluate("complaint_was_about_rolled_out_switching_time_definitions")
}
/// [75] Wenn es sich um die Antwort auf eine Bestellung handelt in der ein Messprodukt der Codeliste der Konfigurationen aus dem Kapitel 4.6.2 „Werte nach Typ 2 aus SMGW“ bestellt wurde.
/// EXTERNAL: Requires context from outside the message.
fn evaluate_75(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("order_contains_smgw_type2_product")
}
/// [490] wenn Wert in diesem DE, an der Stelle CCYYMMDDHHMM ein Zeitpunkt aus dem angegeben Zeitraum der Tabelle Kapitel 3.5 „Übersicht gesetzliche deutsche Sommerzeit (MESZ)“ der Spalten: „Sommerzei...
fn evaluate_490(&self, ctx: &EvaluationContext) -> ConditionResult {
let dtm_segs = ctx.find_segments("DTM");
match dtm_segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => is_mesz_utc(val),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [491] wenn Wert in diesem DE, an der Stelle CCYYMMDDHHMM ein Zeitpunkt aus dem angegeben Zeitraum der Tabelle Kapitel 3.6 „Übersicht gesetzliche deutsche Zeit (MEZ)“ der Spalten: „Winterzeit (MEZ)...
fn evaluate_491(&self, ctx: &EvaluationContext) -> ConditionResult {
let dtm_segs = ctx.find_segments("DTM");
match dtm_segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => is_mez_utc(val),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [1] Wenn BGM+7 vorhanden
fn evaluate_1(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("BGM", 0, "7")
}
/// [3] Wenn MP-ID in SG3 NAD+MS mit Rolle NB vorhanden
/// EXTERNAL: Requires context from outside the message.
fn evaluate_3(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("sender_is_nb")
}
/// [4] Wenn MP-ID in SG3 NAD+MR mit Rolle LF vorhanden
/// EXTERNAL: Requires context from outside the message.
fn evaluate_4(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("recipient_is_lf")
}
/// [5] Wenn MP-ID in SG3 NAD+MS mit Rolle LF vorhanden
/// EXTERNAL: Requires context from outside the message.
fn evaluate_5(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("sender_is_lf")
}
/// [9] Wenn MP-ID in SG3 NAD+MS mit Rolle LF vorhanden
/// EXTERNAL: Requires context from outside the message.
fn evaluate_9(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("sender_is_lf")
}
/// [10] Wenn MP-ID in SG3 NAD+MS mit Rolle MSB vorhanden
/// EXTERNAL: Requires context from outside the message.
fn evaluate_10(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("sender_is_msb")
}
/// [11] Wenn AJT+A09+E_0470 vorhanden
fn evaluate_11(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualified_value("AJT", 0, "A09", 1, 0, &["E_0470"])
}
/// [12] Wenn der NB eine unverbindliche Preisinformation angeben kann
/// EXTERNAL: Requires context from outside the message.
fn evaluate_12(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("nb_can_provide_price_info")
}
/// [14] Wenn MP-ID in SG3 NAD+MR mit Rolle MSB vorhanden
/// EXTERNAL: Requires context from outside the message.
fn evaluate_14(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("recipient_is_msb")
}
/// [15] Wenn MP-ID in SG3 NAD+MR mit Rolle NB vorhanden
/// EXTERNAL: Requires context from outside the message.
fn evaluate_15(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("recipient_is_nb")
}
/// [16] Wenn MP-ID in SG3 NAD+MR mit Rolle ÜNB vorhanden
/// EXTERNAL: Requires context from outside the message.
fn evaluate_16(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("recipient_is_uenb")
}
/// [17] Der hier angegebene Code des Prüfschritts muss im EBD dem Cluster Zustimmung zugeordnet sein
/// EXTERNAL: Requires context from outside the message.
fn evaluate_17(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("pruefschritt_is_zustimmung_cluster")
}
/// [18] Der hier angegebene Code des Prüfschritts muss im EBD dem Cluster Ablehnung zugeordnet sein
/// EXTERNAL: Requires context from outside the message.
fn evaluate_18(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("pruefschritt_cluster_ablehnung")
}
/// [21] Wenn IMD++Z01 vorhanden
fn evaluate_21(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("IMD", 1, "Z01")
}
/// [22] Wenn IMD++Z02 vorhanden
fn evaluate_22(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("IMD", 1, "Z02")
}
/// [23] Wenn IMD++Z03 vorhanden
fn evaluate_23(&self, ctx: &EvaluationContext) -> ConditionResult {
let segments = ctx.find_segments("IMD");
ConditionResult::from(segments.iter().any(|s| {
s.elements
.get(1)
.and_then(|e| e.first())
.is_some_and(|v| v == "Z03")
}))
}
/// [24] Wenn BGM+Z51 vorhanden
fn evaluate_24(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("BGM", 0, "Z51")
}
/// [25] Wenn BGM+Z52 vorhanden
fn evaluate_25(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("BGM", 0, "Z52")
}
/// [27] Wenn AJT+A05+E_0470 vorhanden
fn evaluate_27(&self, ctx: &EvaluationContext) -> ConditionResult {
let segments = ctx.find_segments_with_qualifier("AJT", 0, "A05");
ConditionResult::from(segments.iter().any(|s| {
s.elements
.get(1)
.and_then(|e| e.first())
.is_some_and(|v| v == "E_0470")
}))
}
/// [28] Wenn AJT+A99 vorhanden
fn evaluate_28(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("AJT", 0, "A99")
}
/// [29] MP-ID nur aus Sparte Gas
/// EXTERNAL: Requires context from outside the message.
fn evaluate_29(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("mp_id_is_gas")
}
/// [30] MP-ID nur aus Sparte Strom
/// EXTERNAL: Requires context from outside the message.
fn evaluate_30(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("mp_id_is_strom")
}
/// [31] MP-ID mit Rolle MSB
/// EXTERNAL: Requires context from outside the message.
fn evaluate_31(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("mp_id_role_is_msb")
}
/// [32] MP-ID mit Rolle NB
/// EXTERNAL: Requires context from outside the message.
fn evaluate_32(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("mp_id_role_is_nb")
}
/// [33] Wenn AJT+A02/A03+E_0488 vorhanden
fn evaluate_33(&self, ctx: &EvaluationContext) -> ConditionResult {
let segments = ctx.find_segments("AJT");
ConditionResult::from(segments.iter().any(|s| {
let qual = s
.elements
.first()
.and_then(|e| e.first())
.map(|v| v.as_str());
let val = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|v| v.as_str());
matches!(qual, Some("A02") | Some("A03")) && matches!(val, Some("E_0488"))
}))
}
/// [34] wenn vorhanden
// REVIEW: 'wenn vorhanden' is a generic conditional-use annotation meaning the element should be included whenever the relevant data is available. As a standalone condition without a specific segment target, it functions as a Hinweis-like unconditional True. (medium confidence)
fn evaluate_34(&self, _ctx: &EvaluationContext) -> ConditionResult {
// 'wenn vorhanden' — generic availability condition: element is conditional on presence of the data
// Without a specific segment reference this acts as an unconditional note
ConditionResult::True
}
/// [37] Wenn in dieser Nachricht das SG8 CUX+2 vorhanden
fn evaluate_37(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("CUX", 0, "2")
}
/// [38] Möglicher Wert: ZB4 oder ZB5
fn evaluate_38(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Möglicher Wert: ZB4 oder ZB5 — informational note documenting permitted values
ConditionResult::True
}
/// [39] Möglicher Wert: E17 oder Z07
fn evaluate_39(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Möglicher Wert: E17 oder Z07 — informational note documenting permitted values
ConditionResult::True
}
/// [40] Wenn der Code im DE3207 in der "EDI@Energy Codeliste der europäischen Ländercodes" in der Spalte "PLZ vorhanden" ein "X" enthält
/// EXTERNAL: Requires context from outside the message.
fn evaluate_40(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("country_has_postal_code")
}
/// [41] wenn SG2 AJT (Einzelheiten zu einer Anpassung/Änderung) DE4465 mit Wert ZB5 vorhanden
fn evaluate_41(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("AJT", 0, "ZB5")
}
/// [42] Wenn SG2 AJT+Z07 (Antwortkategorie: Ablehnung (Keine Berechtigung)) vorhanden
fn evaluate_42(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualifier("AJT", 0, "Z07")
}
/// [43] Wenn AJT+A02/A03+E_1001 vorhanden
fn evaluate_43(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
let found = ajts.iter().any(|s| {
let code = s
.elements
.first()
.and_then(|e| e.first())
.map(|v| v.as_str());
let pos = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|v| v.as_str());
matches!(code, Some("A02") | Some("A03")) && matches!(pos, Some("E_1001"))
});
ConditionResult::from(found)
}
/// [44] Wenn AJT+A05+E_1000 vorhanden
fn evaluate_44(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
let found = ajts.iter().any(|s| {
let code = s
.elements
.first()
.and_then(|e| e.first())
.map(|v| v.as_str());
let pos = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|v| v.as_str());
matches!(code, Some("A05")) && matches!(pos, Some("E_1000"))
});
ConditionResult::from(found)
}
/// [45] Wenn AJT+A09+E_1000 vorhanden
fn evaluate_45(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
let found = ajts.iter().any(|s| {
let code = s
.elements
.first()
.and_then(|e| e.first())
.map(|v| v.as_str());
let pos = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|v| v.as_str());
matches!(code, Some("A09")) && matches!(pos, Some("E_1000"))
});
ConditionResult::from(found)
}
/// [46] Wenn AJT+A06+E_0552 vorhanden
fn evaluate_46(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
let found = ajts.iter().any(|s| {
let code = s
.elements
.first()
.and_then(|e| e.first())
.map(|v| v.as_str());
let pos = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|v| v.as_str());
matches!(code, Some("A06")) && matches!(pos, Some("E_0552"))
});
ConditionResult::from(found)
}
/// [47] Wenn AJT+A06+E_0553 vorhanden
fn evaluate_47(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
let found = ajts.iter().any(|s| {
let code = s
.elements
.first()
.and_then(|e| e.first())
.map(|v| v.as_str());
let pos = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|v| v.as_str());
matches!(code, Some("A06")) && matches!(pos, Some("E_0553"))
});
ConditionResult::from(found)
}
/// [48] Wenn AJT+A06+E_0554 vorhanden
fn evaluate_48(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
let found = ajts.iter().any(|s| {
let code = s
.elements
.first()
.and_then(|e| e.first())
.map(|v| v.as_str());
let pos = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|v| v.as_str());
matches!(code, Some("A06")) && matches!(pos, Some("E_0554"))
});
ConditionResult::from(found)
}
/// [49] nur, wenn in ursprünglicher Nachricht IMD++Z60 (Abbestellung Messprodukt mit Zählzeitdefinition des LF) vorhanden war
/// EXTERNAL: Requires context from outside the message.
fn evaluate_49(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("original_order_had_imd_z60")
}
/// [50] wenn im DE3155 in demselben COM der Code EM vorhanden ist
fn evaluate_50(&self, ctx: &EvaluationContext) -> ConditionResult {
let coms = ctx.find_segments("COM");
ConditionResult::from(coms.iter().any(|s| {
s.elements
.first()
.and_then(|e| e.get(1))
.map(|v| v == "EM")
.unwrap_or(false)
}))
}
/// [51] wenn im DE3155 in demselben COM der Code TE / FX / AJ / AL vorhanden ist
fn evaluate_51(&self, ctx: &EvaluationContext) -> ConditionResult {
let coms = ctx.find_segments("COM");
ConditionResult::from(coms.iter().any(|s| {
matches!(
s.elements
.first()
.and_then(|e| e.get(1))
.map(|v| v.as_str()),
Some("TE") | Some("FX") | Some("AJ") | Some("AL")
)
}))
}
/// [53] Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z59
fn evaluate_53(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z59 — informational note about value origin, always applies
ConditionResult::True
}
/// [54] Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z80
fn evaluate_54(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z80 — informational note about value origin, always applies
ConditionResult::True
}
/// [55] Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z81
fn evaluate_55(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z81 — informational note about value origin, always applies
ConditionResult::True
}
/// [56] wenn SG2 AJT+A02/A03/A06/A07/A10/A11+E_0548 vorhanden
fn evaluate_56(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
ConditionResult::from(ajts.iter().any(|s| {
let de4465 = s
.elements
.first()
.and_then(|e| e.first())
.map(|s| s.as_str());
let de1082 = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|s| s.as_str());
matches!(
de4465,
Some("A02") | Some("A03") | Some("A06") | Some("A07") | Some("A10") | Some("A11")
) && de1082 == Some("E_0548")
}))
}
/// [57] wenn SG2 AJT+A02/A03/A06/A07/A10/A11+E_0549 vorhanden
fn evaluate_57(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
ConditionResult::from(ajts.iter().any(|s| {
let de4465 = s
.elements
.first()
.and_then(|e| e.first())
.map(|s| s.as_str());
let de1082 = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|s| s.as_str());
matches!(
de4465,
Some("A02") | Some("A03") | Some("A06") | Some("A07") | Some("A10") | Some("A11")
) && de1082 == Some("E_0549")
}))
}
/// [58] wenn SG2 AJT+A02/A03/A06/A07+E_0550 vorhanden
fn evaluate_58(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
ConditionResult::from(ajts.iter().any(|s| {
let de4465 = s
.elements
.first()
.and_then(|e| e.first())
.map(|s| s.as_str());
let de1082 = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|s| s.as_str());
matches!(
de4465,
Some("A02") | Some("A03") | Some("A06") | Some("A07")
) && de1082 == Some("E_0550")
}))
}
/// [59] wenn SG2 AJT+A02/A03/A06/A07/A10/A11+E_0551 vorhanden
fn evaluate_59(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
ConditionResult::from(ajts.iter().any(|s| {
let de4465 = s
.elements
.first()
.and_then(|e| e.first())
.map(|s| s.as_str());
let de1082 = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|s| s.as_str());
matches!(
de4465,
Some("A02") | Some("A03") | Some("A06") | Some("A07") | Some("A10") | Some("A11")
) && de1082 == Some("E_0551")
}))
}
/// [61] wenn es sich bei der Reklamation um die Reklamation der Übersicht der Schaltzeitdefinitionen handelte
// REVIEW: The condition checks whether the complaint concerned the overview of switching time definitions (Schaltzeitdefinitionen). Condition 63 establishes that BGM+Z60 is the code for Schaltzeitdefinitionen in UTILTS, and the ORDRSP BGM code mirrors this type. Checking BGM elements[0][0] == 'Z60' identifies this complaint type. (medium confidence)
fn evaluate_61(&self, ctx: &EvaluationContext) -> ConditionResult {
// Reklamation der Übersicht der Schaltzeitdefinitionen → ORDRSP with BGM+Z60
ctx.has_qualifier("BGM", 0, "Z60")
}
/// [62] wenn es sich bei der Reklamation um die Reklamation der Übersicht der Leistungskurvendefinitionen handelte
// REVIEW: The condition checks whether the complaint concerned the overview of load curve definitions (Leistungskurvendefinitionen). Conditions 64 and 65 establish BGM+Z78 and BGM+Z79 as the two related UTILTS codes for Leistungskurven types, so both are checked. (medium confidence)
fn evaluate_62(&self, ctx: &EvaluationContext) -> ConditionResult {
// Reklamation der Übersicht der Leistungskurvendefinitionen → BGM+Z78 or BGM+Z79
let bgm_segs = ctx.find_segments("BGM");
match bgm_segs.first() {
Some(s) => {
let code = s
.elements
.first()
.and_then(|e| e.first())
.map(|v| v.as_str());
ConditionResult::from(matches!(code, Some("Z78") | Some("Z79")))
}
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [63] Dokumentennummer aus BGM+Z60 DE1004 der UTILTS
fn evaluate_63(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Dokumentennummer aus BGM+Z60 DE1004 der UTILTS — informational note, always applies
ConditionResult::True
}
/// [64] Dokumentennummer aus BGM+Z78 DE1004 der UTILTS
fn evaluate_64(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Dokumentennummer aus BGM+Z78 DE1004 der UTILTS — informational note, always applies
ConditionResult::True
}
/// [65] Dokumentennummer aus BGM+Z79 DE1004 der UTILTS
fn evaluate_65(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Dokumentennummer aus BGM+Z79 DE1004 der UTILTS — informational note, always applies
ConditionResult::True
}
/// [66] wenn SG2 AJT+A01/A02/A03+E_0544 vorhanden
fn evaluate_66(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
ConditionResult::from(ajts.iter().any(|s| {
let de4465 = s
.elements
.first()
.and_then(|e| e.first())
.map(|s| s.as_str());
let de1082 = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|s| s.as_str());
matches!(de4465, Some("A01") | Some("A02") | Some("A03")) && de1082 == Some("E_0544")
}))
}
/// [67] wenn SG2 AJT+A01/A02/A03+E_0545 vorhanden
fn evaluate_67(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
ConditionResult::from(ajts.iter().any(|s| {
let de4465 = s
.elements
.first()
.and_then(|e| e.first())
.map(|s| s.as_str());
let de1082 = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|s| s.as_str());
matches!(de4465, Some("A01") | Some("A02") | Some("A03")) && de1082 == Some("E_0545")
}))
}
/// [68] wenn SG2 AJT+A02/A03+E_0546 vorhanden
fn evaluate_68(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
ConditionResult::from(ajts.iter().any(|s| {
let de4465 = s
.elements
.first()
.and_then(|e| e.first())
.map(|s| s.as_str());
let de1082 = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|s| s.as_str());
matches!(de4465, Some("A02") | Some("A03")) && de1082 == Some("E_0546")
}))
}
/// [69] wenn SG2 AJT+A01/A02/A03+E_0547 vorhanden
fn evaluate_69(&self, ctx: &EvaluationContext) -> ConditionResult {
let ajts = ctx.find_segments("AJT");
ConditionResult::from(ajts.iter().any(|s| {
let de4465 = s
.elements
.first()
.and_then(|e| e.first())
.map(|s| s.as_str());
let de1082 = s
.elements
.get(1)
.and_then(|e| e.first())
.map(|s| s.as_str());
matches!(de4465, Some("A01") | Some("A02") | Some("A03")) && de1082 == Some("E_0547")
}))
}
/// [72] wenn AJT+A04+E_0552 vorhanden
fn evaluate_72(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualified_value("AJT", 0, "A04", 1, 0, &["E_0552"])
}
/// [73] wenn AJT+A04+E_0553 vorhanden
fn evaluate_73(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualified_value("AJT", 0, "A04", 1, 0, &["E_0553"])
}
/// [74] wenn AJT+A04+E_0554 vorhanden
fn evaluate_74(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.has_qualified_value("AJT", 0, "A04", 1, 0, &["E_0554"])
}
/// [76] Wenn FTX+Z27 (IP-Adresse des Absenders) nicht vorhanden
fn evaluate_76(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.lacks_qualifier("FTX", 0, "Z27")
}
/// [77] Wenn FTX+Z28 (IP-Range des Absenders) nicht vorhanden
fn evaluate_77(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.lacks_qualifier("FTX", 0, "Z28")
}
/// [492] wenn MP-ID in NAD+MR aus Sparte Strom
/// EXTERNAL: Requires context from outside the message.
fn evaluate_492(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("recipient_is_strom")
}
/// [493] wenn MP-ID in NAD+MR aus Sparte Gas
/// EXTERNAL: Requires context from outside the message.
fn evaluate_493(&self, ctx: &EvaluationContext) -> ConditionResult {
ctx.external.evaluate("recipient_is_gas")
}
/// [494] Das hier genannte Datum muss der Zeitpunkt sein, zu dem das Dokument erstellt wurde, oder ein Zeitpunkt, der davor liegt.
// REVIEW: 'Das hier genannte Datum muss der Zeitpunkt sein, zu dem das Dokument erstellt wurde, oder ein Zeitpunkt, der davor liegt.' This is a constraint description stating the date must be the document creation time or earlier. It functions as an unconditional validation rule (always applies) rather than a conditional trigger. Without knowing which specific DTM qualifier 'here' refers to in the calling context, and since the constraint itself is always applicable, returning True is appropriate. (medium confidence)
fn evaluate_494(&self, _ctx: &EvaluationContext) -> ConditionResult {
ConditionResult::True
}
/// [500] Hinweis: Angabe eines technischen Ansprechpartners für die Geräteübernahme
fn evaluate_500(&self, _ctx: &EvaluationContext) -> ConditionResult {
ConditionResult::True
}
/// [503] Hinweis: Datum, bis zu dem der MSBA zur Fortführung verpflichtet wurde
fn evaluate_503(&self, _ctx: &EvaluationContext) -> ConditionResult {
ConditionResult::True
}
/// [504] Hinweis: Ggf. korrigiert bei einer Zeitangabe in der ORDERS, die außerhalb des max. möglichen Weiterverpflichtungszeitraums ist. Als Antwort wird dann in SG2 AJT Zustimmung mit Terminänderung an...
fn evaluate_504(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Ggf. korrigiert bei einer Zeitangabe in der ORDERS, die außerhalb des max. möglichen Weiterverpflichtungszeitraums ist. Als Antwort wird dann in SG2 AJT Zustimmung mit Terminänderung angegeben.
ConditionResult::True
}
/// [513] Hinweis: Wert aus BGM+Z12 DE1004 der ORDERS, mit der die Bestellung erfolgt ist.
fn evaluate_513(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z12 DE1004 der ORDERS, mit der die Bestellung erfolgt ist.
ConditionResult::True
}
/// [518] Hinweis: Wert aus BGM+Z10 DE1004 der ORDERS, mit der die Bestellung erfolgt ist
fn evaluate_518(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z10 DE1004 der ORDERS, mit der die Bestellung erfolgt ist.
ConditionResult::True
}
/// [519] Hinweis: Wert aus BGM+7 DE1004 der ORDERS, mit der die Bestellung erfolgt ist.
fn evaluate_519(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+7 DE1004 der ORDERS, mit der die Bestellung erfolgt ist.
ConditionResult::True
}
/// [520] Hinweis: Wert aus BGM+Z29 DE1004 der ORDERS, mit der die Anfrage zur Beendigung der Rechnungsabwicklung erfolgt ist.
fn evaluate_520(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z29 DE1004 der ORDERS, mit der die Anfrage zur Beendigung der Rechnungsabwicklung erfolgt ist.
ConditionResult::True
}
/// [521] Hinweis: Wert aus BGM+Z14/Z61/Z62 DE1004 der ORDERS, mit der die Anforderung von Stammdaten erfolgt ist
fn evaluate_521(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z14/Z61/Z62 DE1004 der ORDERS, mit der die Anforderung von Stammdaten erfolgt ist
// Informational note — documents that the BGM DE1004 value originates from the original ORDERS request.
ConditionResult::True
}
/// [522] Hinweis: Wert aus BGM+7/Z28/Z48 DE1004 der ORDERS, mit der die Anforderung von Werten erfolgt ist.
fn evaluate_522(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+7/Z28/Z48 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [523] Hinweis: Wert aus BGM+7 DE1004 der ORDERS, mit der die Anforderung Anforderung von Brennwert und Zustandszahl erfolgt ist.
fn evaluate_523(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+7 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [524] Hinweis: Wert aus BGM+Z14 DE1004 der ORDERS, mit der die Anfrage vom MSB Gas erfolgt ist.
fn evaluate_524(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z14 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [525] Hinweis: Wert aus BGM+Z24 DE1004 der ORDERS, mit der die Anforderung Allokationsliste erfolgt ist
fn evaluate_525(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z24 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [526] Hinweis: Wert aus BGM+Z23 DE1004 der ORDERS, mit der die Anforderung bilanzierte Menge erfolgt ist
fn evaluate_526(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z23 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [527] Hinweis: Wert aus BGM+Z34 DE1004 der ORDERS, mit der die Reklamation von Werten erfolgt ist.
fn evaluate_527(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z34 DE1004 der ORDERS, mit der die Reklamation von Werten erfolgt ist. — informational note, always applies
ConditionResult::True
}
/// [529] Hinweis: Dokumentennummer aus BGM DE1004 der ORDERS
fn evaluate_529(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Dokumentennummer aus BGM DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [530] Hinweis: Dokumentennummer aus BGM DE1004 der ORDCHG
fn evaluate_530(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Dokumentennummer aus BGM DE1004 der ORDCHG — informational note, always applies
ConditionResult::True
}
/// [533] Hinweis: Wert aus BGM+Z51 DE1004 der ORDCHG
fn evaluate_533(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z51 DE1004 der ORDCHG — informational note, always applies
ConditionResult::True
}
/// [534] Hinweis: Wert aus BGM+Z52 DE1004 der ORDCHG
fn evaluate_534(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z52 DE1004 der ORDCHG — informational note, always applies
ConditionResult::True
}
/// [535] Hinweis: Wert aus BGM+Z13 DE1004 der ORDERS, mit der die Ankündigung Gerätewechselabsicht erfolgt ist.
fn evaluate_535(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z13 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [536] Hinweis: Es ist die MP-ID des Eigentümers (MSB) zur bilateralen Klärung anzugeben, wenn der angefragte MSB nicht selber der Eigentümer ist.
fn evaluate_536(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: MP-ID des Eigentümers (MSB) angeben — informational note, always applies
ConditionResult::True
}
/// [537] Hinweis: Wert aus BGM+Z72 DE1004 der ORDERS, mit der die Bestellung Beendigung der Konfiguration erfolgt ist.
fn evaluate_537(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z72 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [538] Hinweis: Wert aus BGM+Z76 DE1004 der ORDERS, mit der die Reklamation der Konfiguration erfolgt ist.
fn evaluate_538(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z76 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [539] Hinweis: Wert aus BGM+Z73/Z74 DE1004 der ORDERS, mit der die Bestellung der Konfiguration erfolgt ist.
fn evaluate_539(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z73/Z74 DE1004 der ORDERS — informational note, always applies
ConditionResult::True
}
/// [540] Hinweis: Es darf nur eine Information im DE3148 übermittelt werden
fn evaluate_540(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Es darf nur eine Information im DE3148 übermittelt werden — informational note, always applies
ConditionResult::True
}
/// [542] Hinweis: Wert aus BGM+Z91 DE1004 der ORDERS, mit der die Bestellung Änderung der Abrechnungsdaten erfolgt ist.
fn evaluate_542(&self, _ctx: &EvaluationContext) -> ConditionResult {
// Hinweis: Wert aus BGM+Z91 DE1004 der ORDERS — informational note about value origin, always applies
ConditionResult::True
}
/// [902] Format: Format: Möglicher Wert: ≥ 0
// REVIEW: Format condition requiring numeric value >= 0. Applied to QTY segment value (elements[0][1]) by convention matching the example pattern. Medium confidence because the exact segment this applies to is not specified in the condition text, but QTY is the standard target for quantity format conditions. (medium confidence)
fn evaluate_902(&self, ctx: &EvaluationContext) -> ConditionResult {
// Format: Möglicher Wert: >= 0
let segs = ctx.find_segments("QTY");
match segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => validate_numeric(val, ">=", 0.0),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [903] Format: Möglicher Wert: 1
// REVIEW: Format condition requiring the value to equal exactly 1. Applied to QTY segment value (elements[0][1]) by convention. Medium confidence as the exact target segment is not stated, but QTY quantity value is the standard target for this kind of format constraint. (medium confidence)
fn evaluate_903(&self, ctx: &EvaluationContext) -> ConditionResult {
// Format: Möglicher Wert: 1
let segs = ctx.find_segments("QTY");
match segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => validate_numeric(val, "==", 1.0),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [930] Format: max. 2 Nachkommastellen
// REVIEW: Format condition requiring at most 2 decimal places. Applied to QTY segment value (elements[0][1]) following the standard pattern from example 19. Medium confidence as the exact target segment is not specified in the condition text, but QTY quantity value is the canonical target for decimal place constraints. (medium confidence)
fn evaluate_930(&self, ctx: &EvaluationContext) -> ConditionResult {
// Format: max. 2 Nachkommastellen
let segs = ctx.find_segments("QTY");
match segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => validate_max_decimal_places(val, 2),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [931] Format: ZZZ = +00
fn evaluate_931(&self, ctx: &EvaluationContext) -> ConditionResult {
let dtm_segs = ctx.find_segments("DTM");
match dtm_segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => validate_timezone_utc(val),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [932] Format: HHMM = 2200
fn evaluate_932(&self, ctx: &EvaluationContext) -> ConditionResult {
let dtm_segs = ctx.find_segments("DTM");
match dtm_segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => validate_hhmm_equals(val, "2200"),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [933] Format: HHMM = 2300
fn evaluate_933(&self, ctx: &EvaluationContext) -> ConditionResult {
let dtm_segs = ctx.find_segments("DTM");
match dtm_segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => validate_hhmm_equals(val, "2300"),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [934] Format: HHMM = 0400
fn evaluate_934(&self, ctx: &EvaluationContext) -> ConditionResult {
let dtm_segs = ctx.find_segments("DTM");
match dtm_segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => validate_hhmm_equals(val, "0400"),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [935] Format: HHMM = 0500
fn evaluate_935(&self, ctx: &EvaluationContext) -> ConditionResult {
let dtm_segs = ctx.find_segments("DTM");
match dtm_segs
.first()
.and_then(|s| s.elements.first())
.and_then(|e| e.get(1))
{
Some(val) => validate_hhmm_equals(val, "0500"),
None => ConditionResult::False, // segment absent → condition not applicable
}
}
/// [939] Format: Die Zeichenkette muss die Zeichen @ und . enthalten
// REVIEW: Format condition checking that the string contains '@' and '.' — characteristic of an email address format requirement. Applied to COM segment with EM (Electronic Mail) qualifier where elements[0][0] is the address and elements[0][1] is the communication means type code. Returns Unknown when no COM+EM segment is found (condition not applicable). (medium confidence)
fn evaluate_939(&self, ctx: &EvaluationContext) -> ConditionResult {
// Format: string must contain '@' and '.' — email address format check
// Applied to COM segment with EM (Electronic Mail) qualifier
// COM+address:qualifier → elements[0] = ["address", "qualifier"]
let com_segs = ctx.find_segments("COM");
for seg in &com_segs {
if let Some(elem0) = seg.elements.first() {
if elem0.get(1).map(|q| q == "EM").unwrap_or(false) {
let value = elem0.first().map(|s| s.as_str()).unwrap_or("");
if value.is_empty() {
return ConditionResult::Unknown;
}
return ConditionResult::from(value.contains('@') && value.contains('.'));
}
}
}
ConditionResult::Unknown
}
/// [940] Format: Die Zeichenkette muss mit dem Zeichen + beginnen und danach dürfen nur noch Ziffern folgen
// REVIEW: Format condition checking that the string starts with '+' and contains only digits afterwards — the international phone number format (e.g. +4912345678). Applied to COM segments with phone-type qualifiers (TE=Telephone, FX=Telefax, AH=After Hours). Returns Unknown when no COM segment with a phone qualifier is found. Requires at least one digit after '+' (len > 1) since a bare '+' is not a valid phone number. (medium confidence)
fn evaluate_940(&self, ctx: &EvaluationContext) -> ConditionResult {
// Format: string must start with '+' and be followed only by digits — international phone number format
// Applied to COM segments with phone-type qualifiers: TE (Telephone), FX (Telefax), AH (After Hours)
// COM+number:qualifier → elements[0] = ["number", "qualifier"]
let com_segs = ctx.find_segments("COM");
for seg in &com_segs {
if let Some(elem0) = seg.elements.first() {
let qualifier = elem0.get(1).map(|s| s.as_str()).unwrap_or("");
if matches!(qualifier, "TE" | "FX" | "AH") {
let value = elem0.first().map(|s| s.as_str()).unwrap_or("");
if value.is_empty() {
return ConditionResult::Unknown;
}
return ConditionResult::from(
value.starts_with('+')
&& value.len() > 1
&& value[1..].chars().all(|c| c.is_ascii_digit()),
);
}
}
}
ConditionResult::Unknown
}
/// [2036] Pro Nachricht ist die SG27 genau einmal anzugeben
// REVIEW: Cardinality condition requiring SG27 to appear exactly once per message. SG27 is the transaction group (tx_group) in ORDRSP FV2504. Uses the group navigator to count SG27 instances at the top level. Falls back to Unknown when no navigator is available (e.g., when context is used without a pre-assembled tree). This is a structural cardinality rule rather than a content condition. (medium confidence)
fn evaluate_2036(&self, ctx: &EvaluationContext) -> ConditionResult {
// SG27 must appear exactly once per message
// SG27 is the transaction group (tx_group) in ORDRSP
if let Some(nav) = ctx.navigator() {
let count = nav.group_instance_count(&["SG27"]);
ConditionResult::from(count == 1)
} else {
ConditionResult::Unknown
}
}
}