openehr-am 0.0.128

openEHR AM Archetype Model, generated from BMM: generations v1_4 (AM 1.4.0, ADL 1.4) and v2_4 (AM 2.4.0, ADL 2; current)
Documentation
// @generated by openehr-codegen from BMM (`C_TERMINOLOGY_CODE`) — 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 `C_TERMINOLOGY_CODE` spec class, generated from the vendored BMM
//! meta-model.

use crate::v2_4::aom2::constraint_model::archetype_constraint::ArchetypeConstraint;
use crate::v2_4::aom2::constraint_model::c_second_order::CSecondOrder;
use crate::v2_4::aom2::constraint_model::primitive::constraint_status::ConstraintStatus;
use crate::v2_4::aom2::constraint_model::sibling_order::SiblingOrder;
use openehr_base::v1_3::foundation_types::interval::multiplicity_interval::MultiplicityInterval;
use openehr_base::v1_3::foundation_types::terminology::terminology_code::TerminologyCode;

/// Constrainer type for instances of `Terminology_code`. The constraint attribute can contain:
///
/// * a single at-code
/// * a single ac-code, representing a value-set that is defined in the archetype terminology
///
/// If there is an assumed value for the ac-code case above, the `_assumed_value_` attribute contains a single at-code, which must come from the list of at-codes defined as the internal value set for the ac-code.
///
/// The `_constraint_status_` attribute and `_constraint_required_()` function together define whether the `_constraint_` is considered formal ('required') or not. In the non-required cases, a data-item matched to this constraint may be any coded term.
#[doc(alias = "C_TERMINOLOGY_CODE")]
#[derive(Debug, Clone, PartialEq)]
pub struct CTerminologyCode {
    // inherited: ARCHETYPE_CONSTRAINT
    /// Parent node, except in the case of the top of a tree, i.e. root `C_COMPLEX_OBJECT` of an archetype definition.
    pub parent: Option<Box<ArchetypeConstraint>>,
    /// The `soc_parent` attribute of openEHR `ARCHETYPE_CONSTRAINT` (the vendored BMM carries no documentation for it).
    pub soc_parent: Option<CSecondOrder>,

    // inherited: C_OBJECT
    /// Reference model type that this node corresponds to.
    pub rm_type_name: String,
    /// Occurrences of this object node in the data, under the owning attribute.
    ///
    /// Upper limit can only be greater than 1 if owning attribute has a cardinality of more than 1.
    /// Only set if it overrides the parent archetype in the case of specialised archetypes, or else the occurrences inferred from the underlying reference model existence and/or cardinality of the containing attribute.
    pub occurrences: Option<MultiplicityInterval>,
    /// Semantic identifier of this node, used to distinguish sibling nodes.
    ///
    /// All nodes must have a `_node_id_`; for nodes under a container `C_ATTRIBUTE`. For at-coded archetypes `_node_id_` must be an at-code defined in the archetype terminology and for valid structures all node ids are at-codes. For id-coded archetypes  `_node_id_` must be an id-code defined in the archetype terminology and for valid structures all node ids are id-codes.
    ///
    /// For `C_PRIMITIVE_OBJECTs` represented in ADL inline form, this attribute will have the special value `Primitive_node_id`; otherwise it will have the node id read during parsing.
    ///
    pub node_id: String,
    /// Additional identifiers of this node.
    ///
    /// openEHR archetypes can carry original ALD2 id-codes in this attribute and it can also carry human readable codes for future use. Alternative ids must be unique within the archetype.
    pub alternative_ids: Option<Vec<String>>,
    /// True if this node and by implication all sub-nodes are deprecated for use.
    pub is_deprecated: Option<bool>,
    /// Optional indicator of order of this node with respect to another sibling. Only meaningful in a specialised archetype for a `C_OBJECT` within a `C_ATTRIBUTE` with `_is_multiple_ = True`.
    pub sibling_order: Option<SiblingOrder>,
    /// The `default_value` attribute of openEHR `C_TERMINOLOGY_CODE` (the vendored BMM carries no documentation for it).
    pub default_value: Option<TerminologyCode>,
    /// Assumed Terminology code value.
    pub assumed_value: Option<TerminologyCode>,

    // inherited: C_PRIMITIVE_OBJECT
    /// True if this object represents a constraint on an enumerated type from the reference model, where the latter is assumed to be based on a primitive type, generally Integer or String.
    pub is_enumerated_type_constraint: Option<bool>,
    /// Type of individual constraint - a single string that can either be a local at-code, or a local ac-code signifying a locally defined value set.
    ///
    /// If an ac-code, assumed_value may contain an at-code from the value set of the ac-code.
    ///
    /// Use an empty string for no constraint.
    pub constraint: String,
    /// Constraint status of this terminology constraint. If Void, the meaning is as follows:
    ///
    /// * in a top-level  archetype, equivalent to `required`;
    /// * in a specialised (source) archetype, the meaning is to inherit the value from the corresponding node in the parent.
    ///
    /// In the case of a specialised archetype generated by flattening, the value of this field will be:
    ///
    /// * Void if it was Void in the parent;
    /// * otherwise, it will carry the same value as in the parent.
    pub constraint_status: Option<ConstraintStatus>,
}