openehr-lang 0.0.128

openEHR LANG BMM/P_BMM object model, generated from BMM: generations v1_0 (LANG 1.0.0) and v1_1 (LANG 1.1.0, current; the stable BMM v2.x unit beside the paused BMM3 unit), plus hand-written ODIN/BEL/EL readers
Documentation
// @generated by openehr-codegen from BMM (`P_BMM_CLASS`) — DO NOT EDIT.
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-FileCopyrightText: openEHR Foundation
// SPDX-License-Identifier: Apache-2.0
// Hand-written spec functions/invariants live in the sibling `*_impl.rs`.

//! The openEHR `P_BMM_CLASS` spec class, generated from the vendored BMM
//! meta-model.

use crate::v1_1::bmm::core::bmm_class::BmmClass;
use crate::v1_1::bmm_persistence::p_bmm_base_type::PBmmBaseType;
use crate::v1_1::bmm_persistence::p_bmm_constant::PBmmConstant;
use crate::v1_1::bmm_persistence::p_bmm_enumeration::PBmmEnumeration;
use crate::v1_1::bmm_persistence::p_bmm_function::PBmmFunction;
use crate::v1_1::bmm_persistence::p_bmm_generic_parameter::PBmmGenericParameter;
use crate::v1_1::bmm_persistence::p_bmm_interface::PBmmInterface;
use crate::v1_1::bmm_persistence::p_bmm_property::PBmmProperty;

/// Definition of persistent form of `BMM_CLASS` for serialisation to ODIN, JSON, XML etc.
#[doc(alias = "P_BMM_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub struct PBmmClassData {
    // inherited: P_BMM_MODEL_ELEMENT
    /// Optional documentation of this element.
    pub documentation: Option<String>,
    /// Name of the class. Persisted attribute.
    pub name: String,
    /// List of immediate inheritance parents. If there are generic ancestors, use `_ancestor_defs_` instead. Persisted attribute.
    pub ancestors: Option<Vec<String>>,
    /// Constants defined in this class, keyed by name. Persistent attribute.
    pub constants: Option<std::collections::BTreeMap<String, PBmmConstant>>,
    /// Properties defined in this class, keyed by name. Persisted attribute.
    pub properties: Option<std::collections::BTreeMap<String, PBmmProperty>>,
    /// Functions (routines) defined in this class, keyed by name. Persisted attribute.
    pub functions: Option<std::collections::BTreeMap<String, PBmmFunction>>,
    /// Invariants defined on this class, as a Hash of assertion expressions keyed by tag. Persisted attribute.
    pub invariants: Option<std::collections::BTreeMap<String, String>>,
    /// True if this is an abstract type. Persisted attribute.
    pub is_abstract: Option<bool>,
    /// True if this class definition overrides one found in an included schema.
    pub is_override: Option<bool>,
    /// Generic parameter definitions, keyed by parameter name. Persisted attribute.
    pub generic_parameter_defs: Option<indexmap::IndexMap<String, PBmmGenericParameter>>,
    /// Reference to original source schema defining this class.
    ///
    /// Set during `BMM_SCHEMA` materialise. Useful for GUI tools to enable user to edit the schema file containing a given class (i.e. taking into account that a class may be in any of the schemas in a schema inclusion hierarchy).
    pub source_schema_id: String,
    /// `BMM_CLASS` object built by `_create_bmm_class_definition_` and `_populate_bmm_class_definition_`.
    pub bmm_class: Option<BmmClass>,
    /// Unique id generated for later comparison during merging, in order to detect if two classes are the same. Assigned in post-load processing.
    pub uid: i32,
    /// Structured inheritance ancestors, keyed by type signature, e.g. `GENERIC_PARENT<T,SUPPLIER_B>`.
    ///
    /// Used instead of `_ancestors_` when the class has a generic ancestor; any non-generic ancestor of the same class is then also listed here, as a `P_BMM_SIMPLE_TYPE`. Persisted attribute.
    pub ancestor_defs: Option<std::collections::BTreeMap<String, PBmmBaseType>>,
}

/// Polymorphic slot of `P_BMM_CLASS`, dispatched on each payload's `_type`.
///
/// Definition of persistent form of `BMM_CLASS` for serialisation to ODIN, JSON, XML etc.
#[doc(alias = "P_BMM_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub enum PBmmClass {
    /// The `P_BMM_ENUMERATION` subtype of `P_BMM_CLASS`.
    PBmmEnumeration(PBmmEnumeration),
    /// The `P_BMM_INTERFACE` subtype of `P_BMM_CLASS`.
    PBmmInterface(PBmmInterface),
    /// An instance of `P_BMM_CLASS` itself (its own, least-rich form).
    PBmmClass(PBmmClassData),
}