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        ctx.any_group_has_any_qualifier("AJT", 0, &["A74", "A75", "A76", "AC5"], &["SG7"])
448    }
449
450    /// [22] Wenn in dieser SG7 AJT DE4465 = A02/A06/A16/A66/A67/A68/A69/A78/A90/A95/A96/AC3/AC4
451    fn evaluate_22(&self, ctx: &EvaluationContext) -> ConditionResult {
452        ctx.any_group_has_any_qualifier(
453            "AJT",
454            0,
455            &[
456                "A02", "A06", "A16", "A66", "A67", "A68", "A69", "A78", "A90", "A95", "A96", "AC3",
457                "AC4",
458            ],
459            &["SG7"],
460        )
461    }
462
463    /// [26] Wenn in dieser SG12 AJT DE4465 = A51/A62/A82/AA1/AA6/AA7/AB8/AD6
464    fn evaluate_26(&self, ctx: &EvaluationContext) -> ConditionResult {
465        ctx.any_group_has_any_qualifier(
466            "AJT",
467            0,
468            &["A51", "A62", "A82", "AA1", "AA6", "AA7", "AB8", "AD6"],
469            &["SG12"],
470        )
471    }
472
473    /// [28] Wenn in dieser SG12 AJT DE4465 = A23/A26/A35/A36/A38/A46/A47/A48/A50/A58/A59/A61/A77/A84/A99
474    fn evaluate_28(&self, ctx: &EvaluationContext) -> ConditionResult {
475        ctx.any_group_has_any_qualifier(
476            "AJT",
477            0,
478            &[
479                "A23", "A26", "A35", "A36", "A38", "A46", "A47", "A48", "A50", "A58", "A59", "A61",
480                "A77", "A84", "A99",
481            ],
482            &["SG12"],
483        )
484    }
485
486    /// [33] Wenn in diesem AJT DE1082 = S_0103
487    // 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)
488    fn evaluate_33(&self, ctx: &EvaluationContext) -> ConditionResult {
489        ctx.has_qualifier("AJT", 1, "S_0103")
490    }
491
492    /// [34] Wenn in diesem AJT DE1082 = S_0104
493    fn evaluate_34(&self, ctx: &EvaluationContext) -> ConditionResult {
494        ctx.has_qualifier("AJT", 1, "S_0104")
495    }
496
497    /// [35] Wenn in dieser SG12 AJT DE4465 = A34/A39/AA2/AB2
498    fn evaluate_35(&self, ctx: &EvaluationContext) -> ConditionResult {
499        ctx.any_group_has_any_qualifier("AJT", 0, &["A34", "A39", "AA2", "AB2"], &["SG12"])
500    }
501
502    /// [36] Wenn in dieser SG7 AJT DE4465 = A12/A75/A80/AE1
503    fn evaluate_36(&self, ctx: &EvaluationContext) -> ConditionResult {
504        ctx.any_group_has_any_qualifier("AJT", 0, &["A12", "A75", "A80", "AE1"], &["SG7"])
505    }
506
507    /// [39] Wenn in dieser SG7 AJT DE4465 = AC1
508    fn evaluate_39(&self, ctx: &EvaluationContext) -> ConditionResult {
509        ctx.any_group_has_qualifier("AJT", 0, "AC1", &["SG7"])
510    }
511
512    /// [40] Wenn in dieser SG7 AJT DE1082 = E_0406
513    fn evaluate_40(&self, ctx: &EvaluationContext) -> ConditionResult {
514        ctx.any_group_has_qualifier("AJT", 1, "E_0406", &["SG7"])
515    }
516
517    /// [41] Wenn in dieser SG7 AJT DE1082 = E_0407
518    fn evaluate_41(&self, ctx: &EvaluationContext) -> ConditionResult {
519        ctx.any_group_has_qualifier("AJT", 1, "E_0407", &["SG7"])
520    }
521
522    /// [42] Wenn in SG7 AJT DE1082 = E_0407/E_0568/E_0521/E_0517/E_0266
523    fn evaluate_42(&self, ctx: &EvaluationContext) -> ConditionResult {
524        ctx.any_group_has_any_qualifier(
525            "AJT",
526            1,
527            &["E_0407", "E_0568", "E_0521", "E_0517", "E_0266"],
528            &["SG7"],
529        )
530    }
531
532    /// [43] Wenn in SG12 AJT DE4465=28
533    fn evaluate_43(&self, ctx: &EvaluationContext) -> ConditionResult {
534        ctx.any_group_has_qualifier("AJT", 0, "28", &["SG12"])
535    }
536
537    /// [47] Wenn in diesem AJT DE1082 = E_0210
538    fn evaluate_47(&self, ctx: &EvaluationContext) -> ConditionResult {
539        ctx.has_qualifier("AJT", 1, "E_0210")
540    }
541
542    /// [48] Wenn in diesem AJT DE1082 = E_0259
543    fn evaluate_48(&self, ctx: &EvaluationContext) -> ConditionResult {
544        ctx.has_qualifier("AJT", 1, "E_0259")
545    }
546
547    /// [49] Wenn in dieser SG7 AJT DE4465 = A01/A05/A22/A23/A90/A96
548    fn evaluate_49(&self, ctx: &EvaluationContext) -> ConditionResult {
549        ctx.any_group_has_any_qualifier(
550            "AJT",
551            0,
552            &["A01", "A05", "A22", "A23", "A90", "A96"],
553            &["SG7"],
554        )
555    }
556
557    /// [50] Wenn in dieser SG7 AJT DE4465 = A01/A05/A18/A19/A20/A90/A96
558    fn evaluate_50(&self, ctx: &EvaluationContext) -> ConditionResult {
559        ctx.any_group_has_any_qualifier(
560            "AJT",
561            0,
562            &["A01", "A05", "A18", "A19", "A20", "A90", "A96"],
563            &["SG7"],
564        )
565    }
566
567    /// [51] Wenn in dieser SG12 AJT DE1082 = E_0406
568    fn evaluate_51(&self, ctx: &EvaluationContext) -> ConditionResult {
569        ctx.any_group_has_qualifier("AJT", 1, "E_0406", &["SG12"])
570    }
571
572    /// [52] Wenn in dieser SG12 AJT DE1082 = E_0407
573    fn evaluate_52(&self, ctx: &EvaluationContext) -> ConditionResult {
574        ctx.any_group_has_qualifier("AJT", 1, "E_0407", &["SG12"])
575    }
576
577    /// [53] Wenn in dieser SG12 AJT DE4465 = A25/A31/A99/AF1
578    fn evaluate_53(&self, ctx: &EvaluationContext) -> ConditionResult {
579        ctx.any_group_has_any_qualifier("AJT", 0, &["A25", "A31", "A99", "AF1"], &["SG5", "SG12"])
580    }
581
582    /// [54] Wenn in dieser SG12 AJT DE1082 = E_0210
583    fn evaluate_54(&self, ctx: &EvaluationContext) -> ConditionResult {
584        ctx.any_group_has_qualifier("AJT", 1, "E_0210", &["SG5", "SG12"])
585    }
586
587    /// [55] Wenn in dieser SG12 AJT DE1082 = E_0259
588    fn evaluate_55(&self, ctx: &EvaluationContext) -> ConditionResult {
589        ctx.any_group_has_qualifier("AJT", 1, "E_0259", &["SG5", "SG12"])
590    }
591
592    /// [56] Wenn in dieser SG7 AJT DE4465 = A21
593    fn evaluate_56(&self, ctx: &EvaluationContext) -> ConditionResult {
594        ctx.any_group_has_qualifier("AJT", 0, "A21", &["SG5", "SG7"])
595    }
596
597    /// [57] Wenn in dieser SG7 AJT DE1082 = E_0210
598    fn evaluate_57(&self, ctx: &EvaluationContext) -> ConditionResult {
599        ctx.any_group_has_qualifier("AJT", 1, "E_0210", &["SG5", "SG7"])
600    }
601
602    /// [58] Wenn in dieser SG7 AJT DE1082 = E_0259
603    fn evaluate_58(&self, ctx: &EvaluationContext) -> ConditionResult {
604        ctx.any_group_has_qualifier("AJT", 1, "E_0259", &["SG5", "SG7"])
605    }
606
607    /// [59] Wenn SG7 AJT+A08/A99+E_0459 vorhanden
608    fn evaluate_59(&self, ctx: &EvaluationContext) -> ConditionResult {
609        {
610            let ajt_segs = ctx.find_segments("AJT");
611            let found = ajt_segs.iter().any(|s| {
612                let qual = s
613                    .elements
614                    .first()
615                    .and_then(|e| e.first())
616                    .map(|v| v.as_str());
617                let pos = s
618                    .elements
619                    .get(1)
620                    .and_then(|e| e.first())
621                    .map(|v| v.as_str());
622                matches!(qual, Some("A08") | Some("A99")) && pos == Some("E_0459")
623            });
624            ConditionResult::from(found)
625        }
626    }
627
628    /// [60] Wenn SG7 AJT+A99+E_0243 vorhanden
629    fn evaluate_60(&self, ctx: &EvaluationContext) -> ConditionResult {
630        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0243"], &["SG5", "SG7"])
631    }
632
633    /// [61] Wenn SG7 AJT+A99+E_0261 vorhanden
634    fn evaluate_61(&self, ctx: &EvaluationContext) -> ConditionResult {
635        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0261"], &["SG5", "SG7"])
636    }
637
638    /// [62] Wenn SG7 AJT+A99+E_1007 vorhanden
639    fn evaluate_62(&self, ctx: &EvaluationContext) -> ConditionResult {
640        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_1007"], &["SG5", "SG7"])
641    }
642
643    /// [63] Wenn SG7 AJT+A01/A02+E_1009 vorhanden
644    fn evaluate_63(&self, ctx: &EvaluationContext) -> ConditionResult {
645        let a01 =
646            ctx.any_group_has_qualified_value("AJT", 0, "A01", 1, 0, &["E_1009"], &["SG5", "SG7"]);
647        let a02 =
648            ctx.any_group_has_qualified_value("AJT", 0, "A02", 1, 0, &["E_1009"], &["SG5", "SG7"]);
649        match (a01, a02) {
650            (ConditionResult::True, _) | (_, ConditionResult::True) => ConditionResult::True,
651            (ConditionResult::False, ConditionResult::False) => ConditionResult::False,
652            _ => ConditionResult::Unknown,
653        }
654    }
655
656    /// [64] Wenn in dieser SG12 AJT DE1082 = E_0264
657    fn evaluate_64(&self, ctx: &EvaluationContext) -> ConditionResult {
658        ctx.any_group_has_qualifier("AJT", 1, "E_0264", &["SG5", "SG12"])
659    }
660
661    /// [65] Wenn in dieser SG12 AJT DE1082 = E_0515
662    fn evaluate_65(&self, ctx: &EvaluationContext) -> ConditionResult {
663        ctx.any_group_has_qualifier("AJT", 1, "E_0515", &["SG5", "SG12"])
664    }
665
666    /// [66] Wenn in dieser SG12 AJT DE1082 = E_0519
667    fn evaluate_66(&self, ctx: &EvaluationContext) -> ConditionResult {
668        ctx.any_group_has_qualifier("AJT", 1, "E_0519", &["SG5", "SG12"])
669    }
670
671    /// [67] Wenn in dieser SG12 AJT DE1082 = E_0266
672    fn evaluate_67(&self, ctx: &EvaluationContext) -> ConditionResult {
673        ctx.any_group_has_qualifier("AJT", 1, "E_0266", &["SG5", "SG12"])
674    }
675
676    /// [68] Wenn in dieser SG12 AJT DE1082 = E_0517
677    fn evaluate_68(&self, ctx: &EvaluationContext) -> ConditionResult {
678        ctx.any_group_has_qualified_value("AJT", 1, "E_0517", 1, 0, &["E_0517"], &["SG12"])
679    }
680
681    /// [69] Wenn in dieser SG12 AJT DE1082 = E_0521
682    fn evaluate_69(&self, ctx: &EvaluationContext) -> ConditionResult {
683        ctx.any_group_has_qualified_value("AJT", 1, "E_0521", 1, 0, &["E_0521"], &["SG12"])
684    }
685
686    /// [70] Wenn in dieser SG12 AJT DE4465 = A15
687    fn evaluate_70(&self, ctx: &EvaluationContext) -> ConditionResult {
688        ctx.any_group_has_qualifier("AJT", 0, "A15", &["SG12"])
689    }
690
691    /// [71] Wenn in dieser SG12 AJT DE4465 = A99
692    fn evaluate_71(&self, ctx: &EvaluationContext) -> ConditionResult {
693        ctx.any_group_has_qualifier("AJT", 0, "A99", &["SG12"])
694    }
695
696    /// [72] Wenn SG7 AJT+A99+E_0518 vorhanden
697    fn evaluate_72(&self, ctx: &EvaluationContext) -> ConditionResult {
698        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0518"], &["SG7"])
699    }
700
701    /// [73] Wenn SG7 AJT+A99+E_0522 vorhanden
702    fn evaluate_73(&self, ctx: &EvaluationContext) -> ConditionResult {
703        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0522"], &["SG7"])
704    }
705
706    /// [74] Wenn SG7 AJT+A99+E_0267 vorhanden
707    fn evaluate_74(&self, ctx: &EvaluationContext) -> ConditionResult {
708        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0267"], &["SG7"])
709    }
710
711    /// [75] Wenn in diesem AJT DE1082 = E_0264
712    // 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)
713    fn evaluate_75(&self, ctx: &EvaluationContext) -> ConditionResult {
714        ctx.has_qualified_value("AJT", 1, "E_0264", 1, 0, &["E_0264"])
715    }
716
717    /// [76] Wenn in diesem AJT DE1082 = E_0266
718    // REVIEW: Same pattern as 75, checking DE1082=E_0266 in any AJT segment. (medium confidence)
719    fn evaluate_76(&self, ctx: &EvaluationContext) -> ConditionResult {
720        ctx.has_qualified_value("AJT", 1, "E_0266", 1, 0, &["E_0266"])
721    }
722
723    /// [77] Wenn in diesem AJT DE1082 = E_0515
724    // REVIEW: Same pattern as 75, checking DE1082=E_0515 in any AJT segment. (medium confidence)
725    fn evaluate_77(&self, ctx: &EvaluationContext) -> ConditionResult {
726        ctx.has_qualified_value("AJT", 1, "E_0515", 1, 0, &["E_0515"])
727    }
728
729    /// [78] Wenn in diesem AJT DE1082 = E_0517
730    // REVIEW: Same pattern as 75, checking DE1082=E_0517 in any AJT segment. (medium confidence)
731    fn evaluate_78(&self, ctx: &EvaluationContext) -> ConditionResult {
732        ctx.has_qualified_value("AJT", 1, "E_0517", 1, 0, &["E_0517"])
733    }
734
735    /// [79] Wenn in diesem AJT DE1082 = E_0519
736    // REVIEW: Same pattern as 75, checking DE1082=E_0519 in any AJT segment. (medium confidence)
737    fn evaluate_79(&self, ctx: &EvaluationContext) -> ConditionResult {
738        ctx.has_qualified_value("AJT", 1, "E_0519", 1, 0, &["E_0519"])
739    }
740
741    /// [80] Wenn in diesem AJT DE1082 = E_0521
742    // REVIEW: Same pattern as 75, checking DE1082=E_0521 in any AJT segment. (medium confidence)
743    fn evaluate_80(&self, ctx: &EvaluationContext) -> ConditionResult {
744        ctx.has_qualified_value("AJT", 1, "E_0521", 1, 0, &["E_0521"])
745    }
746
747    /// [81] Wenn in dieser SG7 AJT DE1082 = E_0264
748    fn evaluate_81(&self, ctx: &EvaluationContext) -> ConditionResult {
749        ctx.any_group_has_qualified_value("AJT", 1, "E_0264", 1, 0, &["E_0264"], &["SG7"])
750    }
751
752    /// [82] Wenn in dieser SG7 AJT DE1082 = E_0515
753    fn evaluate_82(&self, ctx: &EvaluationContext) -> ConditionResult {
754        ctx.any_group_has_qualified_value("AJT", 1, "E_0515", 1, 0, &["E_0515"], &["SG7"])
755    }
756
757    /// [83] Wenn in dieser SG7 AJT DE1082 = E_0519
758    fn evaluate_83(&self, ctx: &EvaluationContext) -> ConditionResult {
759        let values = ctx.collect_group_values("AJT", 1, 0, &["SG7"]);
760        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0519"))
761    }
762
763    /// [84] Wenn in dieser SG7 AJT DE1082 = E_0266
764    fn evaluate_84(&self, ctx: &EvaluationContext) -> ConditionResult {
765        let values = ctx.collect_group_values("AJT", 1, 0, &["SG7"]);
766        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0266"))
767    }
768
769    /// [85] Wenn in dieser SG7 AJT DE1082 = E_0517
770    fn evaluate_85(&self, ctx: &EvaluationContext) -> ConditionResult {
771        let values = ctx.collect_group_values("AJT", 1, 0, &["SG7"]);
772        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0517"))
773    }
774
775    /// [86] Wenn in dieser SG7 AJT DE1082 = E_0521
776    fn evaluate_86(&self, ctx: &EvaluationContext) -> ConditionResult {
777        let values = ctx.collect_group_values("AJT", 1, 0, &["SG7"]);
778        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0521"))
779    }
780
781    /// [87] Wenn in dieser SG7 AJT DE4465 = A05/A21/A22/A23/A90/A96/AE7
782    fn evaluate_87(&self, ctx: &EvaluationContext) -> ConditionResult {
783        ctx.any_group_has_any_qualifier(
784            "AJT",
785            0,
786            &["A05", "A21", "A22", "A23", "A90", "A96", "AE7"],
787            &["SG7"],
788        )
789    }
790
791    /// [88] Wenn in dieser SG7 AJT DE4465 = A25
792    fn evaluate_88(&self, ctx: &EvaluationContext) -> ConditionResult {
793        ctx.any_group_has_qualifier("AJT", 0, "A25", &["SG7"])
794    }
795
796    /// [89] wenn im DE3155 in demselben COM der Code EM vorhanden ist
797    fn evaluate_89(&self, ctx: &EvaluationContext) -> ConditionResult {
798        let segs = ctx.find_segments("COM");
799        ConditionResult::from(segs.iter().any(|s| {
800            s.elements
801                .first()
802                .and_then(|e| e.get(1))
803                .is_some_and(|v| v == "EM")
804        }))
805    }
806
807    /// [90] wenn im DE3155 in demselben COM der Code TE / FX / AJ / AL vorhanden ist
808    fn evaluate_90(&self, ctx: &EvaluationContext) -> ConditionResult {
809        let segs = ctx.find_segments("COM");
810        ConditionResult::from(segs.iter().any(|s| {
811            s.elements
812                .first()
813                .and_then(|e| e.get(1))
814                .is_some_and(|v| matches!(v.as_str(), "TE" | "FX" | "AJ" | "AL"))
815        }))
816    }
817
818    /// [91] Wenn in diesem AJT DE1082 = E_0566
819    fn evaluate_91(&self, ctx: &EvaluationContext) -> ConditionResult {
820        let segs = ctx.find_segments("AJT");
821        ConditionResult::from(segs.iter().any(|s| {
822            s.elements
823                .get(1)
824                .and_then(|e| e.first())
825                .is_some_and(|v| v == "E_0566")
826        }))
827    }
828
829    /// [92] Wenn in diesem AJT DE1082 = E_0568
830    fn evaluate_92(&self, ctx: &EvaluationContext) -> ConditionResult {
831        let segs = ctx.find_segments("AJT");
832        ConditionResult::from(segs.iter().any(|s| {
833            s.elements
834                .get(1)
835                .and_then(|e| e.first())
836                .is_some_and(|v| v == "E_0568")
837        }))
838    }
839
840    /// [93] Wenn SG7 AJT+A99+E_0804 vorhanden
841    fn evaluate_93(&self, ctx: &EvaluationContext) -> ConditionResult {
842        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0804"], &["SG7"])
843    }
844
845    /// [94] Wenn SG7 AJT+A99+E_0806 vorhanden
846    fn evaluate_94(&self, ctx: &EvaluationContext) -> ConditionResult {
847        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0806"], &["SG7"])
848    }
849
850    /// [95] Wenn SG7 AJT+A99+E_0569 vorhanden
851    fn evaluate_95(&self, ctx: &EvaluationContext) -> ConditionResult {
852        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0569"], &["SG7"])
853    }
854
855    /// [96] Wenn SG7 AJT+E_0503/E_1007 vorhanden
856    fn evaluate_96(&self, ctx: &EvaluationContext) -> ConditionResult {
857        ctx.any_group_has_any_qualifier("AJT", 0, &["E_0503", "E_1007"], &["SG7"])
858    }
859
860    /// [97] Wenn in dieser SG12 AJT DE4465 = A27
861    fn evaluate_97(&self, ctx: &EvaluationContext) -> ConditionResult {
862        ctx.any_group_has_qualifier("AJT", 0, "A27", &["SG12"])
863    }
864
865    /// [98] Wenn in SG12 AJT DE1082 = E_0407
866    fn evaluate_98(&self, ctx: &EvaluationContext) -> ConditionResult {
867        let values = ctx.collect_group_values("AJT", 1, 0, &["SG12"]);
868        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0407"))
869    }
870
871    /// [99] Wenn in SG12 AJT DE1082 = E_0568
872    // 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)
873    fn evaluate_99(&self, ctx: &EvaluationContext) -> ConditionResult {
874        ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
875            s.elements
876                .get(1)
877                .and_then(|e| e.first())
878                .is_some_and(|v| v == "E_0568")
879        }))
880    }
881
882    /// [100] Wenn SG7 AJT+A01 vorhanden
883    fn evaluate_100(&self, ctx: &EvaluationContext) -> ConditionResult {
884        ctx.any_group_has_qualifier("AJT", 0, "A01", &["SG5", "SG7"])
885    }
886
887    /// [101] Wenn in dieser SG7 AJT DE1082 = E_0566
888    // 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)
889    fn evaluate_101(&self, ctx: &EvaluationContext) -> ConditionResult {
890        if let Some(nav) = ctx.navigator() {
891            let count = nav.group_instance_count(&["SG5", "SG7"]);
892            for i in 0..count {
893                let ajts = nav.find_segments_in_group("AJT", &["SG5", "SG7"], i);
894                if ajts.iter().any(|s| {
895                    s.elements
896                        .get(1)
897                        .and_then(|e| e.first())
898                        .is_some_and(|v| v == "E_0566")
899                }) {
900                    return ConditionResult::True;
901                }
902            }
903            ConditionResult::False
904        } else {
905            ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
906                s.elements
907                    .get(1)
908                    .and_then(|e| e.first())
909                    .is_some_and(|v| v == "E_0566")
910            }))
911        }
912    }
913
914    /// [102] Wenn in dieser SG7 AJT DE1082 = E_0568
915    // 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)
916    fn evaluate_102(&self, ctx: &EvaluationContext) -> ConditionResult {
917        if let Some(nav) = ctx.navigator() {
918            let count = nav.group_instance_count(&["SG5", "SG7"]);
919            for i in 0..count {
920                let ajts = nav.find_segments_in_group("AJT", &["SG5", "SG7"], i);
921                if ajts.iter().any(|s| {
922                    s.elements
923                        .get(1)
924                        .and_then(|e| e.first())
925                        .is_some_and(|v| v == "E_0568")
926                }) {
927                    return ConditionResult::True;
928                }
929            }
930            ConditionResult::False
931        } else {
932            ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
933                s.elements
934                    .get(1)
935                    .and_then(|e| e.first())
936                    .is_some_and(|v| v == "E_0568")
937            }))
938        }
939    }
940
941    /// [103] Wenn in dieser SG12 AJT DE1082 = E_0566
942    // 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)
943    fn evaluate_103(&self, ctx: &EvaluationContext) -> ConditionResult {
944        if let Some(nav) = ctx.navigator() {
945            let count = nav.group_instance_count(&["SG10", "SG12"]);
946            for i in 0..count {
947                let ajts = nav.find_segments_in_group("AJT", &["SG10", "SG12"], i);
948                if ajts.iter().any(|s| {
949                    s.elements
950                        .get(1)
951                        .and_then(|e| e.first())
952                        .is_some_and(|v| v == "E_0566")
953                }) {
954                    return ConditionResult::True;
955                }
956            }
957            ConditionResult::False
958        } else {
959            ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
960                s.elements
961                    .get(1)
962                    .and_then(|e| e.first())
963                    .is_some_and(|v| v == "E_0566")
964            }))
965        }
966    }
967
968    /// [104] Wenn in dieser SG12 AJT DE1082 = E_0568
969    // 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)
970    fn evaluate_104(&self, ctx: &EvaluationContext) -> ConditionResult {
971        if let Some(nav) = ctx.navigator() {
972            let count = nav.group_instance_count(&["SG10", "SG12"]);
973            for i in 0..count {
974                let ajts = nav.find_segments_in_group("AJT", &["SG10", "SG12"], i);
975                if ajts.iter().any(|s| {
976                    s.elements
977                        .get(1)
978                        .and_then(|e| e.first())
979                        .is_some_and(|v| v == "E_0568")
980                }) {
981                    return ConditionResult::True;
982                }
983            }
984            ConditionResult::False
985        } else {
986            ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
987                s.elements
988                    .get(1)
989                    .and_then(|e| e.first())
990                    .is_some_and(|v| v == "E_0568")
991            }))
992        }
993    }
994
995    /// [105] Wenn in diesem AJT DE1082 = E_0270
996    // 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)
997    fn evaluate_105(&self, ctx: &EvaluationContext) -> ConditionResult {
998        let segs = ctx.find_segments("AJT");
999        if segs.is_empty() {
1000            return ConditionResult::Unknown;
1001        }
1002        ConditionResult::from(segs.iter().any(|s| {
1003            s.elements
1004                .get(1)
1005                .and_then(|e| e.first())
1006                .is_some_and(|v| v == "E_0270")
1007        }))
1008    }
1009
1010    /// [106] Wenn in diesem AJT DE1082 = E_0273
1011    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0273'. Same pattern as condition 105. (medium confidence)
1012    fn evaluate_106(&self, ctx: &EvaluationContext) -> ConditionResult {
1013        let segs = ctx.find_segments("AJT");
1014        if segs.is_empty() {
1015            return ConditionResult::Unknown;
1016        }
1017        ConditionResult::from(segs.iter().any(|s| {
1018            s.elements
1019                .get(1)
1020                .and_then(|e| e.first())
1021                .is_some_and(|v| v == "E_0273")
1022        }))
1023    }
1024
1025    /// [107] Wenn in diesem AJT DE1082 = E_0276
1026    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0276'. Same pattern as condition 105. (medium confidence)
1027    fn evaluate_107(&self, ctx: &EvaluationContext) -> ConditionResult {
1028        let segs = ctx.find_segments("AJT");
1029        if segs.is_empty() {
1030            return ConditionResult::Unknown;
1031        }
1032        ConditionResult::from(segs.iter().any(|s| {
1033            s.elements
1034                .get(1)
1035                .and_then(|e| e.first())
1036                .is_some_and(|v| v == "E_0276")
1037        }))
1038    }
1039
1040    /// [108] Wenn in diesem AJT DE1082 = E_0277
1041    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0277'. Same pattern as condition 105. (medium confidence)
1042    fn evaluate_108(&self, ctx: &EvaluationContext) -> ConditionResult {
1043        let segs = ctx.find_segments("AJT");
1044        if segs.is_empty() {
1045            return ConditionResult::Unknown;
1046        }
1047        ConditionResult::from(segs.iter().any(|s| {
1048            s.elements
1049                .get(1)
1050                .and_then(|e| e.first())
1051                .is_some_and(|v| v == "E_0277")
1052        }))
1053    }
1054
1055    /// [109] Wenn in dieser SG7 AJT DE4465 = A01/A21/A22/A23/A90/A96
1056    fn evaluate_109(&self, ctx: &EvaluationContext) -> ConditionResult {
1057        ctx.any_group_has_any_qualifier(
1058            "AJT",
1059            0,
1060            &["A01", "A21", "A22", "A23", "A90", "A96"],
1061            &["SG7"],
1062        )
1063    }
1064
1065    /// [110] Wenn in dieser SG7 AJT DE1082 = E_0270
1066    fn evaluate_110(&self, ctx: &EvaluationContext) -> ConditionResult {
1067        ctx.any_group_has_qualifier("AJT", 1, "E_0270", &["SG7"])
1068    }
1069
1070    /// [111] Wenn in dieser SG7 AJT DE1082 = E_0273
1071    fn evaluate_111(&self, ctx: &EvaluationContext) -> ConditionResult {
1072        ctx.any_group_has_qualifier("AJT", 1, "E_0273", &["SG7"])
1073    }
1074
1075    /// [112] Wenn in dieser SG7 AJT DE1082 = E_0276
1076    fn evaluate_112(&self, ctx: &EvaluationContext) -> ConditionResult {
1077        ctx.any_group_has_qualifier("AJT", 1, "E_0276", &["SG7"])
1078    }
1079
1080    /// [113] Wenn in dieser SG7 AJT DE1082 = E_0277
1081    fn evaluate_113(&self, ctx: &EvaluationContext) -> ConditionResult {
1082        ctx.any_group_has_qualifier("AJT", 1, "E_0277", &["SG7"])
1083    }
1084
1085    /// [114] Wenn in dieser SG12 AJT DE1082 = E_0270
1086    fn evaluate_114(&self, ctx: &EvaluationContext) -> ConditionResult {
1087        ctx.any_group_has_qualified_value("AJT", 1, "E_0270", 1, 0, &["E_0270"], &["SG5", "SG12"])
1088    }
1089
1090    /// [115] Wenn in dieser SG12 AJT DE1082 = E_0273
1091    fn evaluate_115(&self, ctx: &EvaluationContext) -> ConditionResult {
1092        ctx.any_group_has_qualified_value("AJT", 1, "E_0273", 1, 0, &["E_0273"], &["SG5", "SG12"])
1093    }
1094
1095    /// [116] Wenn in dieser SG12 AJT DE1082 = E_0276
1096    fn evaluate_116(&self, ctx: &EvaluationContext) -> ConditionResult {
1097        ctx.any_group_has_qualified_value("AJT", 1, "E_0276", 1, 0, &["E_0276"], &["SG5", "SG12"])
1098    }
1099
1100    /// [117] Wenn in dieser SG12 AJT DE1082 = E_0277
1101    fn evaluate_117(&self, ctx: &EvaluationContext) -> ConditionResult {
1102        ctx.any_group_has_qualified_value("AJT", 1, "E_0277", 1, 0, &["E_0277"], &["SG5", "SG12"])
1103    }
1104
1105    /// [118] Wenn SG7 AJT+A99+E_0272 vorhanden
1106    fn evaluate_118(&self, ctx: &EvaluationContext) -> ConditionResult {
1107        ctx.has_segment_matching_in_group("AJT", &[(0, 0, "A99"), (1, 0, "E_0272")], &["SG7"])
1108    }
1109
1110    /// [119] Wenn SG7 AJT+A99+E_0275 vorhanden
1111    fn evaluate_119(&self, ctx: &EvaluationContext) -> ConditionResult {
1112        ctx.has_segment_matching_in_group("AJT", &[(0, 0, "A99"), (1, 0, "E_0275")], &["SG7"])
1113    }
1114
1115    /// [120] Wenn in dieser SG7 AJT DE4465 = A01
1116    fn evaluate_120(&self, ctx: &EvaluationContext) -> ConditionResult {
1117        ctx.any_group_has_qualifier("AJT", 0, "A01", &["SG7"])
1118    }
1119
1120    /// [492] Wenn MP-ID in NAD+MR (Nachrichtenempfänger) aus Sparte Strom
1121    /// EXTERNAL: Requires context from outside the message.
1122    fn evaluate_492(&self, ctx: &EvaluationContext) -> ConditionResult {
1123        ctx.external.evaluate("recipient_is_strom")
1124    }
1125
1126    /// [493] Wenn MP-ID in NAD+MR (Nachrichtenempfänger) aus Sparte Gas
1127    /// EXTERNAL: Requires context from outside the message.
1128    fn evaluate_493(&self, ctx: &EvaluationContext) -> ConditionResult {
1129        ctx.external.evaluate("recipient_is_gas")
1130    }
1131
1132    /// [501] Hinweis: An dieser Stelle ist der Betrag aus SG50 MOA+9 der zugrundeliegenden INVOIC zu übernehmen.
1133    fn evaluate_501(&self, _ctx: &EvaluationContext) -> ConditionResult {
1134        // Hinweis: An dieser Stelle ist der Betrag aus SG50 MOA+9 der zugrundeliegenden INVOIC zu übernehmen.
1135        // Informational note — always applies
1136        ConditionResult::True
1137    }
1138
1139    /// [502] Hinweis: Bei positivem Betrag ergibt sich eine Forderung des Rechnungsstellers. Bei negativem Betrag ergibt sich eine Forderung für den Rechnungsempfänger.
1140    fn evaluate_502(&self, _ctx: &EvaluationContext) -> ConditionResult {
1141        // Hinweis: Bei positivem Betrag ergibt sich eine Forderung des Rechnungsstellers.
1142        // Bei negativem Betrag ergibt sich eine Forderung für den Rechnungsempfänger.
1143        // Informational note — always applies
1144        ConditionResult::True
1145    }
1146
1147    /// [503] Hinweis: Empfohlen, um bei Abweisung Ansprechpartner für Rückfragen zu erreichen.
1148    fn evaluate_503(&self, _ctx: &EvaluationContext) -> ConditionResult {
1149        // Hinweis: Empfohlen, um bei Abweisung Ansprechpartner für Rückfragen zu erreichen.
1150        // Informational note — always applies
1151        ConditionResult::True
1152    }
1153
1154    /// [510] Hinweis: Bei Ablehnung einer vorherigen COMDIS
1155    fn evaluate_510(&self, _ctx: &EvaluationContext) -> ConditionResult {
1156        // Hinweis: Bei Ablehnung einer vorherigen COMDIS
1157        // Informational note — always applies
1158        ConditionResult::True
1159    }
1160
1161    /// [511] Hinweis: BGM DE1004 aus der abgelehnten INVOIC-Nachricht
1162    fn evaluate_511(&self, _ctx: &EvaluationContext) -> ConditionResult {
1163        // Hinweis: BGM DE1004 aus der abgelehnten INVOIC-Nachricht — informational note, always applies
1164        ConditionResult::True
1165    }
1166
1167    /// [512] Hinweis: BGM DE1004 aus der abgelehnten COMDIS-Nachricht
1168    fn evaluate_512(&self, _ctx: &EvaluationContext) -> ConditionResult {
1169        // Hinweis: BGM DE1004 aus der abgelehnten COMDIS-Nachricht — informational note, always applies
1170        ConditionResult::True
1171    }
1172
1173    /// [515] Hinweis: BGM DE1004 aus der bestätigten INVOIC- Nachricht
1174    fn evaluate_515(&self, _ctx: &EvaluationContext) -> ConditionResult {
1175        // Hinweis: BGM DE1004 aus der bestätigten INVOIC-Nachricht — informational note, always applies
1176        ConditionResult::True
1177    }
1178
1179    /// [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.
1180    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
1181    fn evaluate_517(&self, ctx: &EvaluationContext) -> ConditionResult {
1182        any_scoped_ajt_in_cluster(ctx, &[], Cluster::is_ablehnung_summenebene)
1183    }
1184
1185    /// [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.
1186    // HAND-EDITED: per-EBD cluster data (mako_prozesse). A80 carve-out.
1187    fn evaluate_518(&self, ctx: &EvaluationContext) -> ConditionResult {
1188        any_scoped_ajt_in_cluster(ctx, &["A80"], Cluster::is_ablehnung_kopfebene)
1189    }
1190
1191    /// [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
1192    fn evaluate_519(&self, _ctx: &EvaluationContext) -> ConditionResult {
1193        // 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
1194        // Informational note, always applies
1195        ConditionResult::True
1196    }
1197
1198    /// [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...
1199    fn evaluate_520(&self, _ctx: &EvaluationContext) -> ConditionResult {
1200        // 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.
1201        // Informational note, always applies
1202        ConditionResult::True
1203    }
1204
1205    /// [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...
1206    fn evaluate_521(&self, _ctx: &EvaluationContext) -> ConditionResult {
1207        // 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.
1208        // Informational note, always applies
1209        ConditionResult::True
1210    }
1211
1212    /// [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...
1213    fn evaluate_523(&self, _ctx: &EvaluationContext) -> ConditionResult {
1214        // 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.
1215        // Informational note, always applies
1216        ConditionResult::True
1217    }
1218
1219    /// [525] Hinweis: Diese SG10 ist so oft zu wiederholen, bis alle Fehler der Positionsebene genannt sind.
1220    fn evaluate_525(&self, _ctx: &EvaluationContext) -> ConditionResult {
1221        // Hinweis: Diese SG10 ist so oft zu wiederholen, bis alle Fehler der Positionsebene genannt sind.
1222        // Informational note, always applies
1223        ConditionResult::True
1224    }
1225
1226    /// [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.
1227    fn evaluate_526(&self, _ctx: &EvaluationContext) -> ConditionResult {
1228        // Hinweis: Wert aus DE1082 der SG26 in der sich der nachfolgende Fehler in der INVOIC befindet, die in diesem SG5 DOC DE1004 genannt ist.
1229        ConditionResult::True
1230    }
1231
1232    /// [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...
1233    // 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)
1234    fn evaluate_529(&self, ctx: &EvaluationContext) -> ConditionResult {
1235        // Check if this SG7 contains AJT DE4465=A75.
1236        // The content constraint on FTX DE4440 (only installment invoice numbers
1237        // from the referenced invoice) requires cross-message business context
1238        // and cannot be verified from EDIFACT structure alone.
1239        ctx.any_group_has_qualifier("AJT", 0, "A75", &["SG5", "SG7"])
1240    }
1241
1242    /// [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.
1243    // 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)
1244    fn evaluate_533(&self, ctx: &EvaluationContext) -> ConditionResult {
1245        // Check if this SG12 contains AJT DE4465 with one of the specified codes.
1246        // When any of these codes is present, SG12 must be repeated until all
1247        // relevant invoice numbers are listed in RFF segments.
1248        ctx.any_group_has_any_qualifier("AJT", 0, &["AA1", "AA6", "AA7", "AB8", "AD6"], &["SG12"])
1249    }
1250
1251    /// [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.
1252    // 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)
1253    fn evaluate_534(&self, ctx: &EvaluationContext) -> ConditionResult {
1254        // Check if this SG12 contains AJT DE4465 with one of the specified codes.
1255        // When any of these codes is present, SG12 must be repeated until all
1256        // relevant complaint/claim numbers are listed in RFF segments.
1257        ctx.any_group_has_any_qualifier("AJT", 0, &["A34", "A39", "AA2", "AB2"], &["SG12"])
1258    }
1259
1260    /// [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...
1261    fn evaluate_535(&self, _ctx: &EvaluationContext) -> ConditionResult {
1262        // 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
1263        ConditionResult::True
1264    }
1265
1266    /// [536] Hinweis: Dieses DE darf keine Abschlagsrechnungsnummer enthalten
1267    fn evaluate_536(&self, _ctx: &EvaluationContext) -> ConditionResult {
1268        // Hinweis: Dieses DE darf keine Abschlagsrechnungsnummer enthalten — informational note about field usage restriction, always applies
1269        ConditionResult::True
1270    }
1271
1272    /// [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 ...
1273    fn evaluate_537(&self, _ctx: &EvaluationContext) -> ConditionResult {
1274        // 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
1275        ConditionResult::True
1276    }
1277
1278    /// [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 ...
1279    fn evaluate_538(&self, _ctx: &EvaluationContext) -> ConditionResult {
1280        // 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
1281        ConditionResult::True
1282    }
1283
1284    /// [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...
1285    fn evaluate_544(&self, _ctx: &EvaluationContext) -> ConditionResult {
1286        // 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
1287        ConditionResult::True
1288    }
1289
1290    /// [548] Hinweis: Die Befüllung des Datenelements ergibt sich aus dem zugehörigen EBD.
1291    fn evaluate_548(&self, _ctx: &EvaluationContext) -> ConditionResult {
1292        // Hinweis: Die Befüllung des Datenelements ergibt sich aus dem zugehörigen EBD.
1293        ConditionResult::True
1294    }
1295
1296    /// [549] Hinweis: Es darf nur eine Information im DE3148 übermittelt werden
1297    fn evaluate_549(&self, _ctx: &EvaluationContext) -> ConditionResult {
1298        // Hinweis: Es darf nur eine Information im DE3148 übermittelt werden — informational note, always applies
1299        ConditionResult::True
1300    }
1301
1302    /// [926] Format: Möglicher Wert: 0
1303    // 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)
1304    fn evaluate_926(&self, ctx: &EvaluationContext) -> ConditionResult {
1305        ctx.format_check("MOA", 0, 1, |val| validate_numeric(val, "==", 0.0))
1306    }
1307
1308    /// [930] Format: max. 2 Nachkommastellen
1309    // 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)
1310    fn evaluate_930(&self, ctx: &EvaluationContext) -> ConditionResult {
1311        ctx.format_check("MOA", 0, 1, |val| validate_max_decimal_places(val, 2))
1312    }
1313
1314    /// [931] Format: ZZZ = +00
1315    fn evaluate_931(&self, ctx: &EvaluationContext) -> ConditionResult {
1316        ctx.format_check("DTM", 0, 1, validate_timezone_utc)
1317    }
1318
1319    /// [939] Format: Die Zeichenkette muss die Zeichen @ und . enthalten
1320    fn evaluate_939(&self, ctx: &EvaluationContext) -> ConditionResult {
1321        ctx.format_check("COM", 0, 0, validate_email)
1322    }
1323
1324    /// [940] Format: Die Zeichenkette muss mit dem Zeichen + beginnen und danach dürfen nur noch Ziffern folgen
1325    fn evaluate_940(&self, ctx: &EvaluationContext) -> ConditionResult {
1326        ctx.format_check("COM", 0, 0, validate_phone)
1327    }
1328}