automapper-validation 0.2.0

AHB condition expression parsing, evaluation, and EDIFACT validation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
// <auto-generated>
// Generated by automapper-generator generate-conditions
// AHB: xml-migs-and-ahbs/FV2504/ORDERS_AHB_1_0a_Fehlerkorrektur_20250623.xml
// Generated: 2026-03-12T10:26:58Z
// </auto-generated>

// LLM-produced bodies aren't idiomatic Rust — silence stylistic lints at
// file scope so `cargo clippy -D warnings` stays green. Correctness,
// suspicious, and perf categories stay on so real bugs still surface.
#![allow(clippy::style, clippy::complexity)]

#[allow(unused_imports)]
use crate::eval::format_validators::*;
use crate::eval::{ConditionEvaluator, ConditionResult, EvaluationContext};

/// Generated condition evaluator for ORDERS FV2504.
pub struct OrdersConditionEvaluatorFV2504 {
    // External condition IDs that require runtime context.
    external_conditions: std::collections::HashSet<u32>,
}

impl Default for OrdersConditionEvaluatorFV2504 {
    fn default() -> Self {
        let mut external_conditions = std::collections::HashSet::new();
        external_conditions.insert(6);
        external_conditions.insert(7);
        external_conditions.insert(9);
        external_conditions.insert(15);
        external_conditions.insert(16);
        external_conditions.insert(17);
        external_conditions.insert(23);
        external_conditions.insert(26);
        external_conditions.insert(27);
        external_conditions.insert(28);
        external_conditions.insert(29);
        external_conditions.insert(36);
        external_conditions.insert(45);
        external_conditions.insert(60);
        external_conditions.insert(61);
        external_conditions.insert(62);
        external_conditions.insert(63);
        external_conditions.insert(76);
        external_conditions.insert(78);
        external_conditions.insert(82);
        external_conditions.insert(86);
        external_conditions.insert(91);
        external_conditions.insert(95);
        external_conditions.insert(96);
        external_conditions.insert(100);
        external_conditions.insert(101);
        external_conditions.insert(104);
        external_conditions.insert(105);
        external_conditions.insert(125);
        external_conditions.insert(126);
        external_conditions.insert(127);
        external_conditions.insert(128);
        external_conditions.insert(129);
        external_conditions.insert(131);
        external_conditions.insert(132);
        external_conditions.insert(133);
        external_conditions.insert(140);
        external_conditions.insert(141);
        external_conditions.insert(142);
        external_conditions.insert(143);
        external_conditions.insert(152);
        external_conditions.insert(153);
        external_conditions.insert(154);
        external_conditions.insert(155);
        external_conditions.insert(156);
        external_conditions.insert(157);
        external_conditions.insert(158);
        external_conditions.insert(159);
        external_conditions.insert(160);
        external_conditions.insert(162);
        external_conditions.insert(164);
        external_conditions.insert(165);
        external_conditions.insert(166);
        external_conditions.insert(172);
        external_conditions.insert(178);
        external_conditions.insert(179);
        external_conditions.insert(180);
        external_conditions.insert(492);
        external_conditions.insert(493);
        external_conditions.insert(2001);
        external_conditions.insert(2065);
        Self {
            external_conditions,
        }
    }
}

impl ConditionEvaluator for OrdersConditionEvaluatorFV2504 {
    fn message_type(&self) -> &str {
        "ORDERS"
    }

    fn format_version(&self) -> &str {
        "FV2504"
    }

    fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
        match condition {
            1 => self.evaluate_1(ctx),
            2 => self.evaluate_2(ctx),
            6 => self.evaluate_6(ctx),
            7 => self.evaluate_7(ctx),
            9 => self.evaluate_9(ctx),
            12 => self.evaluate_12(ctx),
            13 => self.evaluate_13(ctx),
            15 => self.evaluate_15(ctx),
            16 => self.evaluate_16(ctx),
            17 => self.evaluate_17(ctx),
            18 => self.evaluate_18(ctx),
            19 => self.evaluate_19(ctx),
            21 => self.evaluate_21(ctx),
            23 => self.evaluate_23(ctx),
            24 => self.evaluate_24(ctx),
            26 => self.evaluate_26(ctx),
            27 => self.evaluate_27(ctx),
            28 => self.evaluate_28(ctx),
            29 => self.evaluate_29(ctx),
            33 => self.evaluate_33(ctx),
            34 => self.evaluate_34(ctx),
            35 => self.evaluate_35(ctx),
            36 => self.evaluate_36(ctx),
            38 => self.evaluate_38(ctx),
            45 => self.evaluate_45(ctx),
            46 => self.evaluate_46(ctx),
            47 => self.evaluate_47(ctx),
            51 => self.evaluate_51(ctx),
            54 => self.evaluate_54(ctx),
            55 => self.evaluate_55(ctx),
            56 => self.evaluate_56(ctx),
            57 => self.evaluate_57(ctx),
            60 => self.evaluate_60(ctx),
            61 => self.evaluate_61(ctx),
            62 => self.evaluate_62(ctx),
            63 => self.evaluate_63(ctx),
            64 => self.evaluate_64(ctx),
            65 => self.evaluate_65(ctx),
            67 => self.evaluate_67(ctx),
            68 => self.evaluate_68(ctx),
            69 => self.evaluate_69(ctx),
            70 => self.evaluate_70(ctx),
            76 => self.evaluate_76(ctx),
            77 => self.evaluate_77(ctx),
            78 => self.evaluate_78(ctx),
            79 => self.evaluate_79(ctx),
            80 => self.evaluate_80(ctx),
            81 => self.evaluate_81(ctx),
            82 => self.evaluate_82(ctx),
            83 => self.evaluate_83(ctx),
            84 => self.evaluate_84(ctx),
            85 => self.evaluate_85(ctx),
            86 => self.evaluate_86(ctx),
            87 => self.evaluate_87(ctx),
            91 => self.evaluate_91(ctx),
            93 => self.evaluate_93(ctx),
            94 => self.evaluate_94(ctx),
            95 => self.evaluate_95(ctx),
            96 => self.evaluate_96(ctx),
            97 => self.evaluate_97(ctx),
            99 => self.evaluate_99(ctx),
            100 => self.evaluate_100(ctx),
            101 => self.evaluate_101(ctx),
            102 => self.evaluate_102(ctx),
            103 => self.evaluate_103(ctx),
            104 => self.evaluate_104(ctx),
            105 => self.evaluate_105(ctx),
            106 => self.evaluate_106(ctx),
            107 => self.evaluate_107(ctx),
            108 => self.evaluate_108(ctx),
            109 => self.evaluate_109(ctx),
            110 => self.evaluate_110(ctx),
            112 => self.evaluate_112(ctx),
            113 => self.evaluate_113(ctx),
            114 => self.evaluate_114(ctx),
            115 => self.evaluate_115(ctx),
            117 => self.evaluate_117(ctx),
            118 => self.evaluate_118(ctx),
            119 => self.evaluate_119(ctx),
            120 => self.evaluate_120(ctx),
            121 => self.evaluate_121(ctx),
            122 => self.evaluate_122(ctx),
            123 => self.evaluate_123(ctx),
            124 => self.evaluate_124(ctx),
            125 => self.evaluate_125(ctx),
            126 => self.evaluate_126(ctx),
            127 => self.evaluate_127(ctx),
            128 => self.evaluate_128(ctx),
            129 => self.evaluate_129(ctx),
            130 => self.evaluate_130(ctx),
            131 => self.evaluate_131(ctx),
            132 => self.evaluate_132(ctx),
            133 => self.evaluate_133(ctx),
            134 => self.evaluate_134(ctx),
            135 => self.evaluate_135(ctx),
            136 => self.evaluate_136(ctx),
            137 => self.evaluate_137(ctx),
            138 => self.evaluate_138(ctx),
            139 => self.evaluate_139(ctx),
            140 => self.evaluate_140(ctx),
            141 => self.evaluate_141(ctx),
            142 => self.evaluate_142(ctx),
            143 => self.evaluate_143(ctx),
            147 => self.evaluate_147(ctx),
            148 => self.evaluate_148(ctx),
            152 => self.evaluate_152(ctx),
            153 => self.evaluate_153(ctx),
            154 => self.evaluate_154(ctx),
            155 => self.evaluate_155(ctx),
            156 => self.evaluate_156(ctx),
            157 => self.evaluate_157(ctx),
            158 => self.evaluate_158(ctx),
            159 => self.evaluate_159(ctx),
            160 => self.evaluate_160(ctx),
            161 => self.evaluate_161(ctx),
            162 => self.evaluate_162(ctx),
            163 => self.evaluate_163(ctx),
            164 => self.evaluate_164(ctx),
            165 => self.evaluate_165(ctx),
            166 => self.evaluate_166(ctx),
            167 => self.evaluate_167(ctx),
            168 => self.evaluate_168(ctx),
            169 => self.evaluate_169(ctx),
            170 => self.evaluate_170(ctx),
            171 => self.evaluate_171(ctx),
            172 => self.evaluate_172(ctx),
            173 => self.evaluate_173(ctx),
            174 => self.evaluate_174(ctx),
            175 => self.evaluate_175(ctx),
            176 => self.evaluate_176(ctx),
            177 => self.evaluate_177(ctx),
            178 => self.evaluate_178(ctx),
            179 => self.evaluate_179(ctx),
            180 => self.evaluate_180(ctx),
            490 => self.evaluate_490(ctx),
            491 => self.evaluate_491(ctx),
            492 => self.evaluate_492(ctx),
            493 => self.evaluate_493(ctx),
            494 => self.evaluate_494(ctx),
            495 => self.evaluate_495(ctx),
            500 => self.evaluate_500(ctx),
            501 => self.evaluate_501(ctx),
            503 => self.evaluate_503(ctx),
            506 => self.evaluate_506(ctx),
            507 => self.evaluate_507(ctx),
            514 => self.evaluate_514(ctx),
            515 => self.evaluate_515(ctx),
            517 => self.evaluate_517(ctx),
            518 => self.evaluate_518(ctx),
            519 => self.evaluate_519(ctx),
            521 => self.evaluate_521(ctx),
            522 => self.evaluate_522(ctx),
            523 => self.evaluate_523(ctx),
            525 => self.evaluate_525(ctx),
            527 => self.evaluate_527(ctx),
            530 => self.evaluate_530(ctx),
            531 => self.evaluate_531(ctx),
            532 => self.evaluate_532(ctx),
            533 => self.evaluate_533(ctx),
            535 => self.evaluate_535(ctx),
            536 => self.evaluate_536(ctx),
            539 => self.evaluate_539(ctx),
            540 => self.evaluate_540(ctx),
            542 => self.evaluate_542(ctx),
            543 => self.evaluate_543(ctx),
            545 => self.evaluate_545(ctx),
            547 => self.evaluate_547(ctx),
            548 => self.evaluate_548(ctx),
            549 => self.evaluate_549(ctx),
            550 => self.evaluate_550(ctx),
            551 => self.evaluate_551(ctx),
            552 => self.evaluate_552(ctx),
            553 => self.evaluate_553(ctx),
            554 => self.evaluate_554(ctx),
            555 => self.evaluate_555(ctx),
            557 => self.evaluate_557(ctx),
            558 => self.evaluate_558(ctx),
            559 => self.evaluate_559(ctx),
            560 => self.evaluate_560(ctx),
            561 => self.evaluate_561(ctx),
            562 => self.evaluate_562(ctx),
            563 => self.evaluate_563(ctx),
            564 => self.evaluate_564(ctx),
            566 => self.evaluate_566(ctx),
            567 => self.evaluate_567(ctx),
            568 => self.evaluate_568(ctx),
            569 => self.evaluate_569(ctx),
            570 => self.evaluate_570(ctx),
            571 => self.evaluate_571(ctx),
            572 => self.evaluate_572(ctx),
            573 => self.evaluate_573(ctx),
            574 => self.evaluate_574(ctx),
            575 => self.evaluate_575(ctx),
            576 => self.evaluate_576(ctx),
            903 => self.evaluate_903(ctx),
            906 => self.evaluate_906(ctx),
            911 => self.evaluate_911(ctx),
            914 => self.evaluate_914(ctx),
            922 => self.evaluate_922(ctx),
            930 => self.evaluate_930(ctx),
            931 => self.evaluate_931(ctx),
            932 => self.evaluate_932(ctx),
            933 => self.evaluate_933(ctx),
            934 => self.evaluate_934(ctx),
            935 => self.evaluate_935(ctx),
            939 => self.evaluate_939(ctx),
            940 => self.evaluate_940(ctx),
            950 => self.evaluate_950(ctx),
            951 => self.evaluate_951(ctx),
            955 => self.evaluate_955(ctx),
            960 => self.evaluate_960(ctx),
            961 => self.evaluate_961(ctx),
            962 => self.evaluate_962(ctx),
            967 => self.evaluate_967(ctx),
            2001 => self.evaluate_2001(ctx),
            2002 => self.evaluate_2002(ctx),
            2003 => self.evaluate_2003(ctx),
            2004 => self.evaluate_2004(ctx),
            2005 => self.evaluate_2005(ctx),
            2006 => self.evaluate_2006(ctx),
            2007 => self.evaluate_2007(ctx),
            2044 => self.evaluate_2044(ctx),
            2050 => self.evaluate_2050(ctx),
            2060 => self.evaluate_2060(ctx),
            2061 => self.evaluate_2061(ctx),
            2062 => self.evaluate_2062(ctx),
            2063 => self.evaluate_2063(ctx),
            2064 => self.evaluate_2064(ctx),
            2065 => self.evaluate_2065(ctx),
            2066 => self.evaluate_2066(ctx),
            2088 => self.evaluate_2088(ctx),
            2089 => self.evaluate_2089(ctx),
            2090 => self.evaluate_2090(ctx),
            2092 => self.evaluate_2092(ctx),
            2094 => self.evaluate_2094(ctx),
            2095 => self.evaluate_2095(ctx),
            2096 => self.evaluate_2096(ctx),
            2097 => self.evaluate_2097(ctx),
            2098 => self.evaluate_2098(ctx),
            2099 => self.evaluate_2099(ctx),
            _ => ConditionResult::Unknown,
        }
    }

    fn is_external(&self, condition: u32) -> bool {
        self.external_conditions.contains(&condition)
    }
    fn is_known(&self, condition: u32) -> bool {
        matches!(
            condition,
            1 | 2
                | 6
                | 7
                | 9
                | 12
                | 13
                | 15
                | 16
                | 17
                | 18
                | 19
                | 21
                | 23
                | 24
                | 26
                | 27
                | 28
                | 29
                | 33
                | 34
                | 35
                | 36
                | 38
                | 45
                | 46
                | 47
                | 51
                | 54
                | 55
                | 56
                | 57
                | 60
                | 61
                | 62
                | 63
                | 64
                | 65
                | 67
                | 68
                | 69
                | 70
                | 76
                | 77
                | 78
                | 79
                | 80
                | 81
                | 82
                | 83
                | 84
                | 85
                | 86
                | 87
                | 91
                | 93
                | 94
                | 95
                | 96
                | 97
                | 99
                | 100
                | 101
                | 102
                | 103
                | 104
                | 105
                | 106
                | 107
                | 108
                | 109
                | 110
                | 112
                | 113
                | 114
                | 115
                | 117
                | 118
                | 119
                | 120
                | 121
                | 122
                | 123
                | 124
                | 125
                | 126
                | 127
                | 128
                | 129
                | 130
                | 131
                | 132
                | 133
                | 134
                | 135
                | 136
                | 137
                | 138
                | 139
                | 140
                | 141
                | 142
                | 143
                | 147
                | 148
                | 152
                | 153
                | 154
                | 155
                | 156
                | 157
                | 158
                | 159
                | 160
                | 161
                | 162
                | 163
                | 164
                | 165
                | 166
                | 167
                | 168
                | 169
                | 170
                | 171
                | 172
                | 173
                | 174
                | 175
                | 176
                | 177
                | 178
                | 179
                | 180
                | 490
                | 491
                | 492
                | 493
                | 494
                | 495
                | 500
                | 501
                | 503
                | 506
                | 507
                | 514
                | 515
                | 517
                | 518
                | 519
                | 521
                | 522
                | 523
                | 525
                | 527
                | 530
                | 531
                | 532
                | 533
                | 535
                | 536
                | 539
                | 540
                | 542
                | 543
                | 545
                | 547
                | 548
                | 549
                | 550
                | 551
                | 552
                | 553
                | 554
                | 555
                | 557
                | 558
                | 559
                | 560
                | 561
                | 562
                | 563
                | 564
                | 566
                | 567
                | 568
                | 569
                | 570
                | 571
                | 572
                | 573
                | 574
                | 575
                | 576
                | 903
                | 906
                | 911
                | 914
                | 922
                | 930
                | 931
                | 932
                | 933
                | 934
                | 935
                | 939
                | 940
                | 950
                | 951
                | 955
                | 960
                | 961
                | 962
                | 967
                | 2001
                | 2002
                | 2003
                | 2004
                | 2005
                | 2006
                | 2007
                | 2044
                | 2050
                | 2060
                | 2061
                | 2062
                | 2063
                | 2064
                | 2065
                | 2066
                | 2088
                | 2089
                | 2090
                | 2092
                | 2094
                | 2095
                | 2096
                | 2097
                | 2098
                | 2099
        )
    }
}

impl OrdersConditionEvaluatorFV2504 {
    /// [16] Wenn eine untergeordnete SG vorhanden
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Generic structural condition: 'if a subordinate SG is present'. Depends entirely on which child segment group is being checked in context — the condition number is reused across many segment rows with different child SGs. Cannot be resolved from the EDIFACT message content alone; requires the validation framework to supply structural position context. (medium confidence)
    fn evaluate_16(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("subordinate_sg_present")
    }

    /// [17] Wenn ein Segment innerhalb der SG vorhanden
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Generic structural condition: 'if a segment within the SG is present'. Like [16], this condition number is reused across many rows and the specific segment being checked depends on the validation context. Cannot determine which segment to check without positional context supplied externally. (medium confidence)
    fn evaluate_17(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("segment_within_sg_present")
    }

    /// [78] Wenn in derselben SG29 mit Z55 in LIN DE1229 (Erforderliches Produkt der Netzlokation) das PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen, Kapitel 2 „Codeliste der Standard-...
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Requires checking PIA DE7140 against an external code list from 'Codeliste der Konfigurationen, Kapitel 2 – Codeliste der Standard-Messprodukt Strom für Werte nach Typ 1' filtered to those with the Werteigenschaft 'Blindarbeit'. The structural check (LIN Z55 + PIA+5 in same SG29) is possible via navigator, but the code list membership for 'Blindarbeit' products is an external reference that cannot be determined from the EDIFACT message alone. (medium confidence)
    fn evaluate_78(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("pia_has_blindarbeit_product_netzlokation")
    }

    /// [82] Wenn eine andere SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) mit PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen, Kapitel 2.1.1 „Standard-Messproduk...
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Requires: (1) finding ANOTHER SG29 (not the current one) where LIN DE1229 = Z54, (2) that SG29 also has PIA+5, and (3) PIA DE7140 is from 'Codeliste der Konfigurationen, Kapitel 2.1.1 – Standard-Messprodukt der Marktlokation mit der Wahlmöglichkeit der Zuordnung einer Zählzeit'. The code list membership is external and cannot be determined from the EDIFACT message alone. (medium confidence)
    fn evaluate_82(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("other_sg29_z54_with_zaehlzeit_product")
    }

    /// [83] Wenn keine andere SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) mit PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen Kapitel 2.1.1 „Standard-Messproduk...
    // REVIEW: Logical negation of condition [82]: 'wenn KEINE andere SG29 mit Z54 ... vorhanden ist'. Implemented by inverting the external result for [82]. Returns Unknown when the underlying external condition is Unknown (e.g., code list not available). (medium confidence)
    fn evaluate_83(&self, ctx: &EvaluationContext) -> ConditionResult {
        match ctx
            .external
            .evaluate("other_sg29_z54_with_zaehlzeit_product")
        {
            ConditionResult::True => ConditionResult::False,
            ConditionResult::False => ConditionResult::True,
            ConditionResult::Unknown => ConditionResult::Unknown,
        }
    }

    /// [86] Wenn in derselben SG29 mit Z19 in LIN DE1229 (Erforderliches Produkt der Messlokation) das PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen Kapitel 2.3.1 "Standard-Messprodukt d...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_86(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("pia_z19_has_standard_messprodukt_with_zählzeit_wahlmöglichkeit")
    }

    /// [91] Wenn in diesem Datenelement kein anderes Paket zur Möglichkeit der Angabe von mindestens einem anderen Code führt.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_91(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("no_other_package_enables_additional_code")
    }

    /// [126] Es sind nur die Konfigurations-Produkte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.2 „Konfigurationsprodukte Leistungskurvendefinition“ enthalten sind.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_126(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("product_in_konfigurationsprodukte_leistungskurvendefinition")
    }

    /// [127] Es sind nur die Konfigurations-Produkte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.3 „Konfigurationsprodukte Ad-Hoc-Steuerkanal“ enthalten sind.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_127(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("product_in_konfigurationsprodukte_ad_hoc_steuerkanal")
    }

    /// [128] Es sind nur die Messprodukte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.5 „Messprodukte für Werte nach Typ 2 aus Backend für LF und NB“ enthalten sind.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_128(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("product_in_messprodukte_typ2_backend_lf_nb")
    }

    /// [129] Es sind nur die Messprodukte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.4 „Messprodukte mit Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW“ enthalten sind.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_129(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("product_in_smgw_typ2_konfiguration_codeliste")
    }

    /// [141] Es sind nur die Messprodukt-Position-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.7 „Art der Werte für Messprodukte nach Typ 2“ enthalten sind.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_141(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("messprodukt_position_code_in_typ2_art_codeliste")
    }

    /// [142] Wenn innerhalb derselben SG29 LIN im PIA+5 DE7140 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) ein Produkt angegeben ist, das in der Codeliste der Konfigurationen...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_142(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("smgw_product_triggers_on_threshold_crossing")
    }

    /// [143] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Steuerbaren Ressource angegeben ist
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_143(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("meldepunkt_is_steuerbare_ressource")
    }

    /// [152] Wenn in SG29 LIN (Erforderliches Produkt der Messlokation) das PIA+5 DE7140 mit einem Produkt-Code vorhanden ist der in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_152(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("messlokation_product_is_weitere_energieflussrichtung")
    }

    /// [153] Es sind nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Ebene" mit dem Wert "Mess...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_153(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("product_code_level_messlokation")
    }

    /// [154] Es sind nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Ebene" mit dem Wert "Netz...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_154(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("product_code_level_netzlokation")
    }

    /// [155] Es sind nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Ebene" mit dem Wert "Steu...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_155(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("product_code_level_steuerbare_ressource")
    }

    /// [156] Es sind weiterhin nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Produkt gegenü...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_156(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("product_code_orderable_by_nb")
    }

    /// [157] Es sind weiterhin nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Produkt gegenü...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_157(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("product_code_orderable_by_lf")
    }

    /// [158] Es sind nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 6.2 "Produkte zur Bestellung einer Änderung von Abrechnungsdaten" genannt sind.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_158(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("product_code_in_abrechnungsdaten_configuration_list")
    }

    /// [159] Wenn in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 ein Produkt-Code genannt ist, der in der Codeliste der Konfigurationen im Kapitel 6.2 "Produkte zur Bestellung e...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_159(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("abrechnungsdaten_product_has_property_code_column")
    }

    /// [160] Es sind nur die Codes der Produkteigenschaft zu dem in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 erlaubt, die in der Codeliste der Konfigurationen im Kapitel 6.2 ...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_160(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("abrechnungsdaten_property_code_matches_product_row")
    }

    /// [162] Es ist nur der Wertebereich erlaubt, der zu dem in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 genannten Produkt, das in der Codeliste der Konfigurationen im Kapite...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_162(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("abrechnungsdaten_value_range_matches_product_row")
    }

    /// [164] Wenn die Konfiguration der in SG34 RFF+Z20 DE1154 (Referenz auf ID der Tranche) genannte Tranche innerhalb derselben SG29 LIN++Z16 (Erforderliches Produkt der Tranche) unverändert bestehen bleibt.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_164(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("tranche_configuration_unchanged")
    }

    /// [165] Wenn die Konfiguration der in SG34 RFF+Z20 DE1154 (Referenz auf ID der Tranche) genannte Tranche innerhalb derselben SG29 LIN++Z16 (Erforderliches Produkt der Tranche) aufgrund einer Zuordnung eine...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_165(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("tranche_reconfiguration_by_lf_assignment")
    }

    /// [166] Wenn es sich um die Einrichtung der Konfigurationen aufgrund einer Zuordnung eines LF zu einer Tranche handelt
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_166(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("configuration_setup_by_lf_tranche_assignment")
    }

    /// [172] Wenn es sich bei der in SG2 LOC+172 DE3225 genannten Lokation um die Integration in eine Kundenanlage oder Herauslösung aus einer Kundenanlage nach §20 Abs.1d EnWG handelt. Details siehe UTILMD A...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_172(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("location_is_kundenanlage_integration_or_removal")
    }

    /// [178] Wenn vom NB eine Abtretungserklärung vom Kunden gewünscht ist.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_178(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("nb_requires_assignment_declaration")
    }

    /// [179] Wenn in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 das Produkt "Empfänger der Vergütung zur Einspeisung" aus der Codeliste der Konfigurationen im Kapitel 6.2 "Pr...
    /// EXTERNAL: Requires context from outside the message — codelist chapter 6.2 "Produkte zur Bestellung …" defines the product codes.
    fn evaluate_179(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("empfaenger_verguetung_einspeisung_and_lieferant")
    }

    /// [180] Wenn in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 ein Produkt-Code genannt ist der in der Codeliste der Konfigurationen im Kapitel 6.2 "Produkte zur Bestellung ei...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_180(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("product_code_abrechnungsdaten_valid")
    }

    /// [490] wenn Wert in diesem DE, an der Stelle CCYYMMDDHHMM ein Zeitpunkt aus dem angegeben Zeitraum der Tabelle Kapitel 3.5 „Übersicht gesetzliche deutsche Sommerzeit (MESZ)“ der Spalten: „Sommerzei...
    fn evaluate_490(&self, ctx: &EvaluationContext) -> ConditionResult {
        match ctx.resolved_value {
            Some(val) => is_mesz_utc(val),
            None => ConditionResult::False,
        }
    }

    /// [491] wenn Wert in diesem DE, an der Stelle CCYYMMDDHHMM ein Zeitpunkt aus dem angegeben Zeitraum der Tabelle Kapitel 3.6 „Übersicht gesetzliche deutsche Zeit (MEZ)“ der Spalten: „Winterzeit (MEZ)...
    fn evaluate_491(&self, ctx: &EvaluationContext) -> ConditionResult {
        match ctx.resolved_value {
            Some(val) => is_mez_utc(val),
            None => ConditionResult::False,
        }
    }

    /// [967] Format: Zertifikatskörper gemäß X509.1, BSI TR-03109-4
    fn evaluate_967(&self, ctx: &EvaluationContext) -> ConditionResult {
        // Structural check on the certificate body (base64 charset + plausible
        // length). Cryptographic validation (signature, CA, BSI profile) is
        // out of scope for static AHB validation.
        match ctx.resolved_value {
            Some(val) => validate_x509_cert_body(val),
            None => ConditionResult::Unknown,
        }
    }

    /// [2001] Die SG29 ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum) Tranchen zu der in der SG2 genannten Marktlokation vorhanden sind.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_2001(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("sg29_tranche_count_matches")
    }

    /// [2003] Die SG29 ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum) Messlokationen zu der in der SG2 genannten Marktlokation vorhanden sind und für jede dieser Messlokationen müssen alle M...
    fn evaluate_2003(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: SG29 repetition cardinality rule — informational annotation documenting that
        // SG29 must repeat once per Messlokation associated with the Marktlokation from DTM+203,
        // and all Messprodukte for each Messlokation (including Tranchen) must be listed.
        // This is a structural cardinality guidance note, always applies.
        ConditionResult::True
    }

    /// [2065] Diese SG30 ist so oft zu wiederholen, wie zu den unterschiedlichen Messprodukt-Position-Codes zu dem innerhalb derselben SG29 LIN im PIA+5 DE7140 (Erforderliches Produkt Konfigurationserlaubnis fü...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_2065(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("sg30_configuration_threshold_product_cardinality")
    }

    /// [1] Wenn IMD+Z03 vorhanden
    fn evaluate_1(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("IMD", 0, "Z03")
    }

    /// [2] Wenn BGM+7 vorhanden
    fn evaluate_2(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("BGM", 0, "7")
    }

    /// [6] Wenn MP-ID in SG2 NAD+MS mit Rolle LF vorhanden
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_6(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("sender_is_lf")
    }

    /// [7] Wenn MP-ID in SG2 NAD+MS mit Rolle NB vorhanden
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_7(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("sender_is_nb")
    }

    /// [9] Wenn bekannt
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: 'Wenn bekannt' (when known) depends on whether a value is known in the business context — cannot be derived from EDIFACT segments alone. (medium confidence)
    fn evaluate_9(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("information_is_known")
    }

    /// [12] Wenn vorhanden
    // REVIEW: Condition 12 'Wenn vorhanden' is a generic self-referential meta-condition indicating that the attached validation rule applies whenever the field is populated. The validator framework handles actual presence detection; this evaluator simply returns True to indicate the rule is always applicable when invoked. (medium confidence)
    fn evaluate_12(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Wenn vorhanden — generic 'when present' meta-condition
        // In AHB context this means: validation applies whenever the field is populated.
        // Returning True here defers the presence check to the validator framework itself.
        ConditionResult::True
    }

    /// [13] Wenn SG2 LOC+172 nicht vorhanden
    fn evaluate_13(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LOC", 0, "172")
    }

    /// [15] Wenn MP-ID in SG2 NAD+MS mit Rolle MSB vorhanden
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_15(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("sender_is_msb")
    }

    /// [18] Wenn IMD++Z11 vorhanden
    fn evaluate_18(&self, ctx: &EvaluationContext) -> ConditionResult {
        let imds = ctx.find_segments("IMD");
        ConditionResult::from(imds.iter().any(|s| {
            s.elements
                .get(1)
                .and_then(|e| e.first())
                .is_some_and(|v| v == "Z11")
        }))
    }

    /// [19] Wenn IMD++Z12 vorhanden
    fn evaluate_19(&self, ctx: &EvaluationContext) -> ConditionResult {
        let imds = ctx.find_segments("IMD");
        ConditionResult::from(imds.iter().any(|s| {
            s.elements
                .get(1)
                .and_then(|e| e.first())
                .is_some_and(|v| v == "Z12")
        }))
    }

    /// [21] Wenn BGM+Z28 vorhanden
    fn evaluate_21(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("BGM", 0, "Z28")
    }

    /// [23] Wenn MP-ID in SG2 NAD+MR mit Rolle NB vorhanden
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_23(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("recipient_is_nb")
    }

    /// [24] Wenn IMD++Z35 vorhanden
    fn evaluate_24(&self, ctx: &EvaluationContext) -> ConditionResult {
        let imds = ctx.find_segments("IMD");
        ConditionResult::from(imds.iter().any(|s| {
            s.elements
                .get(1)
                .and_then(|e| e.first())
                .is_some_and(|v| v == "Z35")
        }))
    }

    /// [26] Wenn MP-ID in SG2 NAD+MS mit Rolle ÜNB vorhanden
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Whether the NAD+MS market participant holds the role ÜNB (Übertragungsnetzbetreiber) cannot be determined from the EDIFACT message content alone. The role is a business context attribute of the MP-ID that requires an external master data lookup (e.g. Marktstammdatenregister or internal role registry). Marked external with name 'sender_is_uenb'. (medium confidence)
    fn evaluate_26(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("sender_is_uenb")
    }

    /// [27] Wenn MP-ID in SG2 NAD+MR mit Rolle MSB vorhanden
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Whether the NAD+MR market participant holds the role MSB (Messstellenbetreiber) cannot be determined from the EDIFACT message content alone. The role is a business context attribute of the MP-ID requiring external master data. Marked external with name 'recipient_is_msb'. (medium confidence)
    fn evaluate_27(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("recipient_is_msb")
    }

    /// [28] Wenn MP-ID in SG2 NAD+MR aus Sparte Strom
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_28(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("recipient_market_sector_is_strom")
    }

    /// [29] Wenn MP-ID in SG2 NAD+MR aus Sparte Gas
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_29(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("recipient_market_sector_is_gas")
    }

    /// [33] Wenn IMD+Z01 vorhanden
    fn evaluate_33(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("IMD", 1, "Z01")
    }

    /// [34] Wenn IMD+Z02 vorhanden
    fn evaluate_34(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("IMD", 1, "Z02")
    }

    /// [35] IMD++Z14+Z06 vorhanden
    fn evaluate_35(&self, ctx: &EvaluationContext) -> ConditionResult {
        let imds = ctx.find_segments("IMD");
        let found = imds.iter().any(|s| {
            let has_z14 = s
                .elements
                .get(1)
                .and_then(|e| e.first())
                .is_some_and(|v| v == "Z14");
            let has_z06 = s
                .elements
                .get(2)
                .and_then(|e| e.first())
                .is_some_and(|v| v == "Z06");
            has_z14 && has_z06
        });
        ConditionResult::from(found)
    }

    /// [36] Wenn MP-ID in SG2 NAD+MR mit Rolle NB nicht vorhanden
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_36(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("recipient_role_is_not_nb")
    }

    /// [38] Wenn FTX+Z04/Z05 vorhanden
    fn evaluate_38(&self, ctx: &EvaluationContext) -> ConditionResult {
        let found = ctx.find_segments("FTX").iter().any(|s| {
            s.elements
                .first()
                .and_then(|e| e.first())
                .is_some_and(|v| v == "Z04" || v == "Z05")
        });
        ConditionResult::from(found)
    }

    /// [45] Wenn MP-ID in SG2 NAD+MS mit Rolle MSB nicht vorhanden
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_45(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("sender_role_is_not_msb")
    }

    /// [46] Wenn SG29 IMD++Z46 vorhanden
    fn evaluate_46(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("IMD", 1, "Z46")
    }

    /// [47] Wenn SG29 IMD++Z46  nicht vorhanden
    fn evaluate_47(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("IMD", 1, "Z46")
    }

    /// [51] Wenn BGM+Z48 vorhanden
    fn evaluate_51(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("BGM", 0, "Z48")
    }

    /// [54] Wenn FTX+Z06 vorhanden
    fn evaluate_54(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("FTX", 0, "Z06")
    }

    /// [55] Wenn DTM+469 (Beginn zum nächstmöglichen Termin) nicht vorhanden
    fn evaluate_55(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("DTM", 0, "469")
    }

    /// [56] Wenn DTM+203 (Ausführungsdatum) nicht vorhanden
    fn evaluate_56(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("DTM", 0, "203")
    }

    /// [57] Wenn im selben SG2 NAD DE3124 nicht vorhanden
    // REVIEW: Checks if any NAD segment in the message lacks DE3124 (C058 at elements[2][0]). 'Im selben SG2' requires group context; falls back to message-wide check. DE3124 is the first component of C058 (Zeile für Name und Anschrift / Zusatzinfo). (medium confidence)
    fn evaluate_57(&self, ctx: &EvaluationContext) -> ConditionResult {
        let nads = ctx.find_segments("NAD");
        if nads.is_empty() {
            return ConditionResult::Unknown;
        }
        let any_without = nads.iter().any(|nad| {
            nad.elements
                .get(2)
                .and_then(|e| e.first())
                .map(|v| v.is_empty())
                .unwrap_or(true)
        });
        ConditionResult::from(any_without)
    }

    /// [60] MP-ID nur aus Sparte Gas
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_60(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("market_location_is_gas")
    }

    /// [61] MP-ID nur aus Sparte Strom
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_61(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("market_location_is_electricity")
    }

    /// [62] MP-ID mit Rolle MSB
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_62(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("sender_is_msb")
    }

    /// [63] MP-ID mit Rolle NB
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_63(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("sender_is_nb")
    }

    /// [64] Wenn SG2 NAD+Z03 nicht vorhanden
    fn evaluate_64(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("NAD", 0, "Z03")
    }

    /// [65] Wenn FTX+Z08 vorhanden
    fn evaluate_65(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("FTX", 0, "Z08")
    }

    /// [67] Wenn DTM+163 nicht vorhanden
    fn evaluate_67(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("DTM", 0, "163")
    }

    /// [68] Wenn DTM+7 nicht vorhanden
    fn evaluate_68(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("DTM", 0, "7")
    }

    /// [69] Wenn NAD+Z23 nicht vorhanden
    fn evaluate_69(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("NAD", 0, "Z23")
    }

    /// [70] Wenn NAD+Z03 nicht vorhanden
    fn evaluate_70(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("NAD", 0, "Z03")
    }

    /// [76] Wenn in derselben SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) das PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen Kapitel 2.1.1 "Standard-Messprodukt ...
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_76(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("pia_product_in_standard_messprodukt_wahlmoeglichkeit_list")
    }

    /// [77] Wenn im selben CCI im DE7059 der Code Z39 (Code der Zählzeitdefinition) vorhanden ist
    // REVIEW: Checks if a CCI segment in the same SG29 group has DE7059 == 'Z39' (Code der Zählzeitdefinition). DE7059 is the class/type code at elements[0][0] in CCI. Group-scoped to SG29 with message-wide fallback. (medium confidence)
    fn evaluate_77(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_qualifier("CCI", 0, "Z39", &["SG29"])
    }

    /// [79] Wenn eine andere SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) mit PIA+5+9991000000078:Z11 (für Wirkarbeit Lastgang 1/4 stündlich) vorhanden ist
    // REVIEW: Checks if any SG29 instance contains both LIN with Z54 at elements[1][0] and PIA with product code 9991000000078 at elements[1][0]. The 'another SG29' nuance is approximated as 'any SG29' since we have no current-group context. (medium confidence)
    fn evaluate_79(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_co_occurrence(
            "LIN",
            1,
            &["Z54"],
            "PIA",
            1,
            0,
            &["9991000000078"],
            &["SG29"],
        )
    }

    /// [80] Wenn keine andere SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) mit PIA+5+9991000000078:Z11 (Wirkarbeit Lastgang 1/4 stündlich) vorhanden ist
    // REVIEW: Negation of condition 79 — no SG29 with LIN+Z54 AND PIA product 9991000000078. (medium confidence)
    fn evaluate_80(&self, ctx: &EvaluationContext) -> ConditionResult {
        match ctx.any_group_has_co_occurrence(
            "LIN",
            1,
            &["Z54"],
            "PIA",
            1,
            0,
            &["9991000000078"],
            &["SG29"],
        ) {
            ConditionResult::True => ConditionResult::False,
            ConditionResult::False => ConditionResult::True,
            ConditionResult::Unknown => ConditionResult::Unknown,
        }
    }

    /// [81] Wenn in derselben SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation), das PIA+5+9991000000078:Z11 (Wirkarbeit Lastgang 1/4 stündlich) vorhanden ist
    // REVIEW: Group-scoped co-occurrence in the same SG29: LIN with Z54 at elements[1][0] AND PIA with product code 9991000000078 at elements[1][0]. Functionally equivalent to condition 79 since the API checks within the same group instance. (medium confidence)
    fn evaluate_81(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_co_occurrence(
            "LIN",
            1,
            &["Z54"],
            "PIA",
            1,
            0,
            &["9991000000078"],
            &["SG29"],
        )
    }

    /// [84] IMD++Z14+Z07 vorhanden
    // REVIEW: Checks for IMD segment where elements[1][0]='Z14' (item characteristic) and elements[2][0]='Z07' (item description code). IMD++Z14+Z07 maps directly to these positions. (medium confidence)
    fn evaluate_84(&self, ctx: &EvaluationContext) -> ConditionResult {
        {
            let segments = ctx.find_segments("IMD");
            ConditionResult::from(segments.iter().any(|s| {
                s.elements
                    .get(1)
                    .and_then(|e| e.first())
                    .is_some_and(|v| v == "Z14")
                    && s.elements
                        .get(2)
                        .and_then(|e| e.first())
                        .is_some_and(|v| v == "Z07")
            }))
        }
    }

    /// [85] Wenn in derselben SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation), das PIA+5+9991000000086:Z11 (Wirkarbeit höchste 1/4 Stunde im Monat) vorhanden ist
    // REVIEW: Group-scoped co-occurrence in SG29: LIN with Z54 at elements[1][0] AND PIA with product code 9991000000086 (Wirkarbeit höchste 1/4 Stunde im Monat) at elements[1][0]. (medium confidence)
    fn evaluate_85(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_co_occurrence(
            "LIN",
            1,
            &["Z54"],
            "PIA",
            1,
            0,
            &["9991000000086"],
            &["SG29"],
        )
    }

    /// [87] Wenn FTX+Z09/Z10 vorhanden
    fn evaluate_87(&self, ctx: &EvaluationContext) -> ConditionResult {
        {
            let segs = ctx.find_segments("FTX");
            ConditionResult::from(segs.iter().any(|s| {
                s.elements
                    .first()
                    .and_then(|e| e.first())
                    .is_some_and(|v| v == "Z09" || v == "Z10")
            }))
        }
    }

    /// [93] Wenn in derselben Nachricht eine SG29 mit Z16 in LIN DE1229 (Erforderliches Produkt der Tranche) nicht vorhanden
    fn evaluate_93(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LIN", 1, "Z16")
    }

    /// [94] Wenn in derselben Nachricht eine SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) nicht vorhanden
    fn evaluate_94(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LIN", 1, "Z54")
    }

    /// [95] Messprodukt-Code aus dem Kapitel 2.1 "Standard-Messprodukte der Marktlokation" der Codeliste der Konfigurationen
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_95(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("messprodukt_standard_marktlokation")
    }

    /// [96] Messprodukt-Code aus dem Kapitel 2.2 "Standard-Messprodukte der Tranche" der Codeliste der Konfigurationen
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_96(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("messprodukt_standard_tranche")
    }

    /// [97] Wenn FTX+Z10 vorhanden
    fn evaluate_97(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("FTX", 0, "Z10")
    }

    /// [99] Wenn FTX+Z08/Z10 vorhanden
    fn evaluate_99(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_any_qualifier("FTX", 0, &["Z08", "Z10"], &["SG29"])
    }

    /// [100] Messprodukt-Code aus dem Kapitel 2.3 "Standard-Messprodukte der Messlokation" der Codeliste der Konfigurationen
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_100(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("messprodukt_standard_messlokation")
    }

    /// [101] Wenn MP-ID in SG2 NAD+MR mit Rolle MSB in der Sparte Gas nicht vorhanden
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Checking whether the NAD+MR recipient has role MSB in Sparte Gas requires external business context about market participant roles — not determinable from message content alone. (medium confidence)
    fn evaluate_101(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("recipient_is_msb_gas")
    }

    /// [102] Wenn in derselben SG29 LIN das CCI+++Z25 (Geräteart Wandler) vorhanden
    fn evaluate_102(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_qualifier("CCI", 2, "Z25", &["SG29"])
    }

    /// [103] Wenn in derselben SG29 LIN das CCI+++Z25 (Geräteart Wandler) nicht vorhanden
    fn evaluate_103(&self, ctx: &EvaluationContext) -> ConditionResult {
        match ctx.any_group_has_qualifier("CCI", 2, "Z25", &["SG29"]) {
            ConditionResult::True => ConditionResult::False,
            ConditionResult::False => ConditionResult::True,
            ConditionResult::Unknown => ConditionResult::Unknown,
        }
    }

    /// [104] Wenn MP-ID in SG2 NAD+VY mit Rolle LF vorhanden
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Checking whether the NAD+VY party has role LF requires external market participant role context — cannot be determined from the EDIFACT message alone. (medium confidence)
    fn evaluate_104(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("nad_vy_is_lf")
    }

    /// [105] Wenn die bisherige Konfiguration mit Zählzeiten des LF vom LF beendet werden soll
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_105(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("bisherige_konfiguration_zaehltzeiten_lf_beenden")
    }

    /// [106] wenn IMD++Z60 (Abbestellung Messprodukt mit Zählzeitdefinition des LF) nicht vorhanden
    fn evaluate_106(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("IMD", 1, "Z60")
    }

    /// [107] Wenn IMD++Z57 (Abbestellung Zählzeitdefinition) nicht vorhanden
    fn evaluate_107(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("IMD", 1, "Z57")
    }

    /// [108] Wenn RFF+AGK (Konfigurations-ID) nicht vorhanden
    fn evaluate_108(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("RFF", 0, "AGK")
    }

    /// [109] Wenn LOC+172 (Meldepunkt) nicht vorhanden
    fn evaluate_109(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LOC", 0, "172")
    }

    /// [110] wenn DTM+163 (Beginn Zeitraum für Wertanfrage) vorhanden
    fn evaluate_110(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("DTM", 0, "163")
    }

    /// [112] Wenn in derselben SG29 LIN++Z54 (Erforderliches Produkt der Marktlokation), das PIA+5+9991000000078: Z11 (Wirkarbeit Lastgang 1/4 stündlich) vorhanden ist
    // REVIEW: In same SG29: LIN with elements[1][0]=Z54 (Erforderliches Produkt der Marktlokation) co-occurs with PIA where elements[1][0]=9991000000078 (Wirkarbeit Lastgang 1/4h, product code from C212.DE7140). Co-occurrence check scoped to SG29. (medium confidence)
    fn evaluate_112(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_co_occurrence(
            "LIN",
            1,
            &["Z54"],
            "PIA",
            1,
            0,
            &["9991000000078"],
            &["SG29"],
        )
    }

    /// [113] Wenn LIN DE1229 mit Code Z42 (Zählzeitdefinition) vorhanden
    fn evaluate_113(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("LIN", 1, "Z42")
    }

    /// [114] Wenn LIN DE1229 mit Code Z69 (Schaltzeitdefinition) vorhanden
    fn evaluate_114(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("LIN", 1, "Z69")
    }

    /// [115] Wenn LIN DE1229 mit Code Z70 (Leistungskurvendefinition) vorhanden
    fn evaluate_115(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("LIN", 1, "Z70")
    }

    /// [117] Wenn SG29 LIN++Z64 (Erforderliches Produkt Schaltzeitdefinitionen) vorhanden
    fn evaluate_117(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("LIN", 1, "Z64")
    }

    /// [118] Wenn SG29 LIN++Z65 (Erforderliches Produkt Leistungskurvendefinitionen) vorhanden
    fn evaluate_118(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("LIN", 1, "Z65")
    }

    /// [119] Wenn SG29 LIN++Z66 (Erforderliches Produkt Ad-hoc-Steuerkanal) vorhanden
    fn evaluate_119(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("LIN", 1, "Z66")
    }

    /// [120] Wenn SG29 LIN++Z67 (Erforderliches Messprodukt für Werte nach Typ 2 aus Backend) vorhanden
    fn evaluate_120(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("LIN", 1, "Z67")
    }

    /// [121] Wenn SG29 LIN++Z68 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) vorhanden
    fn evaluate_121(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("LIN", 1, "Z68")
    }

    /// [122] Wenn SG1 RFF+Z41 (Referenznummer des Vorgangs der Anmeldung nach WiM) nicht vorhanden
    fn evaluate_122(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("RFF", 0, "Z41")
    }

    /// [123] Wenn DTM+203 (Ausführungsdatum) nicht vorhanden
    fn evaluate_123(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("DTM", 0, "203")
    }

    /// [124] Wenn SG1 RFF+Z41 (Referenznummer des Vorgangs der Anmeldung nach WiM) vorhanden
    fn evaluate_124(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("RFF", 0, "Z41")
    }

    /// [125] Es sind nur die Konfigurations-Produkte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.1 „Konfigurationsprodukte Schaltzeitdefinition“ enthalten sind.
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_125(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("konfigurationsprodukt_schaltzeitdefinition")
    }

    /// [130] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Marktlokation angegeben ist
    fn evaluate_130(&self, ctx: &EvaluationContext) -> ConditionResult {
        // Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Marktlokation angegeben ist
        // LOC Meldepunkt: elements[0][0]=="172", elements[1][0]==DE3225 (Identifikator)
        let locs = ctx.find_segments_with_qualifier("LOC", 0, "172");
        match locs
            .first()
            .and_then(|s| s.elements.get(1))
            .and_then(|e| e.first())
        {
            Some(val) if !val.is_empty() => validate_malo_id(val),
            Some(_) => ConditionResult::False,
            None => ConditionResult::False, // segment absent → condition not applicable
        }
    }

    /// [131] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Messlokation angegeben ist
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_131(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("meldepunkt_is_messlokation_id")
    }

    /// [132] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Netzlokation angegeben ist
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_132(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("meldepunkt_is_netzlokation_id")
    }

    /// [133] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Steuerbaren Ressource angegeben ist
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_133(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("meldepunkt_is_steuerbare_ressource_id")
    }

    /// [134] Wenn die Position in der ursprünglichen Antwort auf die Bestellung aus SG1 RFF+Z42 vorhanden war und reklamiert werden soll
    // REVIEW: RFF+Z42 in SG1 (elements[0][0]=="Z42") references the original order response position. Presence of this segment in the current message indicates the reclaim scenario. The 'reklamiert werden soll' clause is implied by the reference existing. (medium confidence)
    fn evaluate_134(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("RFF", 0, "Z42")
    }

    /// [135] Wenn SG29 LIN++Z64 (Erforderliches Produkt Schaltzeitdefinitionen) nicht vorhanden
    fn evaluate_135(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LIN", 1, "Z64")
    }

    /// [136] Wenn SG29 LIN++Z65 (Erforderliches Produkt Leistungskurvendefinitionen) nicht vorhanden
    fn evaluate_136(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LIN", 1, "Z65")
    }

    /// [137] Wenn SG29 LIN++Z66 (Erforderliches Produkt Ad-hoc-Steuerkanal) nicht vorhanden
    fn evaluate_137(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LIN", 1, "Z66")
    }

    /// [138] Wenn SG29 LIN++Z67 (Erforderliches Messprodukt für Werte nach Typ 2 aus Backend) nicht vorhanden
    fn evaluate_138(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LIN", 1, "Z67")
    }

    /// [139] Wenn SG29 LIN++Z68 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) nicht vorhanden
    fn evaluate_139(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("LIN", 1, "Z68")
    }

    /// [140] Messprodukt-Code aus dem Kapitel 2.4 "Standard-Messprodukte der Netzlokation" der Codeliste der Konfigurationen
    /// EXTERNAL: Requires context from outside the message.
    fn evaluate_140(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external
            .evaluate("is_standard_messprodukt_netzlokation_code")
    }

    /// [147] wenn im DE3155 in demselben COM der Code EM vorhanden ist
    fn evaluate_147(&self, ctx: &EvaluationContext) -> ConditionResult {
        let com_segments = ctx.find_segments("COM");
        ConditionResult::from(com_segments.iter().any(|s| {
            s.elements
                .first()
                .and_then(|e| e.get(1))
                .is_some_and(|v| v == "EM")
        }))
    }

    /// [148] wenn im DE3155 in demselben COM der Code TE / FX / AJ / AL vorhanden ist
    fn evaluate_148(&self, ctx: &EvaluationContext) -> ConditionResult {
        let com_segments = ctx.find_segments("COM");
        ConditionResult::from(com_segments.iter().any(|s| {
            s.elements
                .first()
                .and_then(|e| e.get(1))
                .is_some_and(|v| matches!(v.as_str(), "TE" | "FX" | "AJ" | "AL"))
        }))
    }

    /// [161] Wenn in derselben SG29 LIN (Erforderliches Produkt Abrechnungsdaten) das SG30 CAV+ZH9 (Code der Produkteigenschaft) nicht vorhanden ist.
    fn evaluate_161(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_qualifier_without("PIA", 0, "5", "CAV", 0, "ZH9", &["SG4", "SG29"])
    }

    /// [163] Wenn innerhalb der Nachricht eine SG30 CCI+++ZA9 (Messprodukt für Übertragungsnetzbetreiber relevant) vorhanden ist.
    fn evaluate_163(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("CCI", 2, "ZA9")
    }

    /// [167] Wenn SG2 NAD+DP (Meldepunkt), SG3 RFF+Z20 (Referenz auf ID der Tranche) vorhanden
    fn evaluate_167(&self, ctx: &EvaluationContext) -> ConditionResult {
        match (
            ctx.has_qualifier("NAD", 0, "DP"),
            ctx.has_qualifier("RFF", 0, "Z20"),
        ) {
            (ConditionResult::True, ConditionResult::True) => ConditionResult::True,
            (ConditionResult::False, _) | (_, ConditionResult::False) => ConditionResult::False,
            _ => ConditionResult::Unknown,
        }
    }

    /// [168] Wenn SG2 NAD+DP (Meldepunkt), SG3 RFF+Z20 (Referenz auf ID der Tranche) nicht vorhanden
    fn evaluate_168(&self, ctx: &EvaluationContext) -> ConditionResult {
        match ctx.has_qualifier("NAD", 0, "DP") {
            ConditionResult::True => ctx.lacks_qualifier("RFF", 0, "Z20"),
            other => other,
        }
    }

    /// [169] Wenn in SG29 LIN++Z19 (Erforderliches Produkt der Messlokation) in SG30 CCI (Zugeordnete Zählzeitdefinition im DE7059 der Code Z39 (Code der Zählzeitdefinition) vorhanden ist
    fn evaluate_169(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_co_occurrence("LIN", 1, &["Z19"], "CCI", 0, 0, &["Z39"], &["SG29"])
    }

    /// [170] Wenn in derselben SG29 LIN die SG30 CCI+Z37++ZD1 (Basis zur Bildung der Tranchengröße) (Prozentual) vorhanden
    fn evaluate_170(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_qualified_value("CCI", 0, "Z37", 2, 0, &["ZD1"], &["SG29"])
    }

    /// [171] Wenn in derselben SG29 LIN (Erforderliches Produkt der Tranche) das IMD+++Z64 (Leistungsbeschreibung Konfiguration) (Neukonfiguration) vorhanden ist
    fn evaluate_171(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.any_group_has_qualifier("IMD", 2, "Z64", &["SG29"])
    }

    /// [173] Wenn IMD++Z66 (Beendigung Konfiguration aufgrund Überführung der Marktlokation zu ruhender Marktlokation) vorhanden
    fn evaluate_173(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("IMD", 1, "Z66")
    }

    /// [174] Wenn IMD++Z67 (Aktivierung Konfiguration in der derzeit ruhenden Marktlokation) vorhanden
    fn evaluate_174(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.has_qualifier("IMD", 1, "Z67")
    }

    /// [175] Wenn SG2 NAD+DP (Meldepunkt), SG3 RFF+Z59 (Referenz auf die ID der Marktlokation der Kundenanlage) vorhanden
    fn evaluate_175(&self, ctx: &EvaluationContext) -> ConditionResult {
        match (
            ctx.has_qualifier("NAD", 0, "DP"),
            ctx.has_qualifier("RFF", 0, "Z59"),
        ) {
            (ConditionResult::True, ConditionResult::True) => ConditionResult::True,
            (ConditionResult::False, _) | (_, ConditionResult::False) => ConditionResult::False,
            _ => ConditionResult::Unknown,
        }
    }

    /// [176] Wenn SG2 NAD+DP (Meldepunkt), SG3 RFF+Z59 (Referenz auf die ID der Marktlokation der Kundenanlage) nicht vorhanden
    fn evaluate_176(&self, ctx: &EvaluationContext) -> ConditionResult {
        match ctx.has_qualifier("NAD", 0, "DP") {
            ConditionResult::True => ctx.lacks_qualifier("RFF", 0, "Z59"),
            other => other,
        }
    }

    /// [177] Wenn IMD++Z66 (Beendigung Konfiguration aufgrund Überführung der Marktlokation zu ruhender Marktlokation) nicht vorhanden
    fn evaluate_177(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.lacks_qualifier("IMD", 1, "Z66")
    }

    /// [492] wenn MP-ID in NAD+MR aus Sparte Strom
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Whether the MP-ID in NAD+MR belongs to the Strom (electricity) sector cannot be determined from the EDIFACT message alone — it requires a market participant registry lookup. (medium confidence)
    fn evaluate_492(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("recipient_is_strom")
    }

    /// [493] wenn MP-ID in NAD+MR aus Sparte Gas
    /// EXTERNAL: Requires context from outside the message.
    // REVIEW: Whether the MP-ID in NAD+MR belongs to the Gas sector cannot be determined from the EDIFACT message alone — it requires a market participant registry lookup. (medium confidence)
    fn evaluate_493(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.external.evaluate("recipient_is_gas")
    }

    /// [494] Das hier genannte Datum muss der Zeitpunkt sein, zu dem das Dokument erstellt wurde, oder ein Zeitpunkt, der davor liegt.
    // REVIEW: States that the date in this DE must be the document creation time or earlier, i.e. <= DTM+137 Nachrichtendatum. Applied to DTM+203 (Ausführungsdatum) as the most logical target in ORDERS. Lexicographic string comparison is valid for CCYYMMDDHHMM (format 303) values since they are zero-padded fixed-width. (medium confidence)
    fn evaluate_494(&self, ctx: &EvaluationContext) -> ConditionResult {
        // The date here must be the document creation time (DTM+137 Nachrichtendatum) or earlier.
        // DTM+137: elements[0][0]=qualifier(137), elements[0][1]=DE2380 (actual value), elements[0][2]=format(303)
        // Applied to Ausführungsdatum (DTM+203) as the most likely subject in ORDERS.
        let dtm137_segs = ctx.find_segments_with_qualifier("DTM", 0, "137");
        let dtm203_segs = ctx.find_segments_with_qualifier("DTM", 0, "203");
        let ref_val = dtm137_segs
            .first()
            .and_then(|s| s.elements.first())
            .and_then(|e| e.get(1));
        let cmp_val = dtm203_segs
            .first()
            .and_then(|s| s.elements.first())
            .and_then(|e| e.get(1));
        match (cmp_val, ref_val) {
            (Some(cv), Some(rv)) => ConditionResult::from(cv.as_str() <= rv.as_str()),
            _ => ConditionResult::Unknown,
        }
    }

    /// [495] Der Zeitpunkt muss ≤ dem Wert im DE2380 des DTM+137 sein
    // REVIEW: Explicitly requires the subject timestamp to be <= DE2380 of DTM+137 (Nachrichtendatum). Notation resolved: DTM+137 elements[0][1] is DE2380 per the MIG segment structure reference. Applied to DTM+203 (Ausführungsdatum) as the primary date field requiring this constraint in ORDERS. String comparison is valid for fixed-width CCYYMMDDHHMM format 303. (medium confidence)
    fn evaluate_495(&self, ctx: &EvaluationContext) -> ConditionResult {
        // The point in time must be <= DE2380 of DTM+137 (Nachrichtendatum).
        // DTM element layout per MIG: elements[0][0]=qualifier, elements[0][1]=DE2380 value, elements[0][2]=format code.
        // Applied to Ausführungsdatum (DTM+203) as the most relevant cross-date check in ORDERS.
        let dtm137_segs = ctx.find_segments_with_qualifier("DTM", 0, "137");
        let dtm203_segs = ctx.find_segments_with_qualifier("DTM", 0, "203");
        let ref_val = dtm137_segs
            .first()
            .and_then(|s| s.elements.first())
            .and_then(|e| e.get(1));
        let cmp_val = dtm203_segs
            .first()
            .and_then(|s| s.elements.first())
            .and_then(|e| e.get(1));
        match (cmp_val, ref_val) {
            (Some(cv), Some(rv)) => ConditionResult::from(cv.as_str() <= rv.as_str()),
            _ => ConditionResult::Unknown,
        }
    }

    /// [500] Hinweis: Zählpunkt der BAS
    fn evaluate_500(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [501] Hinweis: Zählpunkt der DZR
    fn evaluate_501(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [503] Hinweis: Angabe eines technischen Ansprechpartners für die Geräteübernahme
    fn evaluate_503(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [506] Hinweis: Datum, bis zu dem der MSBA zur Fortführung verpflichtet wird
    fn evaluate_506(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [507] Hinweis: Es müssen alle nach Durchführung der Messlokationsänderung eingesetzten/genutzten OBIS- Kennzahlen übermittelt werden (wird eine "Erweiterung" des Messumfangs beauftragt, sind auch die...
    fn evaluate_507(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [514] Hinweis: Das Abonnement kann frühestens ab dem aktuellen Liefermonat beim Netzbetreiber gestartet werden.
    fn evaluate_514(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [515] Hinweis: Das angegebene Betrachtungszeitintervall bestimmt beim Start Abo bzw. Ende Abo ab bzw. bis wann (einschließlich) das Abo laufen soll.
    fn evaluate_515(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [517] Hinweis: Zählpunkt der LF-AASZR
    fn evaluate_517(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [518] Hinweis: Das angegebene Ausführungsdatum bestimmt beim Start Abo bzw. Ende Abo ab bzw. bis wann (einschließlich) das Abo laufen soll.
    fn evaluate_518(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [519] Hinweis: Bei Gas bezieht sich die Anforderung immer sowohl auf die vorläufigen Profilwerte als auch auf die endgültigen Profilwerte, falls diese bereits vorliegen.
    fn evaluate_519(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::Unknown
    }

    /// [521] Hinweis: Verwendung der ID der Marktlokation
    fn evaluate_521(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Verwendung der ID der Marktlokation — informational note, always applies
        ConditionResult::True
    }

    /// [522] Hinweis: Verwendung der ID der Messlokation
    fn evaluate_522(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Verwendung der ID der Messlokation — informational note, always applies
        ConditionResult::True
    }

    /// [523] Hinweis: Verwendung der ID der Tranche
    fn evaluate_523(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Verwendung der ID der Tranche — informational note, always applies
        ConditionResult::True
    }

    /// [525] Hinweis: Wert aus BGM DE1004 der MSCONS
    fn evaluate_525(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wert aus BGM DE1004 der MSCONS — informational note, always applies
        ConditionResult::True
    }

    /// [527] Hinweis: Zählpunkt der BG-SZR (Kategorie B)
    fn evaluate_527(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Zählpunkt der BG-SZR (Kategorie B) — informational note, always applies
        ConditionResult::True
    }

    /// [530] Hinweis: Wert aus BGM+310 DE1004 der QUOTES mit der das Angebot erfolgt ist.
    fn evaluate_530(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wert aus BGM+310 DE1004 der QUOTES mit der das Angebot erfolgt ist — informational note, always applies
        ConditionResult::True
    }

    /// [531] Hinweis: Wert aus LIN DE1082 der QUOTES, mit der das Angebot erfolgt ist
    fn evaluate_531(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wert aus LIN DE1082 der QUOTES, mit der das Angebot erfolgt ist — informational note, always applies
        ConditionResult::True
    }

    /// [532] Hinweis: Wert aus BGM+Z29 DE1004 der QUOTES, mit der das Angebot zur Abrechnung des Messstellenbetriebs erfolgt ist.
    fn evaluate_532(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wert aus BGM+Z29 DE1004 der QUOTES, mit der das Angebot zur Abrechnung des Messstellenbetriebs erfolgt ist — informational note, always applies
        ConditionResult::True
    }

    /// [533] Hinweis: Gerichtsvollzieher hat Termin vorgegeben
    fn evaluate_533(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Gerichtsvollzieher hat Termin vorgegeben — informational note, always applies
        ConditionResult::True
    }

    /// [535] Hinweis: Verwendung der ID der Messlokation der Sparte Strom
    fn evaluate_535(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Verwendung der ID der Messlokation der Sparte Strom — informational note, always applies
        ConditionResult::True
    }

    /// [536] Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z59
    fn evaluate_536(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z59 — informational note, always applies
        ConditionResult::True
    }

    /// [539] Hinweis: Es sind nur Codes von Zählzeiten aus Liste des NB anzugeben
    fn evaluate_539(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Es sind nur Codes von Zählzeiten aus Liste des NB anzugeben — informational note, always applies
        ConditionResult::True
    }

    /// [540] Hinweis: Es sind nur Codes von Zählzeiten aus Liste des LF anzugeben
    fn evaluate_540(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Es sind nur Codes von Zählzeiten aus Liste des LF anzugeben — informational note, always applies
        ConditionResult::True
    }

    /// [542] Hinweis: Wert aus BGM+Z57 DE1004 der QUOTES mit der das Angebot erfolgt ist.
    fn evaluate_542(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wert aus BGM+Z57 DE1004 der QUOTES mit der das Angebot erfolgt ist — informational note, always applies
        ConditionResult::True
    }

    /// [543] Hinweis: Wert aus BGM+Z57 DE1004 der ORDERS mit der die Bestellung der Werte erfolgt ist.
    fn evaluate_543(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wert aus BGM+Z57 DE1004 der ORDERS mit der die Bestellung der Werte erfolgt ist — informational note, always applies
        ConditionResult::True
    }

    /// [545] Hinweis: Es werden nur die Messprodukte der Messlokationen angegeben, die für die in der SG2 genannte Marktlokation bzw. deren Tranchen erforderlich sind. Messprodukte an der Messlokation für wei...
    fn evaluate_545(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Es werden nur die Messprodukte der Messlokationen angegeben... — informational note, always applies
        ConditionResult::True
    }

    /// [547] Hinweis: Dokumentennummer aus BGM+Z60 DE1004 der UTILTS
    fn evaluate_547(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Dokumentennummer aus BGM+Z60 DE1004 der UTILTS — informational note, always applies
        ConditionResult::True
    }

    /// [548] Hinweis: Wenn die Änderung der Gerätekonfiguration mit einer Zählzeit übermittelt wird, ist hier die MP-ID des Eigentümers der Liste der Zählzeit einzutragen. Wenn anstatt der bisherigen Zäh...
    fn evaluate_548(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: MP-ID des Eigentümers der Zählzeitliste — informational note, always applies
        ConditionResult::True
    }

    /// [549] Hinweis: Findet bei der Reklamation von Zählerständen immer Anwendung. Einzige Ausnahme ist, wenn es sich um die Reklamation eines fehlenden Zählerstandes aufgrund einer Turnusablesung handelt, ...
    fn evaluate_549(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Reklamation von Zählerständen — Zeitpunktangabe vs. Zeitintervall — informational note, always applies
        ConditionResult::True
    }

    /// [550] Hinweis: Findet nur dann Anwendung, wenn es sich um die Reklamation eines fehlenden Zählerstandes aufgrund einer Turnusablesung handelt, bei welcher der MSB am Objekt der Marktlokation die Informa...
    fn evaluate_550(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Reklamation fehlender Zählerstand bei Turnusablesung — informational note, always applies
        ConditionResult::True
    }

    /// [551] Hinweis: Die SG29 ist so oft zu wiederholen, dass alle Messprodukte und Zählzeiten genannt werden, die ab dem in DTM+203 genannten Zeitpunkt auf der Messlokation durch den MSB konfiguriert werden ...
    fn evaluate_551(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: SG29 Wiederholung für alle Messprodukte und Zählzeiten — informational note, always applies
        ConditionResult::True
    }

    /// [552] Hinweis: Verwendung der ID der Netzlokation
    fn evaluate_552(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Verwendung der ID der Netzlokation — informational note, always applies
        ConditionResult::True
    }

    /// [553] Hinweis: Verwendung der ID der Steuerbaren Ressource
    fn evaluate_553(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Verwendung der ID der Steuerbaren Ressource — informational note, always applies
        ConditionResult::True
    }

    /// [554] Hinweis: Wert aus BGM+Z74 DE1004 der QUOTES mit der das Angebot erfolgt ist.
    fn evaluate_554(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wert aus BGM+Z74 DE1004 der QUOTES — informational note about value origin, always applies
        ConditionResult::True
    }

    /// [555] Hinweis: Vorgangsnummer aus SG4 IDE+24 DE7402 der UTILMD mit BGM+E01 mit der die Anmeldung des MSB-Wechsels erfolgt ist.
    fn evaluate_555(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Vorgangsnummer aus SG4 IDE+24 DE7402 der UTILMD — informational note about value origin, always applies
        ConditionResult::True
    }

    /// [557] Hinweis: Es werden nur die Messprodukte der Messlokationen angegeben, die für die in der SG2 genannte Netzlokation erforderlich sind. Messprodukte an der Messlokation für weitere Netzlokationen o...
    fn evaluate_557(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Only Messprodukte for Messlokationen required for the named Netzlokation are specified — informational note, always applies
        ConditionResult::True
    }

    /// [558] Hinweis: Dokumentennummer aus BGM+Z78 DE1004 der UTILTS
    fn evaluate_558(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Dokumentennummer aus BGM+Z78 DE1004 der UTILTS — informational note, always applies
        ConditionResult::True
    }

    /// [559] Hinweis: Dokumentennummer aus BGM+Z79 DE1004 der UTILTS
    fn evaluate_559(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Dokumentennummer aus BGM+Z79 DE1004 der UTILTS — informational note, always applies
        ConditionResult::True
    }

    /// [560] Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z80
    fn evaluate_560(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z80 — informational note, always applies
        ConditionResult::True
    }

    /// [561] Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z81
    fn evaluate_561(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z81 — informational note, always applies
        ConditionResult::True
    }

    /// [562] Hinweis: Wert aus BGM+Z73 DE1004 der IFTSTA mit der die Antwort auf die Bestellung der Konfiguration übermittelt wurde
    fn evaluate_562(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wert aus BGM+Z73 DE1004 der IFTSTA — informational note, always applies
        ConditionResult::True
    }

    /// [563] Hinweis: Vorgangsnummer aus CNI DE1490 der IFTSTA mit BGM+Z73 mit der die Antwort auf die Bestellung der Konfiguration übermittelt wurde
    fn evaluate_563(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Vorgangsnummer aus CNI DE1490 der IFTSTA mit BGM+Z73 mit der die Antwort auf die Bestellung der Konfiguration übermittelt wurde — informational note, always applies
        ConditionResult::True
    }

    /// [564] Hinweis: Für den Empfang der Werte nach Typ 2 aus dem SMGW.
    fn evaluate_564(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Für den Empfang der Werte nach Typ 2 aus dem SMGW — informational note, always applies
        ConditionResult::True
    }

    /// [566] Hinweis: Verwendung der ID der Technischen Ressource
    fn evaluate_566(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Verwendung der ID der Technischen Ressource — informational note, always applies
        ConditionResult::True
    }

    /// [567] Hinweis: Es darf nur eine Information im DE3148 übermittelt werden
    fn evaluate_567(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Es darf nur eine Information im DE3148 übermittelt werden — informational note, always applies
        ConditionResult::True
    }

    /// [568] Hinweis: Wenn die Einrichtung der Konfiguration mit einer Zählzeit übermittelt wird, ist hier die MP-ID des NB als Eigentümer der Liste der Zählzeit einzutragen.
    fn evaluate_568(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wenn die Einrichtung der Konfiguration mit einer Zählzeit übermittelt wird, ist hier die MP-ID des NB als Eigentümer der Liste der Zählzeit einzutragen — informational note, always applies
        ConditionResult::True
    }

    /// [569] Hinweis: MaBiS-Zählpunkt der LF-SZR
    fn evaluate_569(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: MaBiS-Zählpunkt der LF-SZR — informational note, always applies
        ConditionResult::True
    }

    /// [570] Hinweis: zur Angabe von Kontaktdaten des Kunden des Lieferanten um die Änderung an der Technik zu vereinfachen.
    fn evaluate_570(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: zur Angabe von Kontaktdaten des Kunden des Lieferanten um die Änderung an der Technik zu vereinfachen — informational note, always applies
        ConditionResult::True
    }

    /// [571] Hinweis: MSB der Marktlokation, an den die Werte der weiteren Energieflussrichtung der Messlokation zu übermitteln sind.
    fn evaluate_571(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: MSB der Marktlokation, an den die Werte der weiteren Energieflussrichtung der Messlokation zu übermitteln sind — informational note, always applies
        ConditionResult::True
    }

    /// [572] Hinweis: MSB der Marktlokation der Kundenanlage, in der die betroffene Lokation integriert wird.
    fn evaluate_572(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: MSB der Marktlokation der Kundenanlage, in der die betroffene Lokation integriert wird — informational note, always applies
        ConditionResult::True
    }

    /// [573] Hinweis: Es ist eine URI IPv4 für die Bereitstellung der Werte anzugeben.
    fn evaluate_573(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Es ist eine URI IPv4 für die Bereitstellung der Werte anzugeben — informational note, always applies
        ConditionResult::True
    }

    /// [574] Hinweis: Es ist eine URI IPv6 für die Bereitstellung der Werte anzugeben.
    fn evaluate_574(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Es ist eine URI IPv6 für die Bereitstellung der Werte anzugeben.
        ConditionResult::True
    }

    /// [575] Hinweis: Wenn der gewünschte Änderungszeitpunkt ein fixer Zeitpunkt ist.
    fn evaluate_575(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wenn der gewünschte Änderungszeitpunkt ein fixer Zeitpunkt ist.
        ConditionResult::True
    }

    /// [576] Hinweis: Wenn der gewünschte Änderungszeitpunkt ein nächst möglicher Termin zum oder nach dem angegebenen Zeitpunkt ist.
    fn evaluate_576(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Wenn der gewünschte Änderungszeitpunkt ein nächst möglicher Termin zum oder nach dem angegebenen Zeitpunkt ist.
        ConditionResult::True
    }

    /// [903] Format: Möglicher Wert: 1
    fn evaluate_903(&self, _ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::True
    }

    /// [906] Format: max. 3 Nachkommastellen
    fn evaluate_906(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("QTY", 0, 1, |val| validate_max_decimal_places(val, 3))
    }

    /// [911] Format: Mögliche Werte: 1 bis n, je Nachricht oder Segmentgruppe bei 1 beginnend und fortlaufend aufsteigend
    fn evaluate_911(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Mögliche Werte: 1 bis n, je Nachricht oder Segmentgruppe bei 1 beginnend und fortlaufend aufsteigend
        // This is a cardinality/sequencing annotation — informational, always applies
        ConditionResult::True
    }

    /// [914] Format: Möglicher Wert: &gt;0
    fn evaluate_914(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("QTY", 0, 1, |val| validate_numeric(val, ">", 0.0))
    }

    /// [922] Format: TR-ID
    // REVIEW: TR-ID (Transaktionsreferenz-ID) format. In ORDERS the transaction reference ID appears in BGM C106. The exact segment context depends on the AHB field definition — implemented as max-length-35 check on BGM, consistent with EDIFACT AN..35 data element constraints. Medium confidence because the target segment may differ by AHB row. (medium confidence)
    fn evaluate_922(&self, ctx: &EvaluationContext) -> ConditionResult {
        // Format: TR-ID — Transaktionsreferenz-ID, max 35 alphanumeric characters
        // In ORDERS, TR-ID typically appears in BGM element 1 (C106 document identifier)
        let segs = ctx.find_segments("BGM");
        match segs
            .first()
            .and_then(|s| s.elements.get(1))
            .and_then(|e| e.first())
        {
            Some(val) if !val.is_empty() => validate_max_length(val, 35),
            Some(_) => ConditionResult::False,
            None => ConditionResult::False, // segment absent → condition not applicable
        }
    }

    /// [930] Format: max. 2 Nachkommastellen
    fn evaluate_930(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("QTY", 0, 1, |val| validate_max_decimal_places(val, 2))
    }

    /// [931] Format: ZZZ = +00
    fn evaluate_931(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("DTM", 0, 1, validate_timezone_utc)
    }

    /// [932] Format: HHMM = 2200
    // REVIEW: HHMM = 2200 time constraint on DTM. In ORDERS FV2504, delivery period end (qualifier 163) must terminate at 22:00 UTC, matching the standard German grid day-end convention. Medium confidence because the target DTM qualifier may differ for the specific AHB row — 163 is the most likely candidate for an end-of-period constraint. (medium confidence)
    fn evaluate_932(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check_qualified("DTM", 0, "163", 0, 1, |val| {
            validate_hhmm_equals(val, "2200")
        })
    }

    /// [933] Format: HHMM = 2300
    fn evaluate_933(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("DTM", 0, 1, |val| validate_hhmm_equals(val, "2300"))
    }

    /// [934] Format: HHMM = 0400
    fn evaluate_934(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("DTM", 0, 1, |val| validate_hhmm_equals(val, "0400"))
    }

    /// [935] Format: HHMM = 0500
    fn evaluate_935(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("DTM", 0, 1, |val| validate_hhmm_equals(val, "0500"))
    }

    /// [939] Format: Die Zeichenkette muss die Zeichen @ und . enthalten
    fn evaluate_939(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("COM", 0, 0, validate_email)
    }

    /// [940] Format: Die Zeichenkette muss mit dem Zeichen + beginnen und danach dürfen nur noch Ziffern folgen
    fn evaluate_940(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("COM", 0, 0, validate_phone)
    }

    /// [950] Format: Marktlokations-ID
    fn evaluate_950(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check_qualified("LOC", 0, "Z16", 1, 0, validate_malo_id)
    }

    /// [951] Format: Zählpunktbezeichnung
    fn evaluate_951(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check_qualified("LOC", 0, "Z17", 1, 0, validate_zahlpunkt)
    }

    /// [955] Format: Möglicher Wert: &lt;100
    // REVIEW: Format: Möglicher Wert: <100 — numeric value must be less than 100. Most likely applies to a QTY quantity value (C186.D6060, elements[0][1]). validate_numeric with "<" and threshold 100.0 covers this. Medium confidence because the exact segment context (QTY vs PRI vs PCT) is not specified — QTY is the most common numeric value carrier in ORDERS. (medium confidence)
    fn evaluate_955(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("QTY", 0, 1, |val| validate_numeric(val, "<", 100.0))
    }

    /// [960] Format: Netzlokations-ID
    fn evaluate_960(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check_qualified("LOC", 0, "Z18", 1, 0, validate_malo_id)
    }

    /// [961] Format: SR-ID
    fn evaluate_961(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check_qualified("LOC", 0, "Z19", 1, 0, validate_malo_id)
    }

    /// [962] Format: max. 6 Vorkommastellen
    // REVIEW: Format: max 6 integer digits (Vorkommastellen). Applied to QTY element[0][1] as the most common numeric data field in ORDERS requiring integer-part validation. Uses validate_max_integer_digits helper. Confidence medium because the target segment is inferred from context rather than explicitly stated. (medium confidence)
    fn evaluate_962(&self, ctx: &EvaluationContext) -> ConditionResult {
        ctx.format_check("QTY", 0, 1, |val| validate_max_integer_digits(val, 6))
    }

    /// [2002] Ist mindestens zwei Mal anzugeben
    // REVIEW: Must be specified at least twice. Counts DTM+203 (Ausführungsdatum, qualifier at elements[0][0]) occurrences as a proxy for SG29 group instance count since each SG29 contains exactly one DTM+203. Condition is True when count >= 2. (medium confidence)
    fn evaluate_2002(&self, ctx: &EvaluationContext) -> ConditionResult {
        // "Ist mindestens zwei Mal anzugeben" — SG29 must appear at least twice.
        // DTM+203 (Ausführungsdatum) occurs exactly once per SG29 instance,
        // so counting DTM+203 segments gives the SG29 repetition count.
        let count = ctx.find_segments_with_qualifier("DTM", 0, "203").len();
        ConditionResult::from(count >= 2)
    }

    /// [2004] Die SG29 ist so oft zu wiederholen, dass alle Geräte der betroffenen Geräteart die im Rahmen des Gerätewechsels aufgrund MSB-Wechsel getauscht werden sollen genannt sind.
    fn evaluate_2004(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Die SG29 ist so oft zu wiederholen, dass alle Geräte der betroffenen Geräteart
        // die im Rahmen des Gerätewechsels aufgrund MSB-Wechsel getauscht werden sollen, genannt sind.
        // Informational cardinality note — always applies.
        ConditionResult::True
    }

    /// [2005] Pro SG29 LIN ist die SG34 RFF+Z09 (Gerätenummer) genau einmal anzugeben
    // REVIEW: Per SG29 LIN, RFF+Z09 (Gerätenummer) must appear exactly once. We check that there is exactly one RFF segment with qualifier Z09 in the message context. This is a cardinality constraint evaluated at message level via segment counting. (medium confidence)
    fn evaluate_2005(&self, ctx: &EvaluationContext) -> ConditionResult {
        {
            let rffs = ctx.find_segments_with_qualifier("RFF", 0, "Z09");
            ConditionResult::from(rffs.len() == 1)
        }
    }

    /// [2006] Pro SG29 LIN ist die SG34 RFF+Z09 (Gerätenummer) bis zu dreimal anzugeben
    // REVIEW: Per SG29 LIN, RFF+Z09 (Gerätenummer) may appear up to three times. We verify that at most 3 RFF segments with qualifier Z09 exist in the message context. (medium confidence)
    fn evaluate_2006(&self, ctx: &EvaluationContext) -> ConditionResult {
        {
            let rffs = ctx.find_segments_with_qualifier("RFF", 0, "Z09");
            ConditionResult::from(rffs.len() <= 3)
        }
    }

    /// [2007] Die SG29 ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum) Messlokationen zu der in der SG2 genannten Netzlokation vorhanden sind und für jede dieser Messlokationen müssen alle Me...
    fn evaluate_2007(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Die SG29 ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum)
        // Messlokationen zu der in der SG2 genannten Netzlokation vorhanden sind und für jede
        // dieser Messlokationen müssen alle Messprodukte genannt sein, die ab dem DTM+203
        // (Ausführungsdatum) in der SG2 genannten Netzlokation vorhanden sind.
        // Informational cardinality note — always applies.
        ConditionResult::True
    }

    /// [2044] Pro SG29 LIN ist die SG29 PIA genau einmal anzugeben
    // REVIEW: Per SG29 LIN, the SG29 PIA segment must appear exactly once. We count PIA segments in the message and check for exactly one occurrence. This is a structural cardinality check on the PIA segment. (medium confidence)
    fn evaluate_2044(&self, ctx: &EvaluationContext) -> ConditionResult {
        {
            let pias = ctx.find_segments("PIA");
            ConditionResult::from(pias.len() == 1)
        }
    }

    /// [2050] Pro Nachricht ist die SG29 genau einmal anzugeben
    // REVIEW: Per message, SG29 (identified by its entry segment LIN) must appear exactly once. We count all LIN segments in the message and check for exactly one occurrence. (medium confidence)
    fn evaluate_2050(&self, ctx: &EvaluationContext) -> ConditionResult {
        {
            let lins = ctx.find_segments("LIN");
            ConditionResult::from(lins.len() == 1)
        }
    }

    /// [2060] Pro Nachricht ist die SG29 LIN+Z64 (Erforderliches Produkt Schaltzeitdefinitionen) maximal einmal anzugeben
    fn evaluate_2060(&self, ctx: &EvaluationContext) -> ConditionResult {
        {
            let lins = ctx.find_segments("LIN");
            let count = lins
                .iter()
                .filter(|s| {
                    s.elements
                        .get(1)
                        .and_then(|e| e.first())
                        .is_some_and(|v| v == "Z64")
                })
                .count();
            ConditionResult::from(count <= 1)
        }
    }

    /// [2061] Pro Nachricht ist die SG29 LIN++Z65 (Erforderliches Produkt Leistungskurvendefinitionen) maximal einmal anzugeben
    fn evaluate_2061(&self, ctx: &EvaluationContext) -> ConditionResult {
        {
            let lins = ctx.find_segments("LIN");
            let count = lins
                .iter()
                .filter(|s| {
                    s.elements
                        .get(1)
                        .and_then(|e| e.first())
                        .is_some_and(|v| v == "Z65")
                })
                .count();
            ConditionResult::from(count <= 1)
        }
    }

    /// [2062] Pro Nachricht ist die SG29 LIN++Z66 (Erforderliches Produkt Ad-hoc-Steuerkanal) maximal einmal anzugeben
    // REVIEW: Count LIN segments where elements[1][0]=="Z66" (LIN++Z66, ad-hoc Steuerkanal). Condition is True when at most one such SG29 line item is present per message. (medium confidence)
    fn evaluate_2062(&self, ctx: &EvaluationContext) -> ConditionResult {
        let count = ctx
            .find_segments("LIN")
            .iter()
            .filter(|s| {
                s.elements
                    .get(1)
                    .and_then(|e| e.first())
                    .is_some_and(|v| v == "Z66")
            })
            .count();
        ConditionResult::from(count <= 1)
    }

    /// [2063] Pro Nachricht ist die SG29 LIN++Z67 (Erforderliches Messprodukt für Werte nach Typ 2 aus Backend) maximal einmal anzugeben
    // REVIEW: Count LIN segments where elements[1][0]=="Z67" (LIN++Z67, Messprodukt Typ 2 Backend). Condition is True when at most one such SG29 line item is present per message. (medium confidence)
    fn evaluate_2063(&self, ctx: &EvaluationContext) -> ConditionResult {
        let count = ctx
            .find_segments("LIN")
            .iter()
            .filter(|s| {
                s.elements
                    .get(1)
                    .and_then(|e| e.first())
                    .is_some_and(|v| v == "Z67")
            })
            .count();
        ConditionResult::from(count <= 1)
    }

    /// [2064] Pro Nachricht ist die SG29 LIN++Z68 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) maximal einmal anzugeben
    // REVIEW: Count LIN segments where elements[1][0]=="Z68" (LIN++Z68, Konfigurationserlaubnis Typ 2 SMGW). Condition is True when at most one such SG29 line item is present per message. (medium confidence)
    fn evaluate_2064(&self, ctx: &EvaluationContext) -> ConditionResult {
        let count = ctx
            .find_segments("LIN")
            .iter()
            .filter(|s| {
                s.elements
                    .get(1)
                    .and_then(|e| e.first())
                    .is_some_and(|v| v == "Z68")
            })
            .count();
        ConditionResult::from(count <= 1)
    }

    /// [2066] Die SG3 RFF+Z37 Referenz auf ID der Technischen Ressource ist so oft zu wiederholen, bis alle IDs der Technischen Ressourcen angegeben sind, die der Steuerbaren Ressource in LOC+172 DE3225 (Meldepu...
    fn evaluate_2066(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Die SG3 RFF+Z37 ist so oft zu wiederholen, bis alle IDs der Technischen
        // Ressourcen angegeben sind, die der Steuerbaren Ressource in LOC+172 DE3225 (Meldepunkt)
        // mit diesem Vorgang zugeordnet werden sollen.
        // Informational cardinality note — always applies.
        ConditionResult::True
    }

    /// [2088] Die SG29 ist so oft zu wiederholen, dass alle Messprodukte ab dem DTM+203 (Ausführungsdatum) zu der in der SG2 genannten Netzlokation genannt sind.
    fn evaluate_2088(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Die SG29 ist so oft zu wiederholen, dass alle Messprodukte ab dem DTM+203
        // (Ausführungsdatum) zu der in der SG2 genannten Netzlokation genannt sind.
        // Informational cardinality note — always applies.
        ConditionResult::True
    }

    /// [2089] Die SG29 ist so oft zu wiederholen, dass alle Messprodukte ab dem DTM+203 (Ausführungsdatum) zu der in der SG2 genannten Marktlokation genannt sind.
    fn evaluate_2089(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Die SG29 ist so oft zu wiederholen, dass alle Messprodukte ab dem DTM+203
        // (Ausführungsdatum) zu der in der SG2 genannten Marktlokation genannt sind.
        // Informational cardinality note about SG29 repetition count — always applies.
        ConditionResult::True
    }

    /// [2090] Für 33-stellige ID im SG2 LOC+172 (Meldepunkt) DE3225 mindestens einmal anzugeben
    fn evaluate_2090(&self, ctx: &EvaluationContext) -> ConditionResult {
        let locs = ctx.find_segments_with_qualifier("LOC", 0, "172");
        ConditionResult::from(locs.iter().any(|s| {
            s.elements
                .get(1)
                .and_then(|e| e.first())
                .is_some_and(|v| v.len() == 33)
        }))
    }

    /// [2092] Pro Nachricht ist die SG29 maximal einmal anzugeben
    // REVIEW: SG29 is initiated by the LIN segment. Count all LIN segments in the message and verify there is at most one, making the condition True when the cardinality constraint is satisfied. (medium confidence)
    fn evaluate_2092(&self, ctx: &EvaluationContext) -> ConditionResult {
        ConditionResult::from(ctx.find_segments("LIN").len() <= 1)
    }

    /// [2094] Pro Nachricht ist die SG29 LIN (Positionsdaten) so oft anzugeben, wie Positionen aus dem Angebot, welches in SG1 RFF+AAG (Referenz Nachrichtennummer), DE1154 angegeben ist, bestellt werden sollen.
    fn evaluate_2094(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Pro Nachricht ist die SG29 LIN (Positionsdaten) so oft anzugeben, wie
        // Positionen aus dem Angebot (referenziert in SG1 RFF+AAG DE1154) bestellt werden sollen.
        // Informational cardinality note — the required repetition count depends on an external
        // offer document that cannot be inspected from within this EDIFACT message.
        ConditionResult::True
    }

    /// [2095] Diese SG29 ist so oft zu wiederholen, dass alle Produkte zur Lokation die ab dem DTM+203 (Ausführungsdatum) gewünscht sind und deren Kombination gemäß Codeliste der Konfigurationen Kapitel 7 "P...
    fn evaluate_2095(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Diese SG29 ist so oft zu wiederholen, dass alle Produkte zur Lokation
        // ab dem DTM+203 (Ausführungsdatum) genannt sind, deren Kombination gemäß
        // Codeliste der Konfigurationen Kapitel 7 möglich sind.
        // Informational cardinality note — valid combinations are defined by an external
        // code list (Kapitel 7) and cannot be validated from EDIFACT content alone.
        ConditionResult::True
    }

    /// [2096] Die SG3 Referenz auf die ID der Tranche ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum) Tranchen zu der in der SG2 genannten Marktlokation vorhanden sind.
    fn evaluate_2096(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Die SG3 Referenz auf die ID der Tranche ist so oft zu wiederholen, wie
        // ab dem DTM+203 (Ausführungsdatum) Tranchen zu der in der SG2 genannten
        // Marktlokation vorhanden sind.
        // Informational cardinality note — the number of Tranchen for a Marktlokation is
        // business context that cannot be determined from the EDIFACT message alone.
        ConditionResult::True
    }

    /// [2097] Die SG29 ist so oft zu wiederholen, dass für alle in SG3 Referenz auf ID der Tranche genannten Tranchen mindestens eine SG29 vorhanden ist.
    fn evaluate_2097(&self, _ctx: &EvaluationContext) -> ConditionResult {
        // Hinweis: Die SG29 ist so oft zu wiederholen, dass für alle in SG3 RFF+Z20
        // (Referenz auf ID der Tranche) genannten Tranchen mindestens eine SG29 vorhanden ist.
        // Informational completeness note — each Tranche referenced in SG3 must have
        // at least one corresponding SG29. Documents structural pairing requirements.
        ConditionResult::True
    }

    /// [2098] Die SG2 Lieferant an der Lokation ist so oft zu wiederholen, dass für alle in SG3 Referenz auf ID der Tranche genannten Tranchen genau eine SG2 Lieferant der Lokation vorhanden ist.
    // REVIEW: Cardinality rule: SG2 repetition count must equal the number of SG3 tranche references. Implemented by comparing count_in_group for both groups within SG29. Medium confidence because exact group paths and SG3 RFF qualifier for 'Tranche ID' are not confirmed without the full MIG segment structure reference — the paths &["SG29", "SG2"] and &["SG29", "SG3"] are based on standard ORDERS tx_group conventions from project memory. (medium confidence)
    fn evaluate_2098(&self, ctx: &EvaluationContext) -> ConditionResult {
        // SG2 Lieferant an der Lokation must repeat once per SG3 tranche reference.
        // Count SG2 group instances (NAD as entry segment) and SG3 RFF tranche references.
        // Both counts must be equal and non-zero for the condition to be satisfied.
        let sg2_count = ctx.count_in_group("NAD", &["SG29", "SG2"]);
        let sg3_count = ctx.count_in_group("RFF", &["SG29", "SG3"]);
        if sg2_count == 0 || sg3_count == 0 {
            return ConditionResult::Unknown;
        }
        ConditionResult::from(sg2_count == sg3_count)
    }

    /// [2099] Die SG2 Lieferant an der Lokation ist genau einmal anzugeben.
    // REVIEW: Simple cardinality check: SG2 must appear exactly once (genau einmal). Implemented using count_in_group on NAD (the entry segment of SG2) within SG29. Returns Unknown when no SG2 is found at all (not yet present), False when count > 1, True when exactly 1. Medium confidence due to unconfirmed group path without the full EDIFACT Segment Structure Reference for this PID. (medium confidence)
    fn evaluate_2099(&self, ctx: &EvaluationContext) -> ConditionResult {
        // SG2 Lieferant an der Lokation must appear exactly once.
        // Count NAD segments (entry segment of SG2) within the SG29 SG2 group path.
        let count = ctx.count_in_group("NAD", &["SG29", "SG2"]);
        if count == 0 {
            return ConditionResult::Unknown;
        }
        ConditionResult::from(count == 1)
    }
}