Skip to main content

automapper_validation/generated/fv2610/
utilmd_gas_conditions_fv2610.rs

1// <auto-generated>
2// Generated by automapper-generator generate-conditions
3// AHB: xml-migs-and-ahbs/FV2610/UTILMD_AHB_Gas_1_2_Fehlerkorrektur_20260806.xml
4// Generated: 2026-04-22T18:01:29Z
5// Delegates unchanged conditions to UtilmdGasConditionEvaluatorFV2604 (FV2604).
6// </auto-generated>
7
8#![allow(clippy::style, clippy::complexity)]
9
10#[allow(unused_imports)]
11use crate::eval::format_validators::*;
12use crate::eval::{ConditionEvaluator, ConditionResult, EvaluationContext};
13use crate::generated::fv2604::UtilmdGasConditionEvaluatorFV2604;
14
15/// Condition evaluator for UTILMD_Gas FV2610.
16///
17/// Delegates to [`UtilmdGasConditionEvaluatorFV2604`] for conditions whose AHB description is
18/// unchanged from that version. Local overrides: [44, 203].
19pub struct UtilmdGasConditionEvaluatorFV2610 {
20    fallback: UtilmdGasConditionEvaluatorFV2604,
21}
22
23impl Default for UtilmdGasConditionEvaluatorFV2610 {
24    fn default() -> Self {
25        Self {
26            fallback: UtilmdGasConditionEvaluatorFV2604::default(),
27        }
28    }
29}
30
31/// Condition IDs whose implementation differs from the fallback.
32const FV2610_OVERRIDES: &[u32] = &[44, 203];
33
34impl ConditionEvaluator for UtilmdGasConditionEvaluatorFV2610 {
35    fn message_type(&self) -> &str {
36        "UTILMD_Gas"
37    }
38
39    fn format_version(&self) -> &str {
40        "FV2610"
41    }
42
43    fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
44        match condition {
45            203 => self.evaluate_203(ctx),
46            44 => self.evaluate_44(ctx),
47            other => self.fallback.evaluate(other, ctx),
48        }
49    }
50
51    fn is_external(&self, condition: u32) -> bool {
52        self.fallback.is_external(condition)
53    }
54
55    fn is_known(&self, condition: u32) -> bool {
56        FV2610_OVERRIDES.contains(&condition) || self.fallback.is_known(condition)
57    }
58}
59
60impl UtilmdGasConditionEvaluatorFV2610 {
61    /// [203] Wenn STS+7++E06 / Z39 / ZC6 / ZC7 / ZT6 / ZT7 / Z02 / ZZD
62    fn evaluate_203(&self, ctx: &EvaluationContext) -> ConditionResult {
63        ctx.has_qualified_value(
64            "STS",
65            0,
66            "7",
67            2,
68            0,
69            &["E06", "Z39", "ZC6", "ZC7", "ZT6", "ZT7", "Z02", "ZZD"],
70        )
71    }
72
73    /// [44] Wenn im selben Segment im DE2379 der Code 106 vorhanden ist
74    fn evaluate_44(&self, ctx: &EvaluationContext) -> ConditionResult {
75        ConditionResult::from(ctx.self_segment_value_equals("DTM", 0, 2, "106"))
76    }
77}