Skip to main content

dpp_aas/
templates.rs

1use super::semantic_ids;
2
3/// Metadata for a single AAS submodel template binding.
4#[derive(Debug, Clone, PartialEq)]
5pub struct SubmodelTemplate {
6    /// Catalog sector key this template applies to, e.g. `"battery"`.
7    pub sector_key: &'static str,
8    /// Semantic ID (IDTA URN, Catena-X URN, ECLASS IRDI, or odal-node placeholder).
9    pub semantic_id: &'static str,
10    /// Human-readable version string (from the source template / standard).
11    pub version: &'static str,
12    /// `true` when the semantic ID is a placeholder (`urn:odal-node:…`) waiting for
13    /// an official IDTA or other standard template. Gate these from claiming
14    /// conformance with the AAS Interoperability Specification.
15    pub is_placeholder: bool,
16}
17
18static SUBMODEL_TEMPLATES: &[SubmodelTemplate] = &[
19    SubmodelTemplate {
20        sector_key: "battery",
21        semantic_id: semantic_ids::BATTERY_TECHNICAL_DATA,
22        version: "6.0.0",
23        is_placeholder: false,
24    },
25    SubmodelTemplate {
26        sector_key: "textile",
27        semantic_id: semantic_ids::TEXTILE_MATERIAL,
28        version: "1.0",
29        is_placeholder: true,
30    },
31    SubmodelTemplate {
32        sector_key: "electronics",
33        semantic_id: semantic_ids::ELECTRONICS_PRODUCT_DATA,
34        version: "1.0",
35        is_placeholder: true,
36    },
37    SubmodelTemplate {
38        sector_key: "steel",
39        semantic_id: semantic_ids::STEEL_PRODUCT_DATA,
40        version: "1.0",
41        is_placeholder: true,
42    },
43    SubmodelTemplate {
44        sector_key: "construction",
45        semantic_id: semantic_ids::CONSTRUCTION_PRODUCT_DATA,
46        version: "1.0",
47        is_placeholder: true,
48    },
49    SubmodelTemplate {
50        sector_key: "tyre",
51        semantic_id: semantic_ids::TYRE_PRODUCT_DATA,
52        version: "1.0",
53        is_placeholder: true,
54    },
55    SubmodelTemplate {
56        sector_key: "toy",
57        semantic_id: semantic_ids::TOY_PRODUCT_DATA,
58        version: "1.0",
59        is_placeholder: true,
60    },
61    SubmodelTemplate {
62        sector_key: "aluminium",
63        semantic_id: semantic_ids::ALUMINIUM_PRODUCT_DATA,
64        version: "1.0",
65        is_placeholder: true,
66    },
67    SubmodelTemplate {
68        sector_key: "furniture",
69        semantic_id: semantic_ids::FURNITURE_PRODUCT_DATA,
70        version: "1.0",
71        is_placeholder: true,
72    },
73    SubmodelTemplate {
74        sector_key: "detergent",
75        semantic_id: semantic_ids::DETERGENT_PRODUCT_DATA,
76        version: "1.0",
77        is_placeholder: true,
78    },
79    SubmodelTemplate {
80        sector_key: "unsold-goods",
81        semantic_id: semantic_ids::UNSOLD_GOODS_REPORT,
82        version: "1.0",
83        is_placeholder: true,
84    },
85];
86
87/// Look up the AAS submodel template binding for a catalog sector key.
88///
89/// Returns `None` for sectors that don't yet have a dedicated AAS template.
90/// Returns `Some(t)` where `t.is_placeholder == true` when the semantic ID is
91/// a draft Odal Node placeholder, not a ratified IDTA standard.
92pub fn sector_submodel_template(sector_key: &str) -> Option<&'static SubmodelTemplate> {
93    SUBMODEL_TEMPLATES
94        .iter()
95        .find(|t| t.sector_key == sector_key)
96}
97
98/// Returns every sector template whose semantic ID is still a placeholder.
99///
100/// Use this in CI to gate placeholder IDs from being promoted as conformant.
101pub fn placeholder_templates() -> impl Iterator<Item = &'static SubmodelTemplate> {
102    SUBMODEL_TEMPLATES.iter().filter(|t| t.is_placeholder)
103}