Skip to main content

automapper_validation/generated/fv2510/
remadv_conditions_fv2510.rs

1// <auto-generated>
2// Generated by automapper-generator generate-conditions
3// AHB: xml-migs-and-ahbs/FV2510/REMADV_AHB_1_0__20250401.xml
4// Generated: 2026-03-12T10:35:55Z
5// </auto-generated>
6
7// LLM-produced bodies aren't idiomatic Rust — silence stylistic lints at
8// file scope so `cargo clippy -D warnings` stays green. Correctness,
9// suspicious, and perf categories stay on so real bugs still surface.
10#![allow(clippy::style, clippy::complexity)]
11
12#[allow(unused_imports)]
13use crate::eval::format_validators::*;
14use crate::eval::{Cluster, ConditionEvaluator, ConditionResult, EvaluationContext};
15// HAND-EDITED: shared cluster helpers for [14]/[15]/[16]/[517]/[518].
16// Preserve across regeneration — see CLAUDE.md "Codelist Providers".
17use crate::eval::ebd_cluster::{any_scoped_ajt_in_cluster, resolved_ajt_code_in_cluster};
18
19/// Generated condition evaluator for REMADV FV2510.
20pub struct RemadvConditionEvaluatorFV2510 {
21    // External condition IDs that require runtime context.
22    external_conditions: std::collections::HashSet<u32>,
23}
24
25impl Default for RemadvConditionEvaluatorFV2510 {
26    fn default() -> Self {
27        let mut external_conditions = std::collections::HashSet::new();
28        external_conditions.insert(45);
29        external_conditions.insert(492);
30        external_conditions.insert(493);
31        Self {
32            external_conditions,
33        }
34    }
35}
36
37impl ConditionEvaluator for RemadvConditionEvaluatorFV2510 {
38    fn message_type(&self) -> &str {
39        "REMADV"
40    }
41
42    fn format_version(&self) -> &str {
43        "FV2510"
44    }
45
46    fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
47        match condition {
48            2 => self.evaluate_2(ctx),
49            3 => self.evaluate_3(ctx),
50            4 => self.evaluate_4(ctx),
51            8 => self.evaluate_8(ctx),
52            9 => self.evaluate_9(ctx),
53            11 => self.evaluate_11(ctx),
54            12 => self.evaluate_12(ctx),
55            14 => self.evaluate_14(ctx),
56            15 => self.evaluate_15(ctx),
57            16 => self.evaluate_16(ctx),
58            18 => self.evaluate_18(ctx),
59            22 => self.evaluate_22(ctx),
60            26 => self.evaluate_26(ctx),
61            28 => self.evaluate_28(ctx),
62            33 => self.evaluate_33(ctx),
63            34 => self.evaluate_34(ctx),
64            35 => self.evaluate_35(ctx),
65            36 => self.evaluate_36(ctx),
66            39 => self.evaluate_39(ctx),
67            40 => self.evaluate_40(ctx),
68            41 => self.evaluate_41(ctx),
69            42 => self.evaluate_42(ctx),
70            43 => self.evaluate_43(ctx),
71            45 => self.evaluate_45(ctx),
72            47 => self.evaluate_47(ctx),
73            48 => self.evaluate_48(ctx),
74            49 => self.evaluate_49(ctx),
75            50 => self.evaluate_50(ctx),
76            51 => self.evaluate_51(ctx),
77            52 => self.evaluate_52(ctx),
78            53 => self.evaluate_53(ctx),
79            54 => self.evaluate_54(ctx),
80            55 => self.evaluate_55(ctx),
81            56 => self.evaluate_56(ctx),
82            57 => self.evaluate_57(ctx),
83            58 => self.evaluate_58(ctx),
84            59 => self.evaluate_59(ctx),
85            60 => self.evaluate_60(ctx),
86            61 => self.evaluate_61(ctx),
87            62 => self.evaluate_62(ctx),
88            63 => self.evaluate_63(ctx),
89            64 => self.evaluate_64(ctx),
90            65 => self.evaluate_65(ctx),
91            66 => self.evaluate_66(ctx),
92            67 => self.evaluate_67(ctx),
93            68 => self.evaluate_68(ctx),
94            69 => self.evaluate_69(ctx),
95            70 => self.evaluate_70(ctx),
96            71 => self.evaluate_71(ctx),
97            72 => self.evaluate_72(ctx),
98            73 => self.evaluate_73(ctx),
99            74 => self.evaluate_74(ctx),
100            75 => self.evaluate_75(ctx),
101            76 => self.evaluate_76(ctx),
102            77 => self.evaluate_77(ctx),
103            78 => self.evaluate_78(ctx),
104            79 => self.evaluate_79(ctx),
105            80 => self.evaluate_80(ctx),
106            81 => self.evaluate_81(ctx),
107            82 => self.evaluate_82(ctx),
108            83 => self.evaluate_83(ctx),
109            84 => self.evaluate_84(ctx),
110            85 => self.evaluate_85(ctx),
111            86 => self.evaluate_86(ctx),
112            87 => self.evaluate_87(ctx),
113            88 => self.evaluate_88(ctx),
114            89 => self.evaluate_89(ctx),
115            90 => self.evaluate_90(ctx),
116            91 => self.evaluate_91(ctx),
117            92 => self.evaluate_92(ctx),
118            93 => self.evaluate_93(ctx),
119            94 => self.evaluate_94(ctx),
120            95 => self.evaluate_95(ctx),
121            96 => self.evaluate_96(ctx),
122            97 => self.evaluate_97(ctx),
123            98 => self.evaluate_98(ctx),
124            99 => self.evaluate_99(ctx),
125            100 => self.evaluate_100(ctx),
126            101 => self.evaluate_101(ctx),
127            102 => self.evaluate_102(ctx),
128            103 => self.evaluate_103(ctx),
129            104 => self.evaluate_104(ctx),
130            105 => self.evaluate_105(ctx),
131            106 => self.evaluate_106(ctx),
132            107 => self.evaluate_107(ctx),
133            108 => self.evaluate_108(ctx),
134            109 => self.evaluate_109(ctx),
135            110 => self.evaluate_110(ctx),
136            111 => self.evaluate_111(ctx),
137            112 => self.evaluate_112(ctx),
138            113 => self.evaluate_113(ctx),
139            114 => self.evaluate_114(ctx),
140            115 => self.evaluate_115(ctx),
141            116 => self.evaluate_116(ctx),
142            117 => self.evaluate_117(ctx),
143            118 => self.evaluate_118(ctx),
144            119 => self.evaluate_119(ctx),
145            120 => self.evaluate_120(ctx),
146            492 => self.evaluate_492(ctx),
147            493 => self.evaluate_493(ctx),
148            501 => self.evaluate_501(ctx),
149            502 => self.evaluate_502(ctx),
150            503 => self.evaluate_503(ctx),
151            510 => self.evaluate_510(ctx),
152            511 => self.evaluate_511(ctx),
153            512 => self.evaluate_512(ctx),
154            515 => self.evaluate_515(ctx),
155            517 => self.evaluate_517(ctx),
156            518 => self.evaluate_518(ctx),
157            519 => self.evaluate_519(ctx),
158            520 => self.evaluate_520(ctx),
159            521 => self.evaluate_521(ctx),
160            523 => self.evaluate_523(ctx),
161            525 => self.evaluate_525(ctx),
162            526 => self.evaluate_526(ctx),
163            529 => self.evaluate_529(ctx),
164            533 => self.evaluate_533(ctx),
165            534 => self.evaluate_534(ctx),
166            535 => self.evaluate_535(ctx),
167            536 => self.evaluate_536(ctx),
168            537 => self.evaluate_537(ctx),
169            538 => self.evaluate_538(ctx),
170            544 => self.evaluate_544(ctx),
171            548 => self.evaluate_548(ctx),
172            549 => self.evaluate_549(ctx),
173            926 => self.evaluate_926(ctx),
174            930 => self.evaluate_930(ctx),
175            931 => self.evaluate_931(ctx),
176            939 => self.evaluate_939(ctx),
177            940 => self.evaluate_940(ctx),
178            _ => ConditionResult::Unknown,
179        }
180    }
181
182    fn is_external(&self, condition: u32) -> bool {
183        self.external_conditions.contains(&condition)
184    }
185    fn is_known(&self, condition: u32) -> bool {
186        matches!(
187            condition,
188            2 | 3
189                | 4
190                | 8
191                | 9
192                | 11
193                | 12
194                | 14
195                | 15
196                | 16
197                | 18
198                | 22
199                | 26
200                | 28
201                | 33
202                | 34
203                | 35
204                | 36
205                | 39
206                | 40
207                | 41
208                | 42
209                | 43
210                | 45
211                | 47
212                | 48
213                | 49
214                | 50
215                | 51
216                | 52
217                | 53
218                | 54
219                | 55
220                | 56
221                | 57
222                | 58
223                | 59
224                | 60
225                | 61
226                | 62
227                | 63
228                | 64
229                | 65
230                | 66
231                | 67
232                | 68
233                | 69
234                | 70
235                | 71
236                | 72
237                | 73
238                | 74
239                | 75
240                | 76
241                | 77
242                | 78
243                | 79
244                | 80
245                | 81
246                | 82
247                | 83
248                | 84
249                | 85
250                | 86
251                | 87
252                | 88
253                | 89
254                | 90
255                | 91
256                | 92
257                | 93
258                | 94
259                | 95
260                | 96
261                | 97
262                | 98
263                | 99
264                | 100
265                | 101
266                | 102
267                | 103
268                | 104
269                | 105
270                | 106
271                | 107
272                | 108
273                | 109
274                | 110
275                | 111
276                | 112
277                | 113
278                | 114
279                | 115
280                | 116
281                | 117
282                | 118
283                | 119
284                | 120
285                | 492
286                | 493
287                | 501
288                | 502
289                | 503
290                | 510
291                | 511
292                | 512
293                | 515
294                | 517
295                | 518
296                | 519
297                | 520
298                | 521
299                | 523
300                | 525
301                | 526
302                | 529
303                | 533
304                | 534
305                | 535
306                | 536
307                | 537
308                | 538
309                | 544
310                | 548
311                | 549
312                | 926
313                | 930
314                | 931
315                | 939
316                | 940
317        )
318    }
319}
320
321impl RemadvConditionEvaluatorFV2510 {
322    /// [45] Nur MP-ID aus Sparte Strom
323    /// EXTERNAL: Requires context from outside the message.
324    fn evaluate_45(&self, ctx: &EvaluationContext) -> ConditionResult {
325        ctx.external.evaluate("mp_id_is_strom")
326    }
327
328    /// [49] Wenn in dieser SG7 AJT DE4465 = A01/A05/A22/A23/A90/A96
329    fn evaluate_49(&self, ctx: &EvaluationContext) -> ConditionResult {
330        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
331        ctx.this_group_has_any_qualifier(
332            "AJT",
333            0,
334            &["A01", "A05", "A22", "A23", "A90", "A96"],
335            &["SG7"],
336        )
337    }
338
339    /// [50] Wenn in dieser SG7 AJT DE4465 = A01/A05/A18/A19/A20/A90/A96
340    fn evaluate_50(&self, ctx: &EvaluationContext) -> ConditionResult {
341        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
342        ctx.this_group_has_any_qualifier(
343            "AJT",
344            0,
345            &["A01", "A05", "A18", "A19", "A20", "A90", "A96"],
346            &["SG7"],
347        )
348    }
349
350    /// [59] Wenn SG7 AJT+A08/A99+E_0459 vorhanden
351    fn evaluate_59(&self, ctx: &EvaluationContext) -> ConditionResult {
352        {
353            let ajt_segs = ctx.find_segments("AJT");
354            let found = ajt_segs.iter().any(|s| {
355                let qual = s
356                    .elements
357                    .first()
358                    .and_then(|e| e.first())
359                    .map(|v| v.as_str());
360                let pos = s
361                    .elements
362                    .get(1)
363                    .and_then(|e| e.first())
364                    .map(|v| v.as_str());
365                matches!(qual, Some("A08") | Some("A99")) && pos == Some("E_0459")
366            });
367            ConditionResult::from(found)
368        }
369    }
370
371    /// [96] Wenn SG7 AJT+E_0503/E_1007 vorhanden
372    fn evaluate_96(&self, ctx: &EvaluationContext) -> ConditionResult {
373        ctx.any_group_has_any_qualifier("AJT", 0, &["E_0503", "E_1007"], &["SG7"])
374    }
375
376    /// [100] Wenn SG7 AJT+A01 vorhanden
377    fn evaluate_100(&self, ctx: &EvaluationContext) -> ConditionResult {
378        ctx.any_group_has_qualifier("AJT", 0, "A01", &["SG5", "SG7"])
379    }
380
381    /// [105] Wenn in diesem AJT DE1082 = E_0270
382    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0270'. 'In diesem AJT' refers to the current AJT context; without per-segment scope, we search all AJT segments. E_0270 appears in the SG12 AJT code list. Returns Unknown if no AJT segments exist. (medium confidence)
383    fn evaluate_105(&self, ctx: &EvaluationContext) -> ConditionResult {
384        let segs = ctx.find_segments("AJT");
385        if segs.is_empty() {
386            return ConditionResult::Unknown;
387        }
388        ConditionResult::from(segs.iter().any(|s| {
389            s.elements
390                .get(1)
391                .and_then(|e| e.first())
392                .is_some_and(|v| v == "E_0270")
393        }))
394    }
395
396    /// [106] Wenn in diesem AJT DE1082 = E_0273
397    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0273'. Same pattern as condition 105. (medium confidence)
398    fn evaluate_106(&self, ctx: &EvaluationContext) -> ConditionResult {
399        let segs = ctx.find_segments("AJT");
400        if segs.is_empty() {
401            return ConditionResult::Unknown;
402        }
403        ConditionResult::from(segs.iter().any(|s| {
404            s.elements
405                .get(1)
406                .and_then(|e| e.first())
407                .is_some_and(|v| v == "E_0273")
408        }))
409    }
410
411    /// [107] Wenn in diesem AJT DE1082 = E_0276
412    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0276'. Same pattern as condition 105. (medium confidence)
413    fn evaluate_107(&self, ctx: &EvaluationContext) -> ConditionResult {
414        let segs = ctx.find_segments("AJT");
415        if segs.is_empty() {
416            return ConditionResult::Unknown;
417        }
418        ConditionResult::from(segs.iter().any(|s| {
419            s.elements
420                .get(1)
421                .and_then(|e| e.first())
422                .is_some_and(|v| v == "E_0276")
423        }))
424    }
425
426    /// [108] Wenn in diesem AJT DE1082 = E_0277
427    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0277'. Same pattern as condition 105. (medium confidence)
428    fn evaluate_108(&self, ctx: &EvaluationContext) -> ConditionResult {
429        let segs = ctx.find_segments("AJT");
430        if segs.is_empty() {
431            return ConditionResult::Unknown;
432        }
433        ConditionResult::from(segs.iter().any(|s| {
434            s.elements
435                .get(1)
436                .and_then(|e| e.first())
437                .is_some_and(|v| v == "E_0277")
438        }))
439    }
440
441    /// [109] Wenn in dieser SG7 AJT DE4465 = A01/A21/A22/A23/A90/A96
442    fn evaluate_109(&self, ctx: &EvaluationContext) -> ConditionResult {
443        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
444        ctx.this_group_has_any_qualifier(
445            "AJT",
446            0,
447            &["A01", "A21", "A22", "A23", "A90", "A96"],
448            &["SG7"],
449        )
450    }
451
452    /// [110] Wenn in dieser SG7 AJT DE1082 = E_0270
453    fn evaluate_110(&self, ctx: &EvaluationContext) -> ConditionResult {
454        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
455        ctx.this_group_has_qualifier("AJT", 1, "E_0270", &["SG7"])
456    }
457
458    /// [111] Wenn in dieser SG7 AJT DE1082 = E_0273
459    fn evaluate_111(&self, ctx: &EvaluationContext) -> ConditionResult {
460        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
461        ctx.this_group_has_qualifier("AJT", 1, "E_0273", &["SG7"])
462    }
463
464    /// [112] Wenn in dieser SG7 AJT DE1082 = E_0276
465    fn evaluate_112(&self, ctx: &EvaluationContext) -> ConditionResult {
466        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
467        ctx.this_group_has_qualifier("AJT", 1, "E_0276", &["SG7"])
468    }
469
470    /// [113] Wenn in dieser SG7 AJT DE1082 = E_0277
471    fn evaluate_113(&self, ctx: &EvaluationContext) -> ConditionResult {
472        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
473        ctx.this_group_has_qualifier("AJT", 1, "E_0277", &["SG7"])
474    }
475
476    /// [114] Wenn in dieser SG12 AJT DE1082 = E_0270
477    fn evaluate_114(&self, ctx: &EvaluationContext) -> ConditionResult {
478        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
479        ctx.this_group_has_qualified_value("AJT", 1, "E_0270", 1, 0, &["E_0270"], &["SG5", "SG12"])
480    }
481
482    /// [115] Wenn in dieser SG12 AJT DE1082 = E_0273
483    fn evaluate_115(&self, ctx: &EvaluationContext) -> ConditionResult {
484        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
485        ctx.this_group_has_qualified_value("AJT", 1, "E_0273", 1, 0, &["E_0273"], &["SG5", "SG12"])
486    }
487
488    /// [116] Wenn in dieser SG12 AJT DE1082 = E_0276
489    fn evaluate_116(&self, ctx: &EvaluationContext) -> ConditionResult {
490        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
491        ctx.this_group_has_qualified_value("AJT", 1, "E_0276", 1, 0, &["E_0276"], &["SG5", "SG12"])
492    }
493
494    /// [117] Wenn in dieser SG12 AJT DE1082 = E_0277
495    fn evaluate_117(&self, ctx: &EvaluationContext) -> ConditionResult {
496        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
497        ctx.this_group_has_qualified_value("AJT", 1, "E_0277", 1, 0, &["E_0277"], &["SG5", "SG12"])
498    }
499
500    /// [118] Wenn SG7 AJT+A99+E_0272 vorhanden
501    fn evaluate_118(&self, ctx: &EvaluationContext) -> ConditionResult {
502        ctx.has_segment_matching_in_group("AJT", &[(0, 0, "A99"), (1, 0, "E_0272")], &["SG7"])
503    }
504
505    /// [119] Wenn SG7 AJT+A99+E_0275 vorhanden
506    fn evaluate_119(&self, ctx: &EvaluationContext) -> ConditionResult {
507        ctx.has_segment_matching_in_group("AJT", &[(0, 0, "A99"), (1, 0, "E_0275")], &["SG7"])
508    }
509
510    /// [120] Wenn in dieser SG7 AJT DE4465 = A01
511    fn evaluate_120(&self, ctx: &EvaluationContext) -> ConditionResult {
512        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
513        ctx.this_group_has_qualifier("AJT", 0, "A01", &["SG7"])
514    }
515
516    /// [544] Hinweis: Wenn in dieser SG7 AJT DE4465 = A21 vorhanden, dann darf in den DE4440 dieses FTX-Segments jeweils nur eine Positionsnummer genannt sein, welche aus dem bestätigten Angebot nicht in der R...
517    fn evaluate_544(&self, _ctx: &EvaluationContext) -> ConditionResult {
518        // Hinweis: Wenn AJT DE4465 = A21 vorhanden, dann darf in den DE4440 dieses FTX-Segments jeweils nur eine Positionsnummer genannt sein, welche aus dem bestätigten Angebot nicht in der Rechnung enthalten sind — informational note, always applies
519        ConditionResult::True
520    }
521
522    /// [2] Wenn SG7 AJT+28 vorhanden
523    fn evaluate_2(&self, ctx: &EvaluationContext) -> ConditionResult {
524        ctx.any_group_has_qualifier("AJT", 0, "28", &["SG7"])
525    }
526
527    /// [3] Bei SG5 DOC+389 / Z25 ist der Wert aus derselben SG5 MOA+9 mit (-1) multipliziert anzugeben.
528    fn evaluate_3(&self, _ctx: &EvaluationContext) -> ConditionResult {
529        // Hinweis: Bei SG5 DOC+389/Z25 ist der Wert aus derselben SG5 MOA+9 mit (-1) multipliziert anzugeben.
530        // Informational annotation describing the calculation rule for MOA+12 (Überweisungsbetrag).
531        ConditionResult::True
532    }
533
534    /// [4] Bei SG5 DOC+380 / 457 ist der Wert aus derselben SG5 MOA+9 unverändert anzugeben.
535    fn evaluate_4(&self, _ctx: &EvaluationContext) -> ConditionResult {
536        // Hinweis: Bei SG5 DOC+380/457 ist der Wert aus derselben SG5 MOA+9 unverändert anzugeben.
537        // Informational annotation describing that MOA+12 (Überweisungsbetrag) equals MOA+9 unchanged.
538        ConditionResult::True
539    }
540
541    /// [8] Wenn SG7 AJT+A01/A02+E_0505 vorhanden
542    fn evaluate_8(&self, ctx: &EvaluationContext) -> ConditionResult {
543        let ajts = ctx.find_segments("AJT");
544        let found = ajts.iter().any(|s| {
545            let elem0 = s
546                .elements
547                .first()
548                .and_then(|e| e.first())
549                .map(|s| s.as_str())
550                .unwrap_or("");
551            let elem1 = s
552                .elements
553                .get(1)
554                .and_then(|e| e.first())
555                .map(|s| s.as_str())
556                .unwrap_or("");
557            (elem0 == "A01" || elem0 == "A02") && elem1 == "E_0505"
558        });
559        ConditionResult::from(found)
560    }
561
562    /// [9] Wenn SG7 AJT+A32/A99+E_0503 vorhanden
563    fn evaluate_9(&self, ctx: &EvaluationContext) -> ConditionResult {
564        let ajts = ctx.find_segments("AJT");
565        let found = ajts.iter().any(|s| {
566            let elem0 = s
567                .elements
568                .first()
569                .and_then(|e| e.first())
570                .map(|s| s.as_str())
571                .unwrap_or("");
572            let elem1 = s
573                .elements
574                .get(1)
575                .and_then(|e| e.first())
576                .map(|s| s.as_str())
577                .unwrap_or("");
578            (elem0 == "A32" || elem0 == "A99") && elem1 == "E_0503"
579        });
580        ConditionResult::from(found)
581    }
582
583    /// [11] Wenn in diesem AJT DE1082 = E_0406
584    // REVIEW: Check if AJT has DE1082 (elements[1][0]) == E_0406. 'In diesem AJT' implies same-segment context; message-wide fallback via has_qualifier is the safe approximation without per-instance scoping. (medium confidence)
585    fn evaluate_11(&self, ctx: &EvaluationContext) -> ConditionResult {
586        ctx.has_qualifier("AJT", 1, "E_0406")
587    }
588
589    /// [12] Wenn in diesem AJT DE1082 = E_0407
590    // REVIEW: Check if AJT has DE1082 (elements[1][0]) == E_0407. Same pattern as condition 11. (medium confidence)
591    fn evaluate_12(&self, ctx: &EvaluationContext) -> ConditionResult {
592        ctx.has_qualifier("AJT", 1, "E_0407")
593    }
594
595    /// [14] A-Code aus Cluster Ablehnung auf Kopfebene
596    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
597    fn evaluate_14(&self, ctx: &EvaluationContext) -> ConditionResult {
598        resolved_ajt_code_in_cluster(ctx, Cluster::is_ablehnung_kopfebene)
599    }
600
601    /// [15] A-Code aus Cluster Ablehnung auf Positionsebene
602    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
603    fn evaluate_15(&self, ctx: &EvaluationContext) -> ConditionResult {
604        resolved_ajt_code_in_cluster(ctx, Cluster::is_ablehnung_positionsebene)
605    }
606
607    /// [16] A-Code aus Cluster Ablehnung auf Summenebene
608    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
609    fn evaluate_16(&self, ctx: &EvaluationContext) -> ConditionResult {
610        resolved_ajt_code_in_cluster(ctx, Cluster::is_ablehnung_summenebene)
611    }
612
613    /// [18] Wenn in dieser SG7 AJT DE4465 = A74/A75/A76/AC5
614    fn evaluate_18(&self, ctx: &EvaluationContext) -> ConditionResult {
615        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
616        ctx.this_group_has_any_qualifier("AJT", 0, &["A74", "A75", "A76", "AC5"], &["SG7"])
617    }
618
619    /// [22] Wenn in dieser SG7 AJT DE4465 = A02/A06/A16/A66/A67/A68/A69/A78/A90/A95/A96/AC3/AC4
620    fn evaluate_22(&self, ctx: &EvaluationContext) -> ConditionResult {
621        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
622        ctx.this_group_has_any_qualifier(
623            "AJT",
624            0,
625            &[
626                "A02", "A06", "A16", "A66", "A67", "A68", "A69", "A78", "A90", "A95", "A96", "AC3",
627                "AC4",
628            ],
629            &["SG7"],
630        )
631    }
632
633    /// [26] Wenn in dieser SG12 AJT DE4465 = A51/A62/A82/AA1/AA6/AA7/AB8/AD6
634    fn evaluate_26(&self, ctx: &EvaluationContext) -> ConditionResult {
635        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
636        ctx.this_group_has_any_qualifier(
637            "AJT",
638            0,
639            &["A51", "A62", "A82", "AA1", "AA6", "AA7", "AB8", "AD6"],
640            &["SG12"],
641        )
642    }
643
644    /// [28] Wenn in dieser SG12 AJT DE4465 = A23/A26/A35/A36/A38/A46/A47/A48/A50/A58/A59/A61/A77/A84/A99
645    fn evaluate_28(&self, ctx: &EvaluationContext) -> ConditionResult {
646        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
647        ctx.this_group_has_any_qualifier(
648            "AJT",
649            0,
650            &[
651                "A23", "A26", "A35", "A36", "A38", "A46", "A47", "A48", "A50", "A58", "A59", "A61",
652                "A77", "A84", "A99",
653            ],
654            &["SG12"],
655        )
656    }
657
658    /// [33] Wenn in diesem AJT DE1082 = S_0103
659    // REVIEW: Check if AJT has DE1082 (elements[1][0]) == S_0103. 'In diesem AJT' scoping approximated by message-wide check via has_qualifier. (medium confidence)
660    fn evaluate_33(&self, ctx: &EvaluationContext) -> ConditionResult {
661        ctx.has_qualifier("AJT", 1, "S_0103")
662    }
663
664    /// [34] Wenn in diesem AJT DE1082 = S_0104
665    fn evaluate_34(&self, ctx: &EvaluationContext) -> ConditionResult {
666        ctx.has_qualifier("AJT", 1, "S_0104")
667    }
668
669    /// [35] Wenn in dieser SG12 AJT DE4465 = A34/A39/AA2/AB2
670    fn evaluate_35(&self, ctx: &EvaluationContext) -> ConditionResult {
671        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
672        ctx.this_group_has_any_qualifier("AJT", 0, &["A34", "A39", "AA2", "AB2"], &["SG12"])
673    }
674
675    /// [36] Wenn in dieser SG7 AJT DE4465 = A12/A75/A80/AE1
676    fn evaluate_36(&self, ctx: &EvaluationContext) -> ConditionResult {
677        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
678        ctx.this_group_has_any_qualifier("AJT", 0, &["A12", "A75", "A80", "AE1"], &["SG7"])
679    }
680
681    /// [39] Wenn in dieser SG7 AJT DE4465 = AC1
682    fn evaluate_39(&self, ctx: &EvaluationContext) -> ConditionResult {
683        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
684        ctx.this_group_has_qualifier("AJT", 0, "AC1", &["SG7"])
685    }
686
687    /// [40] Wenn in dieser SG7 AJT DE1082 = E_0406
688    fn evaluate_40(&self, ctx: &EvaluationContext) -> ConditionResult {
689        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
690        ctx.this_group_has_qualifier("AJT", 1, "E_0406", &["SG7"])
691    }
692
693    /// [41] Wenn in dieser SG7 AJT DE1082 = E_0407
694    fn evaluate_41(&self, ctx: &EvaluationContext) -> ConditionResult {
695        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
696        ctx.this_group_has_qualifier("AJT", 1, "E_0407", &["SG7"])
697    }
698
699    /// [42] Wenn in SG7 AJT DE1082 = E_0407/E_0568/E_0521/E_0517/E_0266
700    fn evaluate_42(&self, ctx: &EvaluationContext) -> ConditionResult {
701        ctx.any_group_has_any_qualifier(
702            "AJT",
703            1,
704            &["E_0407", "E_0568", "E_0521", "E_0517", "E_0266"],
705            &["SG7"],
706        )
707    }
708
709    /// [43] Wenn in SG12 AJT DE4465=28
710    fn evaluate_43(&self, ctx: &EvaluationContext) -> ConditionResult {
711        ctx.any_group_has_qualifier("AJT", 0, "28", &["SG12"])
712    }
713
714    /// [47] Wenn in diesem AJT DE1082 = E_0210
715    fn evaluate_47(&self, ctx: &EvaluationContext) -> ConditionResult {
716        ctx.has_qualifier("AJT", 1, "E_0210")
717    }
718
719    /// [48] Wenn in diesem AJT DE1082 = E_0259
720    fn evaluate_48(&self, ctx: &EvaluationContext) -> ConditionResult {
721        ctx.has_qualifier("AJT", 1, "E_0259")
722    }
723
724    /// [51] Wenn in dieser SG12 AJT DE1082 = E_0406
725    fn evaluate_51(&self, ctx: &EvaluationContext) -> ConditionResult {
726        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
727        ctx.this_group_has_qualifier("AJT", 1, "E_0406", &["SG12"])
728    }
729
730    /// [52] Wenn in dieser SG12 AJT DE1082 = E_0407
731    fn evaluate_52(&self, ctx: &EvaluationContext) -> ConditionResult {
732        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
733        ctx.this_group_has_qualifier("AJT", 1, "E_0407", &["SG12"])
734    }
735
736    /// [53] Wenn in dieser SG12 AJT DE4465 = A25/A31/A99/AF1
737    fn evaluate_53(&self, ctx: &EvaluationContext) -> ConditionResult {
738        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
739        ctx.this_group_has_any_qualifier("AJT", 0, &["A25", "A31", "A99", "AF1"], &["SG5", "SG12"])
740    }
741
742    /// [54] Wenn in dieser SG12 AJT DE1082 = E_0210
743    fn evaluate_54(&self, ctx: &EvaluationContext) -> ConditionResult {
744        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
745        ctx.this_group_has_qualifier("AJT", 1, "E_0210", &["SG5", "SG12"])
746    }
747
748    /// [55] Wenn in dieser SG12 AJT DE1082 = E_0259
749    fn evaluate_55(&self, ctx: &EvaluationContext) -> ConditionResult {
750        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
751        ctx.this_group_has_qualifier("AJT", 1, "E_0259", &["SG5", "SG12"])
752    }
753
754    /// [56] Wenn in dieser SG7 AJT DE4465 = A21
755    fn evaluate_56(&self, ctx: &EvaluationContext) -> ConditionResult {
756        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
757        ctx.this_group_has_qualifier("AJT", 0, "A21", &["SG5", "SG7"])
758    }
759
760    /// [57] Wenn in dieser SG7 AJT DE1082 = E_0210
761    fn evaluate_57(&self, ctx: &EvaluationContext) -> ConditionResult {
762        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
763        ctx.this_group_has_qualifier("AJT", 1, "E_0210", &["SG5", "SG7"])
764    }
765
766    /// [58] Wenn in dieser SG7 AJT DE1082 = E_0259
767    fn evaluate_58(&self, ctx: &EvaluationContext) -> ConditionResult {
768        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
769        ctx.this_group_has_qualifier("AJT", 1, "E_0259", &["SG5", "SG7"])
770    }
771
772    /// [60] Wenn SG7 AJT+A99+E_0243 vorhanden
773    fn evaluate_60(&self, ctx: &EvaluationContext) -> ConditionResult {
774        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0243"], &["SG5", "SG7"])
775    }
776
777    /// [61] Wenn SG7 AJT+A99+E_0261 vorhanden
778    fn evaluate_61(&self, ctx: &EvaluationContext) -> ConditionResult {
779        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0261"], &["SG5", "SG7"])
780    }
781
782    /// [62] Wenn SG7 AJT+A99+E_1007 vorhanden
783    fn evaluate_62(&self, ctx: &EvaluationContext) -> ConditionResult {
784        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_1007"], &["SG5", "SG7"])
785    }
786
787    /// [63] Wenn SG7 AJT+A01/A02+E_1009 vorhanden
788    fn evaluate_63(&self, ctx: &EvaluationContext) -> ConditionResult {
789        let a01 =
790            ctx.any_group_has_qualified_value("AJT", 0, "A01", 1, 0, &["E_1009"], &["SG5", "SG7"]);
791        let a02 =
792            ctx.any_group_has_qualified_value("AJT", 0, "A02", 1, 0, &["E_1009"], &["SG5", "SG7"]);
793        match (a01, a02) {
794            (ConditionResult::True, _) | (_, ConditionResult::True) => ConditionResult::True,
795            (ConditionResult::False, ConditionResult::False) => ConditionResult::False,
796            _ => ConditionResult::Unknown,
797        }
798    }
799
800    /// [64] Wenn in dieser SG12 AJT DE1082 = E_0264
801    fn evaluate_64(&self, ctx: &EvaluationContext) -> ConditionResult {
802        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
803        ctx.this_group_has_qualifier("AJT", 1, "E_0264", &["SG5", "SG12"])
804    }
805
806    /// [65] Wenn in dieser SG12 AJT DE1082 = E_0515
807    fn evaluate_65(&self, ctx: &EvaluationContext) -> ConditionResult {
808        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
809        ctx.this_group_has_qualifier("AJT", 1, "E_0515", &["SG5", "SG12"])
810    }
811
812    /// [66] Wenn in dieser SG12 AJT DE1082 = E_0519
813    fn evaluate_66(&self, ctx: &EvaluationContext) -> ConditionResult {
814        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
815        ctx.this_group_has_qualifier("AJT", 1, "E_0519", &["SG5", "SG12"])
816    }
817
818    /// [67] Wenn in dieser SG12 AJT DE1082 = E_0266
819    fn evaluate_67(&self, ctx: &EvaluationContext) -> ConditionResult {
820        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
821        ctx.this_group_has_qualifier("AJT", 1, "E_0266", &["SG5", "SG12"])
822    }
823
824    /// [68] Wenn in dieser SG12 AJT DE1082 = E_0517
825    fn evaluate_68(&self, ctx: &EvaluationContext) -> ConditionResult {
826        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
827        ctx.this_group_has_qualified_value("AJT", 1, "E_0517", 1, 0, &["E_0517"], &["SG12"])
828    }
829
830    /// [69] Wenn in dieser SG12 AJT DE1082 = E_0521
831    fn evaluate_69(&self, ctx: &EvaluationContext) -> ConditionResult {
832        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
833        ctx.this_group_has_qualified_value("AJT", 1, "E_0521", 1, 0, &["E_0521"], &["SG12"])
834    }
835
836    /// [70] Wenn in dieser SG12 AJT DE4465 = A15
837    fn evaluate_70(&self, ctx: &EvaluationContext) -> ConditionResult {
838        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
839        ctx.this_group_has_qualifier("AJT", 0, "A15", &["SG12"])
840    }
841
842    /// [71] Wenn in dieser SG12 AJT DE4465 = A99
843    fn evaluate_71(&self, ctx: &EvaluationContext) -> ConditionResult {
844        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
845        ctx.this_group_has_qualifier("AJT", 0, "A99", &["SG12"])
846    }
847
848    /// [72] Wenn SG7 AJT+A99+E_0518 vorhanden
849    fn evaluate_72(&self, ctx: &EvaluationContext) -> ConditionResult {
850        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0518"], &["SG7"])
851    }
852
853    /// [73] Wenn SG7 AJT+A99+E_0522 vorhanden
854    fn evaluate_73(&self, ctx: &EvaluationContext) -> ConditionResult {
855        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0522"], &["SG7"])
856    }
857
858    /// [74] Wenn SG7 AJT+A99+E_0267 vorhanden
859    fn evaluate_74(&self, ctx: &EvaluationContext) -> ConditionResult {
860        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0267"], &["SG7"])
861    }
862
863    /// [75] Wenn in diesem AJT DE1082 = E_0264
864    // REVIEW: 'In diesem AJT' means current segment context; approximated as message-wide AJT search. DE1082 at elements[1][0]. Redundant qual+val check correctly matches E_0264. (medium confidence)
865    fn evaluate_75(&self, ctx: &EvaluationContext) -> ConditionResult {
866        ctx.has_qualified_value("AJT", 1, "E_0264", 1, 0, &["E_0264"])
867    }
868
869    /// [76] Wenn in diesem AJT DE1082 = E_0266
870    // REVIEW: Same pattern as 75, checking DE1082=E_0266 in any AJT segment. (medium confidence)
871    fn evaluate_76(&self, ctx: &EvaluationContext) -> ConditionResult {
872        ctx.has_qualified_value("AJT", 1, "E_0266", 1, 0, &["E_0266"])
873    }
874
875    /// [77] Wenn in diesem AJT DE1082 = E_0515
876    // REVIEW: Same pattern as 75, checking DE1082=E_0515 in any AJT segment. (medium confidence)
877    fn evaluate_77(&self, ctx: &EvaluationContext) -> ConditionResult {
878        ctx.has_qualified_value("AJT", 1, "E_0515", 1, 0, &["E_0515"])
879    }
880
881    /// [78] Wenn in diesem AJT DE1082 = E_0517
882    // REVIEW: Same pattern as 75, checking DE1082=E_0517 in any AJT segment. (medium confidence)
883    fn evaluate_78(&self, ctx: &EvaluationContext) -> ConditionResult {
884        ctx.has_qualified_value("AJT", 1, "E_0517", 1, 0, &["E_0517"])
885    }
886
887    /// [79] Wenn in diesem AJT DE1082 = E_0519
888    // REVIEW: Same pattern as 75, checking DE1082=E_0519 in any AJT segment. (medium confidence)
889    fn evaluate_79(&self, ctx: &EvaluationContext) -> ConditionResult {
890        ctx.has_qualified_value("AJT", 1, "E_0519", 1, 0, &["E_0519"])
891    }
892
893    /// [80] Wenn in diesem AJT DE1082 = E_0521
894    // REVIEW: Same pattern as 75, checking DE1082=E_0521 in any AJT segment. (medium confidence)
895    fn evaluate_80(&self, ctx: &EvaluationContext) -> ConditionResult {
896        ctx.has_qualified_value("AJT", 1, "E_0521", 1, 0, &["E_0521"])
897    }
898
899    /// [81] Wenn in dieser SG7 AJT DE1082 = E_0264
900    fn evaluate_81(&self, ctx: &EvaluationContext) -> ConditionResult {
901        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
902        ctx.this_group_has_qualified_value("AJT", 1, "E_0264", 1, 0, &["E_0264"], &["SG7"])
903    }
904
905    /// [82] Wenn in dieser SG7 AJT DE1082 = E_0515
906    fn evaluate_82(&self, ctx: &EvaluationContext) -> ConditionResult {
907        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
908        ctx.this_group_has_qualified_value("AJT", 1, "E_0515", 1, 0, &["E_0515"], &["SG7"])
909    }
910
911    /// [83] Wenn in dieser SG7 AJT DE1082 = E_0519
912    fn evaluate_83(&self, ctx: &EvaluationContext) -> ConditionResult {
913        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
914        let values = ctx.this_group_values("AJT", 1, 0, &["SG7"]);
915        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0519"))
916    }
917
918    /// [84] Wenn in dieser SG7 AJT DE1082 = E_0266
919    fn evaluate_84(&self, ctx: &EvaluationContext) -> ConditionResult {
920        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
921        let values = ctx.this_group_values("AJT", 1, 0, &["SG7"]);
922        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0266"))
923    }
924
925    /// [85] Wenn in dieser SG7 AJT DE1082 = E_0517
926    fn evaluate_85(&self, ctx: &EvaluationContext) -> ConditionResult {
927        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
928        let values = ctx.this_group_values("AJT", 1, 0, &["SG7"]);
929        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0517"))
930    }
931
932    /// [86] Wenn in dieser SG7 AJT DE1082 = E_0521
933    fn evaluate_86(&self, ctx: &EvaluationContext) -> ConditionResult {
934        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
935        let values = ctx.this_group_values("AJT", 1, 0, &["SG7"]);
936        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0521"))
937    }
938
939    /// [87] Wenn in dieser SG7 AJT DE4465 = A05/A21/A22/A23/A90/A96/AE7
940    fn evaluate_87(&self, ctx: &EvaluationContext) -> ConditionResult {
941        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
942        ctx.this_group_has_any_qualifier(
943            "AJT",
944            0,
945            &["A05", "A21", "A22", "A23", "A90", "A96", "AE7"],
946            &["SG7"],
947        )
948    }
949
950    /// [88] Wenn in dieser SG7 AJT DE4465 = A25
951    fn evaluate_88(&self, ctx: &EvaluationContext) -> ConditionResult {
952        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
953        ctx.this_group_has_qualifier("AJT", 0, "A25", &["SG7"])
954    }
955
956    /// [89] wenn im DE3155 in demselben COM der Code EM vorhanden ist
957    fn evaluate_89(&self, ctx: &EvaluationContext) -> ConditionResult {
958        let segs = ctx.find_segments("COM");
959        ConditionResult::from(segs.iter().any(|s| {
960            s.elements
961                .first()
962                .and_then(|e| e.get(1))
963                .is_some_and(|v| v == "EM")
964        }))
965    }
966
967    /// [90] wenn im DE3155 in demselben COM der Code TE / FX / AJ / AL vorhanden ist
968    fn evaluate_90(&self, ctx: &EvaluationContext) -> ConditionResult {
969        let segs = ctx.find_segments("COM");
970        ConditionResult::from(segs.iter().any(|s| {
971            s.elements
972                .first()
973                .and_then(|e| e.get(1))
974                .is_some_and(|v| matches!(v.as_str(), "TE" | "FX" | "AJ" | "AL"))
975        }))
976    }
977
978    /// [91] Wenn in diesem AJT DE1082 = E_0566
979    fn evaluate_91(&self, ctx: &EvaluationContext) -> ConditionResult {
980        let segs = ctx.find_segments("AJT");
981        ConditionResult::from(segs.iter().any(|s| {
982            s.elements
983                .get(1)
984                .and_then(|e| e.first())
985                .is_some_and(|v| v == "E_0566")
986        }))
987    }
988
989    /// [92] Wenn in diesem AJT DE1082 = E_0568
990    fn evaluate_92(&self, ctx: &EvaluationContext) -> ConditionResult {
991        let segs = ctx.find_segments("AJT");
992        ConditionResult::from(segs.iter().any(|s| {
993            s.elements
994                .get(1)
995                .and_then(|e| e.first())
996                .is_some_and(|v| v == "E_0568")
997        }))
998    }
999
1000    /// [93] Wenn SG7 AJT+A99+E_0804 vorhanden
1001    fn evaluate_93(&self, ctx: &EvaluationContext) -> ConditionResult {
1002        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0804"], &["SG7"])
1003    }
1004
1005    /// [94] Wenn SG7 AJT+A99+E_0806 vorhanden
1006    fn evaluate_94(&self, ctx: &EvaluationContext) -> ConditionResult {
1007        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0806"], &["SG7"])
1008    }
1009
1010    /// [95] Wenn SG7 AJT+A99+E_0569 vorhanden
1011    fn evaluate_95(&self, ctx: &EvaluationContext) -> ConditionResult {
1012        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0569"], &["SG7"])
1013    }
1014
1015    /// [97] Wenn in dieser SG12 AJT DE4465 = A27
1016    fn evaluate_97(&self, ctx: &EvaluationContext) -> ConditionResult {
1017        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
1018        ctx.this_group_has_qualifier("AJT", 0, "A27", &["SG12"])
1019    }
1020
1021    /// [98] Wenn in SG12 AJT DE1082 = E_0407
1022    fn evaluate_98(&self, ctx: &EvaluationContext) -> ConditionResult {
1023        let values = ctx.collect_group_values("AJT", 1, 0, &["SG12"]);
1024        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0407"))
1025    }
1026
1027    /// [99] Wenn in SG12 AJT DE1082 = E_0568
1028    // REVIEW: Checks any AJT segment in the message where DE1082 (elements[1][0]) equals E_0568. No 'dieser' qualifier so message-wide search is appropriate. SG12 scoping not enforced due to API limitations without group path context. (medium confidence)
1029    fn evaluate_99(&self, ctx: &EvaluationContext) -> ConditionResult {
1030        ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
1031            s.elements
1032                .get(1)
1033                .and_then(|e| e.first())
1034                .is_some_and(|v| v == "E_0568")
1035        }))
1036    }
1037
1038    /// [101] Wenn in dieser SG7 AJT DE1082 = E_0566
1039    // REVIEW: Group-scoped check for AJT DE1082=E_0566 within SG7 (nested under SG5). Uses navigator to iterate SG7 instances; falls back to message-wide AJT scan when no navigator available. 'Dieser SG7' semantics best approximated by iterating all SG7 instances. (medium confidence)
1040    fn evaluate_101(&self, ctx: &EvaluationContext) -> ConditionResult {
1041        // HAND-EDITED: "in dieser SG7" — scoped to the enclosing group.
1042        if ctx.navigator().is_none() {
1043            return ConditionResult::Unknown;
1044        }
1045        ConditionResult::from(
1046            ctx.this_group_values("AJT", 1, 0, &["SG5", "SG7"])
1047                .iter()
1048                .any(|(_, v)| v == "E_0566"),
1049        )
1050    }
1051
1052    /// [102] Wenn in dieser SG7 AJT DE1082 = E_0568
1053    // REVIEW: Group-scoped check for AJT DE1082=E_0568 within SG7 (nested under SG5). Same pattern as condition 101 but checking E_0568 instead of E_0566. (medium confidence)
1054    fn evaluate_102(&self, ctx: &EvaluationContext) -> ConditionResult {
1055        // HAND-EDITED: "in dieser SG7" — scoped to the enclosing group.
1056        if ctx.navigator().is_none() {
1057            return ConditionResult::Unknown;
1058        }
1059        ConditionResult::from(
1060            ctx.this_group_values("AJT", 1, 0, &["SG5", "SG7"])
1061                .iter()
1062                .any(|(_, v)| v == "E_0568"),
1063        )
1064    }
1065
1066    /// [103] Wenn in dieser SG12 AJT DE1082 = E_0566
1067    // REVIEW: Group-scoped check for AJT DE1082=E_0566 within SG12 (nested under SG10 for line-item rejections). Uses navigator to iterate SG12 instances; falls back to message-wide scan. (medium confidence)
1068    fn evaluate_103(&self, ctx: &EvaluationContext) -> ConditionResult {
1069        // HAND-EDITED: "in dieser SG12" — scoped to the enclosing group.
1070        if ctx.navigator().is_none() {
1071            return ConditionResult::Unknown;
1072        }
1073        ConditionResult::from(
1074            ctx.this_group_values("AJT", 1, 0, &["SG10", "SG12"])
1075                .iter()
1076                .any(|(_, v)| v == "E_0566"),
1077        )
1078    }
1079
1080    /// [104] Wenn in dieser SG12 AJT DE1082 = E_0568
1081    // REVIEW: Group-scoped check for AJT DE1082=E_0568 within SG12 (nested under SG10). Same pattern as condition 103 but checking E_0568. (medium confidence)
1082    fn evaluate_104(&self, ctx: &EvaluationContext) -> ConditionResult {
1083        // HAND-EDITED: "in dieser SG12" — scoped to the enclosing group.
1084        if ctx.navigator().is_none() {
1085            return ConditionResult::Unknown;
1086        }
1087        ConditionResult::from(
1088            ctx.this_group_values("AJT", 1, 0, &["SG10", "SG12"])
1089                .iter()
1090                .any(|(_, v)| v == "E_0568"),
1091        )
1092    }
1093
1094    /// [492] Wenn MP-ID in NAD+MR (Nachrichtenempfänger) aus Sparte Strom
1095    /// EXTERNAL: Requires context from outside the message.
1096    fn evaluate_492(&self, ctx: &EvaluationContext) -> ConditionResult {
1097        ctx.external.evaluate("recipient_is_strom")
1098    }
1099
1100    /// [493] Wenn MP-ID in NAD+MR (Nachrichtenempfänger) aus Sparte Gas
1101    /// EXTERNAL: Requires context from outside the message.
1102    fn evaluate_493(&self, ctx: &EvaluationContext) -> ConditionResult {
1103        ctx.external.evaluate("recipient_is_gas")
1104    }
1105
1106    /// [501] Hinweis: An dieser Stelle ist der Betrag aus SG50 MOA+9 der zugrundeliegenden INVOIC zu übernehmen.
1107    fn evaluate_501(&self, _ctx: &EvaluationContext) -> ConditionResult {
1108        // Hinweis: An dieser Stelle ist der Betrag aus SG50 MOA+9 der zugrundeliegenden INVOIC zu übernehmen.
1109        // Informational note — always applies
1110        ConditionResult::True
1111    }
1112
1113    /// [502] Hinweis: Bei positivem Betrag ergibt sich eine Forderung des Rechnungsstellers. Bei negativem Betrag ergibt sich eine Forderung für den Rechnungsempfänger.
1114    fn evaluate_502(&self, _ctx: &EvaluationContext) -> ConditionResult {
1115        // Hinweis: Bei positivem Betrag ergibt sich eine Forderung des Rechnungsstellers.
1116        // Bei negativem Betrag ergibt sich eine Forderung für den Rechnungsempfänger.
1117        // Informational note — always applies
1118        ConditionResult::True
1119    }
1120
1121    /// [503] Hinweis: Empfohlen, um bei Abweisung Ansprechpartner für Rückfragen zu erreichen.
1122    fn evaluate_503(&self, _ctx: &EvaluationContext) -> ConditionResult {
1123        // Hinweis: Empfohlen, um bei Abweisung Ansprechpartner für Rückfragen zu erreichen.
1124        // Informational note — always applies
1125        ConditionResult::True
1126    }
1127
1128    /// [510] Hinweis: Bei Ablehnung einer vorherigen COMDIS
1129    fn evaluate_510(&self, _ctx: &EvaluationContext) -> ConditionResult {
1130        // Hinweis: Bei Ablehnung einer vorherigen COMDIS
1131        // Informational note — always applies
1132        ConditionResult::True
1133    }
1134
1135    /// [511] Hinweis: BGM DE1004 aus der abgelehnten INVOIC-Nachricht
1136    fn evaluate_511(&self, _ctx: &EvaluationContext) -> ConditionResult {
1137        // Hinweis: BGM DE1004 aus der abgelehnten INVOIC-Nachricht — informational note, always applies
1138        ConditionResult::True
1139    }
1140
1141    /// [512] Hinweis: BGM DE1004 aus der abgelehnten COMDIS-Nachricht
1142    fn evaluate_512(&self, _ctx: &EvaluationContext) -> ConditionResult {
1143        // Hinweis: BGM DE1004 aus der abgelehnten COMDIS-Nachricht — informational note, always applies
1144        ConditionResult::True
1145    }
1146
1147    /// [515] Hinweis: BGM DE1004 aus der bestätigten INVOIC- Nachricht
1148    fn evaluate_515(&self, _ctx: &EvaluationContext) -> ConditionResult {
1149        // Hinweis: BGM DE1004 aus der bestätigten INVOIC-Nachricht — informational note, always applies
1150        ConditionResult::True
1151    }
1152
1153    /// [517] Hinweis: Wenn in dieser SG5 in AJT DE4465 ein Code aus Cluster Ablehnung auf Summenebene verwendet wird, ist diese SG7 so oft zu wiederholen, bis alle Fehler der Summenebene genannt sind.
1154    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
1155    fn evaluate_517(&self, ctx: &EvaluationContext) -> ConditionResult {
1156        any_scoped_ajt_in_cluster(ctx, &[], Cluster::is_ablehnung_summenebene)
1157    }
1158
1159    /// [518] Hinweis: Wenn in dieser SG5 in AJT DE4465 ein Code aus Cluster Ablehnung auf Kopfebene verwendet wird, der von A80 abweicht, ist diese SG7 genau einmal zu nutzen.
1160    // HAND-EDITED: per-EBD cluster data (mako_prozesse). A80 carve-out.
1161    fn evaluate_518(&self, ctx: &EvaluationContext) -> ConditionResult {
1162        any_scoped_ajt_in_cluster(ctx, &["A80"], Cluster::is_ablehnung_kopfebene)
1163    }
1164
1165    /// [519] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A74 zu wiederholen, bis alle Rechnungsnummern im RFF-Segment dieser SG7 genannt sind, die in der INVOIC fehlen, die in diesem SG5 DOC DE1004 genannt ist
1166    fn evaluate_519(&self, _ctx: &EvaluationContext) -> ConditionResult {
1167        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A74 zu wiederholen, bis alle Rechnungsnummern im RFF-Segment dieser SG7 genannt sind, die in der INVOIC fehlen, die in diesem SG5 DOC DE1004 genannt ist
1168        // Informational note, always applies
1169        ConditionResult::True
1170    }
1171
1172    /// [520] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A75 zu wiederholen, bis alle Rechnungsnummern der Rechnungen genannt sind, die mindestens eine Abschlagsrechnung enthalten, die in der INVOIC abgerech...
1173    fn evaluate_520(&self, _ctx: &EvaluationContext) -> ConditionResult {
1174        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A75 zu wiederholen, bis alle Rechnungsnummern der Rechnungen genannt sind, die mindestens eine Abschlagsrechnung enthalten, die in der INVOIC abgerechnet wurden, die in diesem SG5 DOC DE1004 genannt ist.
1175        // Informational note, always applies
1176        ConditionResult::True
1177    }
1178
1179    /// [521] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A76 zu wiederholen, bis alle Rechnungsnummern der Abschlagsrechnungen genannt sind, die in der INVOIC, die in diesem SG5 DOC DE1004 genannt ist, nicht...
1180    fn evaluate_521(&self, _ctx: &EvaluationContext) -> ConditionResult {
1181        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A76 zu wiederholen, bis alle Rechnungsnummern der Abschlagsrechnungen genannt sind, die in der INVOIC, die in diesem SG5 DOC DE1004 genannt ist, nicht hätten berücksichtigt werden dürfen.
1182        // Informational note, always applies
1183        ConditionResult::True
1184    }
1185
1186    /// [523] Hinweis: Jede Rechnungsnummer einer Abschlagsrechnung muss in einem separaten DE4440 angegeben werden. Reichen die fünf DE4440 für die Rechnungsnummern aller anzugebenden Abschlagrechnungen nicht...
1187    fn evaluate_523(&self, _ctx: &EvaluationContext) -> ConditionResult {
1188        // Hinweis: Jede Rechnungsnummer einer Abschlagsrechnung muss in einem separaten DE4440 angegeben werden. Reichen die fünf DE4440 für die Rechnungsnummern aller anzugebenden Abschlagrechnungen nicht aus, ist das FTX+Z14 zu wiederholen.
1189        // Informational note, always applies
1190        ConditionResult::True
1191    }
1192
1193    /// [525] Hinweis: Diese SG10 ist so oft zu wiederholen, bis alle Fehler der Positionsebene genannt sind.
1194    fn evaluate_525(&self, _ctx: &EvaluationContext) -> ConditionResult {
1195        // Hinweis: Diese SG10 ist so oft zu wiederholen, bis alle Fehler der Positionsebene genannt sind.
1196        // Informational note, always applies
1197        ConditionResult::True
1198    }
1199
1200    /// [526] Hinweis: Wert aus DE1082 der SG26 in der sich der nachfolgende Fehler in der INVOIC befindet, die in diesem SG5 DOC DE1004 genannt ist.
1201    fn evaluate_526(&self, _ctx: &EvaluationContext) -> ConditionResult {
1202        // Hinweis: Wert aus DE1082 der SG26 in der sich der nachfolgende Fehler in der INVOIC befindet, die in diesem SG5 DOC DE1004 genannt ist.
1203        ConditionResult::True
1204    }
1205
1206    /// [529] Hinweis: Wenn in dieser SG7 AJT DE4465 = A75 vorhanden, dann dürfen in den DE4440 dieses FTX-Segments nur Abschlagsrechnungsnummern genannt sein, welche in der Rechnung enthalten sind, deren Numme...
1207    // REVIEW: The trigger 'Wenn in dieser SG7 AJT DE4465=A75 vorhanden' is evaluable via group-scoped qualifier check on SG5.SG7. The subsequent content constraint (FTX DE4440 must contain only installment invoice numbers that appear in the invoice referenced by RFF+AFL) requires cross-message business context not available in the EDIFACT message itself, so only the trigger condition is implemented. (medium confidence)
1208    fn evaluate_529(&self, ctx: &EvaluationContext) -> ConditionResult {
1209        // HAND-EDITED: "in dieser/derselben SG7" — scoped to the enclosing group.
1210        // Check if this SG7 contains AJT DE4465=A75.
1211        // The content constraint on FTX DE4440 (only installment invoice numbers
1212        // from the referenced invoice) requires cross-message business context
1213        // and cannot be verified from EDIFACT structure alone.
1214        ctx.this_group_has_qualifier("AJT", 0, "A75", &["SG5", "SG7"])
1215    }
1216
1217    /// [533] Hinweis: Wenn in dieser SG12 AJT DE4465 = AA1/AA6/AA7/AB8/AD6, ist diese SG12 so oft mit AJT DE4465 = Code zu wiederholen, bis alle Rechnungsnummern im RFF-Segment dieser SG12 genannt sind.
1218    // REVIEW: The trigger condition 'Wenn in dieser SG12 AJT DE4465=AA1/AA6/AA7/AB8/AD6' is evaluable via group-scoped multi-qualifier check on SG12. AJT DE4465 is at elements[0][0]. The subsequent repetition rule (how many times to repeat SG12) is informational and not a boolean condition. (medium confidence)
1219    fn evaluate_533(&self, ctx: &EvaluationContext) -> ConditionResult {
1220        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
1221        // Check if this SG12 contains AJT DE4465 with one of the specified codes.
1222        // When any of these codes is present, SG12 must be repeated until all
1223        // relevant invoice numbers are listed in RFF segments.
1224        ctx.this_group_has_any_qualifier("AJT", 0, &["AA1", "AA6", "AA7", "AB8", "AD6"], &["SG12"])
1225    }
1226
1227    /// [534] Hinweis: Wenn in dieser SG12 AJT DE4465 = A34/A39/AA2/AB2, ist diese SG12 ist so oft mit AJT DE4465 = Code zu wiederholen, bis alle Nummern der Reklamationen im RFF-Segment dieser SG12 genannt sind.
1228    // REVIEW: The trigger condition 'Wenn in dieser SG12 AJT DE4465=A34/A39/AA2/AB2' is evaluable via group-scoped multi-qualifier check on SG12. AJT DE4465 is at elements[0][0]. The subsequent repetition rule is informational. (medium confidence)
1229    fn evaluate_534(&self, ctx: &EvaluationContext) -> ConditionResult {
1230        // HAND-EDITED: "in dieser/derselben SG12" — scoped to the enclosing group.
1231        // Check if this SG12 contains AJT DE4465 with one of the specified codes.
1232        // When any of these codes is present, SG12 must be repeated until all
1233        // relevant complaint/claim numbers are listed in RFF segments.
1234        ctx.this_group_has_any_qualifier("AJT", 0, &["A34", "A39", "AA2", "AB2"], &["SG12"])
1235    }
1236
1237    /// [535] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A80 zu wiederholen, bis die Rechnungsnummern der nicht stornierten Sonderrechnungen mit derselben Sonderrechnungsart wie sie in Sonderrechnung genannt...
1238    fn evaluate_535(&self, _ctx: &EvaluationContext) -> ConditionResult {
1239        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A80 zu wiederholen, bis die Rechnungsnummern der nicht stornierten Sonderrechnungen... — informational note about repetition cardinality, always applies
1240        ConditionResult::True
1241    }
1242
1243    /// [536] Hinweis: Dieses DE darf keine Abschlagsrechnungsnummer enthalten
1244    fn evaluate_536(&self, _ctx: &EvaluationContext) -> ConditionResult {
1245        // Hinweis: Dieses DE darf keine Abschlagsrechnungsnummer enthalten — informational note about field usage restriction, always applies
1246        ConditionResult::True
1247    }
1248
1249    /// [537] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = AC5 zu wiederholen, bis alle Rechnungsnummern im RFF Segment dieser SG7 genannt sind, die in der INVOIC berücksichtigt werden sollten, die in diesem ...
1250    fn evaluate_537(&self, _ctx: &EvaluationContext) -> ConditionResult {
1251        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = AC5 zu wiederholen, bis alle Rechnungsnummern im RFF Segment dieser SG7 genannt sind... — informational note about repetition cardinality, always applies
1252        ConditionResult::True
1253    }
1254
1255    /// [538] Hinweis: Jede Positionsnummer eines Angebotes muss in einem separaten DE4440 angegeben werden. Reichen die fünf DE4440 für die Positionsnummern aller anzugebenden Angebote nicht aus, ist das SG7 ...
1256    fn evaluate_538(&self, _ctx: &EvaluationContext) -> ConditionResult {
1257        // Hinweis: Jede Positionsnummer eines Angebotes muss in einem separaten DE4440 angegeben werden. Reichen die fünf DE4440 nicht aus, ist das SG7 FTX+Z16 zu wiederholen. — informational note about field usage, always applies
1258        ConditionResult::True
1259    }
1260
1261    /// [548] Hinweis: Die Befüllung des Datenelements ergibt sich aus dem zugehörigen EBD.
1262    fn evaluate_548(&self, _ctx: &EvaluationContext) -> ConditionResult {
1263        // Hinweis: Die Befüllung des Datenelements ergibt sich aus dem zugehörigen EBD.
1264        ConditionResult::True
1265    }
1266
1267    /// [549] Hinweis: Es darf nur eine Information im DE3148 übermittelt werden
1268    fn evaluate_549(&self, _ctx: &EvaluationContext) -> ConditionResult {
1269        // Hinweis: Es darf nur eine Information im DE3148 übermittelt werden — informational note, always applies
1270        ConditionResult::True
1271    }
1272
1273    /// [926] Format: Möglicher Wert: 0
1274    // REVIEW: Format condition checking that the value equals 0. Applied to MOA segment (monetary amount) which is the primary numeric field in REMADV. The segment is the most likely target for this constraint in REMADV context. (medium confidence)
1275    fn evaluate_926(&self, ctx: &EvaluationContext) -> ConditionResult {
1276        ctx.format_check("MOA", 0, 1, |val| validate_numeric(val, "==", 0.0))
1277    }
1278
1279    /// [930] Format: max. 2 Nachkommastellen
1280    // REVIEW: Format condition for maximum 2 decimal places. Applied to MOA segment value (element[0][1]) which is the primary numeric data element in REMADV messages. (medium confidence)
1281    fn evaluate_930(&self, ctx: &EvaluationContext) -> ConditionResult {
1282        ctx.format_check("MOA", 0, 1, |val| validate_max_decimal_places(val, 2))
1283    }
1284
1285    /// [931] Format: ZZZ = +00
1286    fn evaluate_931(&self, ctx: &EvaluationContext) -> ConditionResult {
1287        ctx.format_check("DTM", 0, 1, validate_timezone_utc)
1288    }
1289
1290    /// [939] Format: Die Zeichenkette muss die Zeichen @ und . enthalten
1291    fn evaluate_939(&self, ctx: &EvaluationContext) -> ConditionResult {
1292        ctx.format_check("COM", 0, 0, validate_email)
1293    }
1294
1295    /// [940] Format: Die Zeichenkette muss mit dem Zeichen + beginnen und danach dürfen nur noch Ziffern folgen
1296    fn evaluate_940(&self, ctx: &EvaluationContext) -> ConditionResult {
1297        ctx.format_check("COM", 0, 0, validate_phone)
1298    }
1299}