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 (`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 `BMM_CLASS` spec class, generated from the vendored BMM
//! meta-model.

use crate::v1_1::bmm::core::bmm_enumeration::BmmEnumeration;
use crate::v1_1::bmm::core::bmm_generic_class::BmmGenericClass;
use crate::v1_1::bmm::core::bmm_package::BmmPackage;
use crate::v1_1::bmm::core::bmm_property::BmmProperty;
use crate::v1_1::bmm::core::bmm_type::BmmType;

/// Definition of a class in an object model. A class is type that may be open or closed in terms of other types mentioned within.
#[doc(alias = "BMM_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub struct BmmClassData {
    // inherited: BMM_MODEL_ELEMENT
    /// Optional documentation of this element.
    pub documentation: Option<String>,
    /// Name of this class. Note that unlike UML, names of classes are just the root name, even if the class is generic.
    pub name: String,
    /// List of immediate inheritance parents.
    pub ancestors: Option<std::collections::BTreeMap<String, BmmClass>>,
    /// Package this class belongs to.
    pub package: BmmPackage,
    /// List of attributes defined in this class.
    pub properties: Option<std::collections::BTreeMap<String, BmmProperty<BmmType>>>,
    /// 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 immediate inheritance descendants.
    pub immediate_descendants: Option<Vec<String>>,
    /// True if this class is abstract in its model.
    pub is_abstract: bool,
    /// True if this class is designated a primitive type within the overall type system of the schema.
    pub is_primitive_type: bool,
    /// True if this definition overrides a class of the same name in an included schema.
    pub is_override: bool,
}

/// Polymorphic slot of `BMM_CLASS`, dispatched on each payload's `_type`.
///
/// Definition of a class in an object model. A class is type that may be open or closed in terms of other types mentioned within.
#[doc(alias = "BMM_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub enum BmmClass {
    /// The `BMM_ENUMERATION` subtype of `BMM_CLASS`.
    BmmEnumeration(BmmEnumeration),
    /// The `BMM_GENERIC_CLASS` subtype of `BMM_CLASS`.
    BmmGenericClass(BmmGenericClass),
    /// An instance of `BMM_CLASS` itself (its own, least-rich form).
    BmmClass(BmmClassData),
}