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
// @generated by openehr-codegen from BMM (`BMM_SIMPLE_CLASS`) — DO NOT EDIT.
//! The openEHR `BMM_SIMPLE_CLASS` spec class, generated from the vendored BMM
//! meta-model.
#![expect(
clippy::disallowed_types,
reason = "adjudicated free-form JSON slots: serde_json::Value is workspace-banned (#1694); a generated carrier exists only where the spec leaves the slot open, and each adjudicated field's NOTE names its citation"
)]
use crate::bmm3::core::entity::bmm_class::BmmClass;
use crate::bmm3::core::entity::bmm_model_type::BmmModelType;
use crate::bmm3::core::entity::range_constrained::bmm_enumeration::BmmEnumeration;
use crate::bmm3::core::feature::bmm_feature::BmmFeature;
use crate::bmm3::core::feature::bmm_feature_group::BmmFeatureGroup;
use crate::bmm3::core::feature::bmm_function::BmmFunction;
use crate::bmm3::core::feature::bmm_procedure::BmmProcedure;
use crate::bmm3::core::feature::bmm_property::BmmProperty;
use crate::bmm3::core::feature::bmm_static::BmmStatic;
use crate::bmm3::core::model::bmm_package::BmmPackage;
use crate::bmm3::statement::bmm_assertion::BmmAssertion;
/// Definition of a simple class, i.e. a class that has no generic parameters and is 1:1 with the type it generates.
#[doc(alias = "BMM_SIMPLE_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub struct BmmSimpleClassData {
// inherited: BMM_MODEL_ELEMENT
/// Name of this model element.
pub name: String,
/// Optional documentation of this element, as a keyed list.
///
/// It is strongly recommended to use the following key /type combinations for the relevant purposes:
///
/// * `"purpose": String`
/// * `"keywords": List<String>`
/// * `"use": String`
/// * `"misuse": String`
/// * `"references": String`
///
/// Other keys and value types may be freely added.
pub documentation: Option<std::collections::BTreeMap<String, serde_json::Value>>,
// NOTE: `scope` (BMM-mandatory back-reference) omitted — LANG BMM3 bmm_module (scope: BMM_MODEL — redefinition of BMM_MODEL_ELEMENT.scope). A back-reference is not forward-owned data and never appears on the canonical wire; emitting it as an owning field would make this type non-constructible.
/// Optional meta-data of this element, as a keyed list. May be used to extend the meta-model.
pub extensions: Option<std::collections::BTreeMap<String, serde_json::Value>>,
// inherited: BMM_MODULE
/// List of feature groups in this class.
pub feature_groups: Option<Vec<BmmFeatureGroup>>,
// inherited: BMM_CLASS
/// Features of this module.
pub features: Option<Vec<BmmFeature>>,
/// List of immediate inheritance parents.
pub ancestors: Option<std::collections::BTreeMap<String, BmmModelType>>,
/// Package this class belongs to.
pub package: BmmPackage,
/// Properties defined in this class (subset of `_features_`).
pub properties: Option<std::collections::BTreeMap<String, BmmProperty>>,
/// Reference to original source schema defining this class. Useful for UI tools to determine which original schema file to open for a given class for manual editing.
pub source_schema_id: String,
/// List of computed references to base classes of immediate inheritance descendants, derived when members of `_ancestors_` are attached at creation time.
pub immediate_descendants: Option<Vec<BmmClass>>,
/// True if this definition overrides a class of the same name in an included schema.
pub is_override: bool,
/// Static properties defined in this class (subset of `_features_`).
pub static_properties: Option<std::collections::BTreeMap<String, BmmStatic>>,
/// Functions defined in this class (subset of `_features_`).
pub functions: Option<std::collections::BTreeMap<String, BmmFunction>>,
/// Procedures defined in this class (subset of `_features_`).
pub procedures: Option<std::collections::BTreeMap<String, BmmProcedure>>,
/// True if this class represents a type considered to be primitive in the type system, i.e. any typically built-in or standard library type such as `String`, `Date`, `Hash<K,V>` etc.
pub is_primitive: Option<bool>,
/// True if this class is marked as abstract, i.e. direct instances cannot be created from its direct type.
pub is_abstract: Option<bool>,
/// The `invariants` attribute of openEHR `BMM_CLASS` (the vendored BMM carries no documentation for it).
pub invariants: Option<Vec<BmmAssertion>>,
/// Subset of `_procedures_` that may be used to initialise a new instance of an object, and whose execution will guarantee that class invariants are satisfied.
pub creators: Option<std::collections::BTreeMap<String, BmmProcedure>>,
/// Subset of `_creators_` that create a new instance from a single argument of another type.
pub converters: Option<std::collections::BTreeMap<String, BmmProcedure>>,
}
/// Polymorphic slot of `BMM_SIMPLE_CLASS`, dispatched on each payload's `_type`.
///
/// Definition of a simple class, i.e. a class that has no generic parameters and is 1:1 with the type it generates.
#[doc(alias = "BMM_SIMPLE_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub enum BmmSimpleClass {
/// The `BMM_ENUMERATION` subtype of `BMM_SIMPLE_CLASS`.
BmmEnumeration(BmmEnumeration),
/// An instance of `BMM_SIMPLE_CLASS` itself (its own, least-rich form).
BmmSimpleClass(BmmSimpleClassData),
}