openehr-rm 0.0.128

openEHR RM Reference Model, generated from BMM: generations v1_1 (RM 1.1.0) and v1_2 (RM 1.2.0, current)
Documentation
// @generated by openehr-codegen from BMM (`X_VERSIONED_OBJECT`) — DO NOT EDIT.
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-FileCopyrightText: openEHR Foundation
// SPDX-License-Identifier: Apache-2.0

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

use crate::v1_1::common::change_control::original_version::OriginalVersion;
use crate::v1_1::common::generic::revision_history::RevisionHistory;
use crate::v1_1::data_types::quantity::date_time::dv_date_time::DvDateTime;
use crate::v1_1::ehr_extract::openehr_extract::x_versioned_composition::XVersionedComposition;
use crate::v1_1::ehr_extract::openehr_extract::x_versioned_ehr_access::XVersionedEhrAccess;
use crate::v1_1::ehr_extract::openehr_extract::x_versioned_ehr_status::XVersionedEhrStatus;
use crate::v1_1::ehr_extract::openehr_extract::x_versioned_folder::XVersionedFolder;
use crate::v1_1::ehr_extract::openehr_extract::x_versioned_party::XVersionedParty;
use openehr_base::v1_2::base_types::identification::hier_object_id::HierObjectId;
use openehr_base::v1_2::base_types::identification::object_ref::ObjectRef;

/// Variety of Extract content that consists is a sharable data-oriented version of `VERSIONED_OBJECT<T>`.
#[doc(alias = "X_VERSIONED_OBJECT")]
#[derive(Debug, Clone, PartialEq)]
pub struct XVersionedObjectData<T> {
    /// Uid of original `VERSIONED_OBJECT`.
    pub uid: HierObjectId,
    /// Owner_id from original `VERSIONED_OBJECT`, which identifies source EHR.
    pub owner_id: ObjectRef,
    /// Creation time of original `VERSIONED_OBJECT`.
    pub time_created: DvDateTime,
    /// Total number of versions in original `VERSIONED_OBJECT` at time of creation of this `X_VERSIONED_OBJECT`.
    pub total_version_count: i32,
    /// The number of Versions in this extract for this Versioned object, i.e. the count of items in the versions attribute. May be 0 if only revision history is requested.
    pub extract_version_count: i32,
    /// Optional revision history of the original `VERSIONED_OBJECT`. If included, it is the complete revision history.
    pub revision_history: Option<RevisionHistory>,
    /// 0 or more Versions from the original `VERSIONED_OBJECT`, according to the Extract specification.
    pub versions: Option<Vec<OriginalVersion<T>>>,
}

/// Polymorphic slot of `X_VERSIONED_OBJECT`, dispatched on each payload's `_type`.
///
/// Variety of Extract content that consists is a sharable data-oriented version of `VERSIONED_OBJECT<T>`.
#[doc(alias = "X_VERSIONED_OBJECT")]
#[derive(Debug, Clone, PartialEq)]
pub enum XVersionedObject<T> {
    /// The `X_VERSIONED_COMPOSITION` subtype of `X_VERSIONED_OBJECT`.
    XVersionedComposition(XVersionedComposition),
    /// The `X_VERSIONED_EHR_ACCESS` subtype of `X_VERSIONED_OBJECT`.
    XVersionedEhrAccess(XVersionedEhrAccess),
    /// The `X_VERSIONED_EHR_STATUS` subtype of `X_VERSIONED_OBJECT`.
    XVersionedEhrStatus(XVersionedEhrStatus),
    /// The `X_VERSIONED_FOLDER` subtype of `X_VERSIONED_OBJECT`.
    XVersionedFolder(XVersionedFolder),
    /// The `X_VERSIONED_PARTY` subtype of `X_VERSIONED_OBJECT`.
    XVersionedParty(XVersionedParty),
    /// An instance of `X_VERSIONED_OBJECT` itself (its own, least-rich form).
    XVersionedObject(XVersionedObjectData<T>),
}