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_ENUMERATION`) — DO NOT EDIT.
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-FileCopyrightText: openEHR Foundation
// SPDX-License-Identifier: Apache-2.0

//! The openEHR `BMM_ENUMERATION` 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::v1_1::bmm::core::bmm_class::BmmClass;
use crate::v1_1::bmm::core::bmm_enumeration_integer::BmmEnumerationInteger;
use crate::v1_1::bmm::core::bmm_enumeration_string::BmmEnumerationString;
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 an enumeration type.
///
/// In the BMM system, an 'enumeration' type is understood as an underlying basic type and a set of named constants of that type. It is designed so that the default type is Integer, and the default constants are numbered 0, 1, ... Optional model elements can be specified to override the values and / or the type.
#[doc(alias = "BMM_ENUMERATION")]
#[derive(Debug, Clone, PartialEq)]
pub struct BmmEnumerationData {
    // inherited: BMM_MODEL_ELEMENT
    /// Optional documentation of this element.
    pub documentation: Option<String>,

    // inherited: BMM_CLASS
    /// 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,
    /// The list of names of the enumeration. If no values are supplied, the integer values 0, 1, 2, ... are assumed.
    pub item_names: Option<Vec<String>>,
    /// Optional list of specific values. Must be 1:1 with \`item_names' list.
    pub item_values: Option<Vec<serde_json::Value>>,
    /// Name of type any concrete BMM_ENUMERATION_* sub-type is based on, i.e. the name of type bound to 'T' in a declared use of this type.
    pub underlying_type_name: String,
}

/// Polymorphic slot of `BMM_ENUMERATION`, dispatched on each payload's `_type`.
///
/// Definition of an enumeration type.
///
/// In the BMM system, an 'enumeration' type is understood as an underlying basic type and a set of named constants of that type. It is designed so that the default type is Integer, and the default constants are numbered 0, 1, ... Optional model elements can be specified to override the values and / or the type.
#[doc(alias = "BMM_ENUMERATION")]
#[derive(Debug, Clone, PartialEq)]
pub enum BmmEnumeration {
    /// The `BMM_ENUMERATION_INTEGER` subtype of `BMM_ENUMERATION`.
    BmmEnumerationInteger(BmmEnumerationInteger),
    /// The `BMM_ENUMERATION_STRING` subtype of `BMM_ENUMERATION`.
    BmmEnumerationString(BmmEnumerationString),
    /// An instance of `BMM_ENUMERATION` itself (its own, least-rich form).
    BmmEnumeration(BmmEnumerationData),
}