1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// @generated by openehr-codegen from BMM (`C_COMPLEX_OBJECT`) — 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_COMPLEX_OBJECT` 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::v2_4::aom2::constraint_model::archetype_constraint::ArchetypeConstraint;
use crate::v2_4::aom2::constraint_model::c_archetype_root::CArchetypeRoot;
use crate::v2_4::aom2::constraint_model::c_attribute::CAttribute;
use crate::v2_4::aom2::constraint_model::c_attribute_tuple::CAttributeTuple;
use crate::v2_4::aom2::constraint_model::c_second_order::CSecondOrder;
use crate::v2_4::aom2::constraint_model::sibling_order::SiblingOrder;
use openehr_base::v1_3::foundation_types::interval::multiplicity_interval::MultiplicityInterval;
/// Constraint on complex objects, i.e. any object that consists of other object constraints.
#[doc(alias = "C_COMPLEX_OBJECT")]
#[derive(Debug, Clone, PartialEq)]
pub struct CComplexObjectData {
// 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>,
// inherited: C_DEFINED_OBJECT
/// Default value set in a template, and present in an operational template. Generally limited to leaf and near-leaf nodes.
pub default_value: Option<serde_json::Value>,
/// List of constraints on attributes of the reference model type represented by this object.
pub attributes: Option<Vec<CAttribute>>,
/// List of attribute tuple constraints under this object constraint, if any.
pub attribute_tuples: Option<Vec<CAttributeTuple>>,
}
/// Polymorphic slot of `C_COMPLEX_OBJECT`, dispatched on each payload's `_type`.
///
/// Constraint on complex objects, i.e. any object that consists of other object constraints.
#[doc(alias = "C_COMPLEX_OBJECT")]
#[derive(Debug, Clone, PartialEq)]
pub enum CComplexObject {
/// The `C_ARCHETYPE_ROOT` subtype of `C_COMPLEX_OBJECT`.
CArchetypeRoot(Box<CArchetypeRoot>),
/// An instance of `C_COMPLEX_OBJECT` itself (its own, least-rich form).
CComplexObject(CComplexObjectData),
}