Skip to main content

automapper_validation/generated/fv2604/
remadv_conditions_fv2604.rs

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