openehr-lang 0.0.2

openEHR LANG 1.0.0: BMM/P_BMM object model (generated from BMM) plus a hand-written ODIN instance parser (the `odin` module — deliberately off the codegen path).
Documentation
// @generated by openehr-codegen from BMM (`BMM_GENERIC_CLASS`) — DO NOT EDIT.

//! The openEHR `BMM_GENERIC_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::bmm_parameter_type::BmmParameterType;
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 generic class in an object model.
#[doc(alias = "BMM_GENERIC_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub struct BmmGenericClass {
    // 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>>,
    /// List of formal generic parameters, keyed by name. These are defined either directly on this class or by the inclusion of an ancestor class which is generic.
    pub generic_parameters: std::collections::BTreeMap<String, BmmParameterType>,
}